qemu-arm
[Top][All Lists]
Advanced

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

RE: [PATCH v2 1/7] exec: Fix for qemu_ram_resize() callback


From: Shameerali Kolothum Thodi
Subject: RE: [PATCH v2 1/7] exec: Fix for qemu_ram_resize() callback
Date: Fri, 28 Feb 2020 16:49:46 +0000


> -----Original Message-----
> From: David Hildenbrand [mailto:address@hidden]
> Sent: 13 February 2020 17:09
> To: Shameerali Kolothum Thodi <address@hidden>;
> Igor Mammedov <address@hidden>
> Cc: address@hidden; address@hidden;
> address@hidden; address@hidden; address@hidden;
> xuwei (O) <address@hidden>; Linuxarm <address@hidden>;
> address@hidden; address@hidden; address@hidden;
> address@hidden; Juan Jose Quintela Carreira <address@hidden>
> Subject: Re: [PATCH v2 1/7] exec: Fix for qemu_ram_resize() callback

[...]

> >> Thanks for that. I had a go with the below patch and it indeed fixes the 
> >> issue
> >> of callback not being called on resize. But the migration fails with the 
> >> below
> >> error,
> >>
> >> For x86
> >> ---------
> >> qemu-system-x86_64: Unknown combination of migration flags: 0x14
> >> qemu-system-x86_64: error while loading state for instance 0x0 of device
> 'ram'
> >> qemu-system-x86_64: load of migration failed: Invalid argument
> >>
> >> For arm64
> >> --------------
> >> qemu-system-aarch64: Received an unexpected compressed page
> >> qemu-system-aarch64: error while loading state for instance 0x0 of device
> 'ram'
> >> qemu-system-aarch64: load of migration failed: Invalid argument
> >>
> >> I haven’t debugged this further but looks like there is a corruption
> happening.
> >> Please let me know if you have any clue.
> >
> > The issue is
> >
> > qemu_put_be64(f, ram_bytes_total_common(true) |
> RAM_SAVE_FLAG_MEM_SIZE)
> >
> > The total ram size we store must be page aligned, otherwise it will be
> > detected as flags. Hm ... maybe we can round it up ...
> >
> 
> I'm afraid we can't otherwise we will run into issues in
> ram_load_precopy(). Hm ...

Sorry, took a while to get back on this. Yes, round up indeed breaks in
ram_load_precopy() . I had the below on top of your patch and that 
seems to do the job (sanity tested on arm/virt).

Please take a look and let me know if you see any issues with this approach.

Thanks,
Shameer

diff --git a/migration/ram.c b/migration/ram.c
index 2acc4b85ca..7447f0cefa 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1782,7 +1782,7 @@ static uint64_t ram_bytes_total_migration(void)
     RCU_READ_LOCK_GUARD();
 
     RAMBLOCK_FOREACH_MIGRATABLE(block) {
-        total += ramblock_ram_bytes_migration(block);
+        total += block->used_length;
     }
     return total;
 }
@@ -3479,7 +3479,7 @@ static int ram_load_precopy(QEMUFile *f)
                     ret = -EINVAL;
                 }
 
-                total_ram_bytes -= length;
+                total_ram_bytes -= block->used_length;
             }
             break;




reply via email to

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