Peter Xu <[email protected]> writes:

> On Tue, Nov 25, 2025 at 05:46:49PM +0000, Pawel Zmarzly wrote:
>> Snapshots made with mapped-ram and x-ignore-shared flags are
>> not parsed properly.
>> 
>> Signed-off-by: Pawel Zmarzly <[email protected]>
>> ---
>>  migration/ram.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/migration/ram.c b/migration/ram.c
>> index 29f016cb25..85fdc810ab 100644
>> --- a/migration/ram.c
>> +++ b/migration/ram.c
>> @@ -4277,6 +4277,11 @@ static int parse_ramblocks(QEMUFile *f, ram_addr_t 
>> total_ram_bytes)
>>          id[len] = 0;
>>          length = qemu_get_be64(f);
>>  
>> +        if (migrate_ignore_shared()) {
>> +            /* Read and discard the x-ignore-shared memory region address */
>> +            qemu_get_be64(f);
>> +        }
>> +
>>          block = qemu_ram_block_by_name(id);
>>          if (block) {
>>              ret = parse_ramblock(f, block, length);
>> -- 
>> 2.52.0
>> 
>
> Thanks for the patch, though the u64 was parsed in parse_ramblock()
> instead.  Would you consider refactoring that function instead?

There's actually not much going on in terms of "parsing" in
parse_ramblock(). I think we could move the migrate_ignore_shared() from
the end of the function to before the mapped-ram check().

Reply via email to