qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V4 06/19] physmem: preserve ram blocks for cpr


From: Peter Xu
Subject: Re: [PATCH V4 06/19] physmem: preserve ram blocks for cpr
Date: Wed, 18 Dec 2024 12:00:11 -0500

On Wed, Dec 18, 2024 at 11:34:34AM -0500, Steven Sistare wrote:
> After adding resizable support to qemu_ram_alloc_from_fd, I can also tweak it
> to grow the file while preserving error checking for the general case, and
> delete the explicit ftruncate in its caller:
> 
>     /*
>      * Allow file_ram_alloc to grow the file during CPR, if a resizable
>      * memory region wants a larger block than the incoming current size.
>      */
>     file_size = get_file_size(fd);
>     if (file_size && file_size < offset + max_size && size == max_size &&
>         migrate_mode() != MIG_MODE_CPR_TRANSFER) {

Firstly, this check is growing too long, maybe worthwhile to have a helper
already.

file_size_check():
    // COMMENTS...
    if (migrate_mode() == XXX) {
        return true;
    }

Said that, I think it's better we also add the flag to enforce the
truncation, only if cpr found a fd.  E.g. we may want to keep the old
behavior even if the user sets migrate mode to CPR (even without a
migration happening at all), then create a fd ramblock.

>         error_setg(errp, "backing store size 0x%" PRIx64
>                    " does not match 'size' option 0x" RAM_ADDR_FMT,
>                    file_size, max_size);
>         return NULL;
>     }
>     ...
>     new_block->host = file_ram_alloc(new_block, max_size, fd,
>                                      file_size < offset + max_size,
>                                      offset, errp);
> 
> - Steve
> 

-- 
Peter Xu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]