migration: avoid copying ignore-shared ramblock when in incoming migration
Quoted 6 lines · Catherine Ho
The root cause is the used idx is moved forward after 1st time incoming, and in 2nd time incoming, the
last_avail_idxwill be incorrectly restored from the saved device state file(not in the ram).I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
Does the destination end go through reset between the 1st and 2nd incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
thanks
-- PMM
Hi all,
I found an insterested issue here besides writting "dtb" rom into ram. That is, should qemu support incoming from the ignore-shared memory backend file repeatedly?
After I resolve the issue of writting "dtb" rom into ram, the incoming from the ignore-shared memory backend file works fine at the *first* time, but failed in the 2nd time.
It will report:
VQ 2 size 0x400 < last_avail_idx 0x1639 - used_idx 0x2688 Failed to load virtio-scsi:virtio
error while loading state for instance 0x0 of device 'virtio-mmio@000000000a003e00/virtio-scsi'
load of migration failed: Operation not permitted
The root cause is the used idx is moved forward after 1st time incoming, and in 2nd time incoming,
the last_avail_idx will be incorrectly restored from the saved device state file(not in the ram).
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
B.R.
Catherine
Quoted 61 lines · Catherine Ho
Hi all, thanks for the comments, I am digging into another potential error in the
ignore-shared live migration. After that, I will send out the v2 asap B.R.
CatherineQuoted 30 lines · Peter Xu
On Fri, Mar 22, 2019 at 10:12:11AM +0000, Dr. David Alan Gilbert wrote:
[...]
Quoted 25 lines
Quoted 16 lines
In general, when we reset the system, we want to bring it back to exactly the state that it was in when QEMU was first started. That means we need to reload all the rom blob data into memory (because the guest might have modified that memory while it was running).
If I understand correctly from other threads, the idea is that some of the RAM is shared between source and destination so it does not need to be manually copied during migration. If that is correct, then perhaps the right thing is that in the
rom_resetcode:
* if this rom blob is being loaded into a "shared" ram block
* and this reset is happening specifically before an inbound migration
* then skip loading the rom blob dataQuoted 5 lines
?
I don't know the right way to determine either the "is this a shared ram area" or "is this the reset prior to inbound migration", but perhaps you can fill that in.
Right, so in Catherine's patch there's a simple
in_incoming_migrationand checkingramblock_is_ignored; it might be better to use theqemu_ram_is_shared()call and I wonder if we can just check for beingin
Quoted 21 lines
Quoted 1 line
RUN_STATE_INMIGRATE- if that's early enough.Yes I feel like
runstate_check(RUN_STATE_INMIGRATE)should be enough to replace the new variable. And I'm even thinking whether we need to checkqemu_ram_is_shared()at all... ifrom_reset()simply refills the ROM data into the RAMs, then IIUC that operation could be skipped for all incoming migrations because all those ROM data (no matter they are filled into shared RAM or not) should already have been filled on the source side and:- if the ROM data's RAMBlock is shared backend, the latest data should already been there on the shared backend files, or,
- if the ROM data's RAMBlock is not shared backend, they'll eventually be migrated to the destination later on after this
rom_reset()on destination by the general RAM migration code.Regards,
--
Peter Xu
Quoted 10 lines · Catherine Ho
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitor migrate "exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
I think I'm confused. If you're killing the QEMU process and then running qemu again, then we must have done a full system reset as part of the work we do creating the VM for the second time we start the qemu binary.
thanks
-- PMM
Quoted 26 lines · Catherine Ho
Hi Peter Maydell
Quoted 4 lines · Peter Maydell
Quoted 1 line · Catherine Ho
The root cause is the used idx is moved forward after 1st time
incoming, and in 2nd time incoming,
Quoted 9 lines
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saved devicestate file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 6 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitor migrate "exec: cat>..."
3. quit the vm
via "quit" command of monitor
Quoted 9 lines
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.
s/sure/not sure
Quoted 8 lines
B.R.
Quoted 4 lines
thanks
-- PMM
Hi Peter Maydell
Quoted 4 lines · Peter Maydell
Quoted 1 line · Catherine Ho
The root cause is the used idx is moved forward after 1st time incoming,
and in 2nd time incoming,
Quoted 9 lines
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saved devicestate file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitor migrate "exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.
B.R.
Quoted 4 lines
thanks
-- PMM
Quoted 25 lines · Catherine Ho
Hi Peter Maydell
Quoted 4 lines · Peter Maydell
Quoted 1 line · Catherine Ho
The root cause is the used idx is moved forward after 1st time incoming,
and in 2nd time incoming,
Quoted 9 lines
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saved devicestate file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 13 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitor migrate "exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.
Yeah I really suspect its validity.
IMHO normal migration streams keep the device state and RAM data together in the dumped file, so they always match.
In your shared case, the device states are in the dumped file however the RAM data is located somewhere else. After you quit the VM from the 1st incoming migration the RAM is new (because that's a shared memory file) and the device data is still old. They do not match already, then I'd say you can't migrate with that any more.
If you want to do that, you'd better take snapshot of the RAM backend file if your filesystem supports (or even simpler, to back it up before hand) before you start any incoming migration. Then with the dumped file (which contains the device states) and that snapshot file (which contains the exact RAM data that matches the device states) you'll alway be able to migrate for as many times as you want.
Regards,
Signature · 1 line
Peter Xu
Quoted 53 lines · Peter Xu
Quoted 3 lines · Catherine Ho
Hi Peter Maydell
On Tue, 2 Apr 2019 at 11:05, Peter Maydell <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 1 line · Catherine Ho
The root cause is the used idx is moved forward after 1st time
incoming,
Quoted 18 lines
Quoted 10 lines
and in 2nd time incoming,
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saved devicestate file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 13 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitor migrate "exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.Yeah I really suspect its validity.
IMHO normal migration streams keep the device state and RAM data together in the dumped file, so they always match.
In your shared case, the device states are in the dumped file however the RAM data is located somewhere else. After you quit the VM from the 1st incoming migration the RAM is new (because that's a shared memory file) and the device data is still old. They do not match already, then I'd say you can't migrate with that any more.
Quoted 7 lines
If you want to do that, you'd better take snapshot of the RAM backend file if your filesystem supports (or even simpler, to back it up before hand) before you start any incoming migration. Then with the dumped file (which contains the device states) and that snapshot file (which contains the exact RAM data that matches the device states) you'll alway be able to migrate for as many times as you want.
Understood, thanks Peter Xu
Is there any feasible way to indicate the snapshot of the RAM backend file is
matched with the device data?
Quoted 2 lines
VQ 2 size
0x400<last_avail_idx0x1639-used_idx0x2688Failed to load virtio-scsi:virtio
Because I thought reporting above error is not so friendly. Could we add a version id in both RAM backend file and device date file?
B.R.
Catherine
Quoted 7 lines
Regards,
--
Peter Xu
Quoted 67 lines · Catherine Ho
Quoted 53 lines · Peter Xu
Quoted 3 lines · Catherine Ho
Hi Peter Maydell
On Tue, 2 Apr 2019 at 11:05, Peter Maydell <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 1 line · Catherine Ho
The root cause is the used idx is moved forward after 1st time
incoming,
Quoted 18 lines
Quoted 10 lines
and in 2nd time incoming,
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saved devicestate file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming restoring?
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 13 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitor migrate "exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.Yeah I really suspect its validity.
IMHO normal migration streams keep the device state and RAM data together in the dumped file, so they always match.
In your shared case, the device states are in the dumped file however the RAM data is located somewhere else. After you quit the VM from the 1st incoming migration the RAM is new (because that's a shared memory file) and the device data is still old. They do not match already, then I'd say you can't migrate with that any more.
Quoted 7 lines
If you want to do that, you'd better take snapshot of the RAM backend file if your filesystem supports (or even simpler, to back it up before hand) before you start any incoming migration. Then with the dumped file (which contains the device states) and that snapshot file (which contains the exact RAM data that matches the device states) you'll alway be able to migrate for as many times as you want.
Understood, thanks Peter Xu
Is there any feasible way to indicate the snapshot of the RAM backend file is
matched with the device data?
Quoted 5 lines
Quoted 2 lines
VQ 2 size
0x400<last_avail_idx0x1639-used_idx0x2688Failed to load virtio-scsi:virtioBecause I thought reporting above error is not so friendly. Could we add a version id in both RAM backend file and device date file?
It would be non-trivial I'd say - AFAIK we don't have an existing way to tag the memory-backend-file content (IIUC that's what you use).
And since you mentioned about versioning of these states, I just remembered that even with this you may not be able to get a complete matched state of the VM, because AFAICT actually besides RAM state & device state, you probably also need to consider the disk state as well. After you started the VM of the 1st incoming, there could be data flushed to the VM backend disk and then that state is changed as well. So here even if you snapshot the RAM file you'll still lose the disk state IIUC so it could still be broken. In other words, to make a migration/snapshot to work you'll need to make all these three states to match.
Before we discuss further on the topic... could you share me with your requirement first? I started to get a bit confused now since when I thought about shared mem I was thinking about migrating within the same host to e.g. upgrade the hypervisor but that obviously does not need you to do incoming migration for multiple times. Then what do you finally want to achieve?
Regards,
Signature · 1 line
Peter Xu
Quoted 84 lines · Peter Xu
Quoted 10 lines · Catherine Ho
Quoted 8 lines · Peter Xu
Quoted 3 lines · Catherine Ho
Hi Peter Maydell
On Tue, 2 Apr 2019 at 11:05, Peter Maydell <[email protected]
Quoted 2 lines · wrote:
Quoted 2 lines
On Tue, 2 Apr 2019 at 09:57, Catherine Ho <
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
The root cause is the used idx is moved forward after 1st time
incoming,
Quoted 2 lines
Quoted 2 lines
and in 2nd time incoming,
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saveddevice
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
state file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming
restoring?
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitormigrate
Quoted 30 lines
Quoted 22 lines
Quoted 10 lines
"exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.Yeah I really suspect its validity.
IMHO normal migration streams keep the device state and RAM data together in the dumped file, so they always match.
In your shared case, the device states are in the dumped file however the RAM data is located somewhere else. After you quit the VM from the 1st incoming migration the RAM is new (because that's a shared memory file) and the device data is still old. They do not match already, then I'd say you can't migrate with that any more.
Quoted 7 lines
If you want to do that, you'd better take snapshot of the RAM backend file if your filesystem supports (or even simpler, to back it up before hand) before you start any incoming migration. Then with the dumped file (which contains the device states) and that snapshot file (which contains the exact RAM data that matches the device states) you'll alway be able to migrate for as many times as you want.
Quoted 2 lines
Understood, thanks Peter Xu
Is there any feasible way to indicate the snapshot of the RAM backendfile
Quoted 6 lines
is
matched with the device data?Quoted 2 lines
VQ 2 size
0x400<last_avail_idx0x1639-used_idx0x2688Failed to load virtio-scsi:virtioBecause I thought reporting above error is not so friendly. Could we add
a
Quoted 1 line
version id in both RAM backend file and device date file?
It would be non-trivial I'd say - AFAIK we don't have an existing way to tag the memory-backend-file content (IIUC that's what you use).
Quoted 11 lines
And since you mentioned about versioning of these states, I just remembered that even with this you may not be able to get a complete matched state of the VM, because AFAICT actually besides RAM state & device state, you probably also need to consider the disk state as well. After you started the VM of the 1st incoming, there could be data flushed to the VM backend disk and then that state is changed as well. So here even if you snapshot the RAM file you'll still lose the disk state IIUC so it could still be broken. In other words, to make a migration/snapshot to work you'll need to make all these three states to match.
Yes, thanks
Quoted 8 lines
Before we discuss further on the topic... could you share me with your requirement first? I started to get a bit confused now since when I thought about shared mem I was thinking about migrating within the same host to e.g. upgrade the hypervisor but that obviously does not need you to do incoming migration for multiple times. Then what do you finally want to achieve?
Actually, I am investigating the ignore-shared capability case support on arm64. This feature is used in Kata containers project as "vm template"
The rom reset failure is the first bug.
Ok, now I can confirm that doing incoming migration for multiple times is supported. Thanks for the detailed explanation :)
B.R.
Catherine
Quoted 110 lines · Catherine Ho
Quoted 84 lines · Peter Xu
Quoted 6 lines · Catherine Ho
Quoted 4 lines · Peter Xu
Quoted 3 lines · Catherine Ho
Hi Peter Maydell
On Tue, 2 Apr 2019 at 11:05, Peter Maydell <
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines · wrote:
Quoted 2 lines
On Tue, 2 Apr 2019 at 09:57, Catherine Ho <
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
The root cause is the used idx is moved forward after 1st time
incoming,
Quoted 2 lines
Quoted 2 lines
and in 2nd time incoming,
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saveddevice
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
state file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming
restoring?
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitormigrate
Quoted 30 lines
Quoted 22 lines
Quoted 10 lines
"exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.Yeah I really suspect its validity.
IMHO normal migration streams keep the device state and RAM data together in the dumped file, so they always match.
In your shared case, the device states are in the dumped file however the RAM data is located somewhere else. After you quit the VM from the 1st incoming migration the RAM is new (because that's a shared memory file) and the device data is still old. They do not match already, then I'd say you can't migrate with that any more.
Quoted 7 lines
If you want to do that, you'd better take snapshot of the RAM backend file if your filesystem supports (or even simpler, to back it up before hand) before you start any incoming migration. Then with the dumped file (which contains the device states) and that snapshot file (which contains the exact RAM data that matches the device states) you'll alway be able to migrate for as many times as you want.
Quoted 2 lines
Understood, thanks Peter Xu
Is there any feasible way to indicate the snapshot of the RAM backendfile
Quoted 6 lines
is
matched with the device data?Quoted 2 lines
VQ 2 size
0x400<last_avail_idx0x1639-used_idx0x2688Failed to load virtio-scsi:virtioBecause I thought reporting above error is not so friendly. Could we
add a
Quoted 1 line
version id in both RAM backend file and device date file?
It would be non-trivial I'd say - AFAIK we don't have an existing way to tag the memory-backend-file content (IIUC that's what you use).
Quoted 11 lines
And since you mentioned about versioning of these states, I just remembered that even with this you may not be able to get a complete matched state of the VM, because AFAICT actually besides RAM state & device state, you probably also need to consider the disk state as well. After you started the VM of the 1st incoming, there could be data flushed to the VM backend disk and then that state is changed as well. So here even if you snapshot the RAM file you'll still lose the disk state IIUC so it could still be broken. In other words, to make a migration/snapshot to work you'll need to make all these three states to match.
Yes, thanks
Quoted 8 lines
Before we discuss further on the topic... could you share me with your requirement first? I started to get a bit confused now since when I thought about shared mem I was thinking about migrating within the same host to e.g. upgrade the hypervisor but that obviously does not need you to do incoming migration for multiple times. Then what do you finally want to achieve?
Quoted 5 lines
Actually, I am investigating the ignore-shared capability case support on arm64. This feature is used in Kata containers project as "vm template"
The rom reset failure is the first bug.
Ok, now I can confirm that doing incoming migration for multiple times is
s/is /isn't, sorry ~
Quoted 2 lines
supported. Thanks for the detailed explanation :)
B.R.
Quoted 2 lines
Catherine
PATCH v2 1/1 migration: avoid filling ignore-shared ramblock when in incoming migration
In reply to a message not in the archiveCommit 18269069c310 ("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.
This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace: 1 0x000055f4a296dd84 in address_space_write_rom_internal () at exec.c:3458 2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552
Actually, on arm64 virt marchine, ramblock "dtb" will be filled into ram during rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backend file.
--- hw/core/loader.c | 15 +++++++++++++++ include/exec/cpu-common.h | 1 + migration/ram.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-)
hw/core/loader.c +15 -0
@@ -53,6 +53,7 @@#include "hw/nvram/fw_cfg.h" #include "exec/memory.h" #include "exec/address-spaces.h" +#include "exec/cpu-common.h" #include "hw/boards.h" #include "qemu/cutils.h"
@@ -1086,6 +1087,9 @@ int rom_add_option(const char *file, int32_t bootindex)static void rom_reset (void *unused) {Rom *rom; +MemoryRegion *mr; +hwaddr hw_addr; +hwaddr l; QTAILQ_FOREACH(rom, &roms, next) {if (rom->fw_file) {
@@ -1094,6 +1098,17 @@ static void rom_reset(void *unused)if (rom->data ==NULL ) {continue ; } + +/* bypass the rom blob in ignore-shared migration case*/ +if (runstate_check (RUN_STATE_INMIGRATE )) { +rcu_read_lock (); + mr =address_space_translate (rom->as, rom->addr, &hw_addr, &l, + true,MEMTXATTRS_UNSPECIFIED ); +rcu_read_unlock (); +if (mr->ram_block !=NULL &&ramblock_is_ignored (mr->ram_block)) +continue ; + } +if (rom->mr) {void *host =memory_region_get_ram_ptr (rom->mr);memcpy (host, rom->data, rom->datasize);
include/exec/cpu-common.h +1 -0
@@ -76,6 +76,7 @@ void *qemu_ram_get_host_addr(RAMBlock *rb);ram_addr_t qemu_ram_get_offset (RAMBlock *rb);ram_addr_t qemu_ram_get_used_length (RAMBlock *rb);bool qemu_ram_is_shared (RAMBlock *rb); +bool ramblock_is_ignored (RAMBlock *block);bool qemu_ram_is_uf_zeroable (RAMBlock *rb);void qemu_ram_set_uf_zeroable (RAMBlock *rb);bool qemu_ram_is_migratable (RAMBlock *rb);
migration/ram.c +1 -1
@@ -159,7 +159,7 @@ out:return ret; } -static bool ramblock_is_ignored (RAMBlock *block) +bool ramblock_is_ignored (RAMBlock *block) {return !qemu_ram_is_migratable (block) || (migrate_ignore_shared () &&qemu_ram_is_shared (block));
Signature · 1 line
2.17.1
Quoted 108 lines · * Catherine Ho ([email protected]) wrote:
Quoted 84 lines · Peter Xu
Quoted 10 lines · Catherine Ho
Quoted 8 lines · Peter Xu
Quoted 3 lines · Catherine Ho
Hi Peter Maydell
On Tue, 2 Apr 2019 at 11:05, Peter Maydell <[email protected]
Quoted 2 lines · wrote:
Quoted 2 lines
On Tue, 2 Apr 2019 at 09:57, Catherine Ho <
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
The root cause is the used idx is moved forward after 1st time
incoming,
Quoted 2 lines
Quoted 2 lines
and in 2nd time incoming,
Quoted 1 line
the
last_avail_idxwill be incorrectly restored from the saveddevice
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
state file(not in the ram).
Quoted 4 lines
I watched this even on x86 for a virtio-scsi disk
Any ideas for supporting 2nd time, 3rd time... incoming
restoring?
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Does the destination end go through reset between the 1st and 2nd
seems not, please see my step below
Quoted 5 lines
incoming attempts? I'm not a migration expert, but I thought that devices were allowed to assume that their state is "state of the device following QEMU reset" before the start of an incoming migration attempt.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Here is my step:
1. start guest normal by qemu with shared memory-backend file
2. stop the vm. save the device state to another file via monitormigrate
Quoted 30 lines
Quoted 22 lines
Quoted 10 lines
"exec: cat>..."
3. quit the vm
4. retore the vm by qemu -incoming "exec:cat ..."
5. continue the vm via monito, the 1st incoming works fine
6. quit the vm
7. retore the vm by qemu -incoming "exec:cat ..." for 2nd time
8. continue -> error happened
Actually, this can be fixed by forcely restore the idx by virtio_queue_restore_last_avail_idx()
But I am sure whether it is reasonable.Yeah I really suspect its validity.
IMHO normal migration streams keep the device state and RAM data together in the dumped file, so they always match.
In your shared case, the device states are in the dumped file however the RAM data is located somewhere else. After you quit the VM from the 1st incoming migration the RAM is new (because that's a shared memory file) and the device data is still old. They do not match already, then I'd say you can't migrate with that any more.
Quoted 7 lines
If you want to do that, you'd better take snapshot of the RAM backend file if your filesystem supports (or even simpler, to back it up before hand) before you start any incoming migration. Then with the dumped file (which contains the device states) and that snapshot file (which contains the exact RAM data that matches the device states) you'll alway be able to migrate for as many times as you want.
Quoted 2 lines
Understood, thanks Peter Xu
Is there any feasible way to indicate the snapshot of the RAM backendfile
Quoted 6 lines
is
matched with the device data?Quoted 2 lines
VQ 2 size
0x400<last_avail_idx0x1639-used_idx0x2688Failed to load virtio-scsi:virtioBecause I thought reporting above error is not so friendly. Could we add
a
Quoted 1 line
version id in both RAM backend file and device date file?
It would be non-trivial I'd say - AFAIK we don't have an existing way to tag the memory-backend-file content (IIUC that's what you use).
Quoted 11 lines
And since you mentioned about versioning of these states, I just remembered that even with this you may not be able to get a complete matched state of the VM, because AFAICT actually besides RAM state & device state, you probably also need to consider the disk state as well. After you started the VM of the 1st incoming, there could be data flushed to the VM backend disk and then that state is changed as well. So here even if you snapshot the RAM file you'll still lose the disk state IIUC so it could still be broken. In other words, to make a migration/snapshot to work you'll need to make all these three states to match.
Yes, thanks
Quoted 8 lines
Before we discuss further on the topic... could you share me with your requirement first? I started to get a bit confused now since when I thought about shared mem I was thinking about migrating within the same host to e.g. upgrade the hypervisor but that obviously does not need you to do incoming migration for multiple times. Then what do you finally want to achieve?
Quoted 5 lines
Actually, I am investigating the ignore-shared capability case support on arm64. This feature is used in Kata containers project as "vm template"
The rom reset failure is the first bug.
Ok, now I can confirm that doing incoming migration for multiple times is supported. Thanks for the detailed explanation :)
I think the kata case should be OK; it's just you've got to be careful of what you're doing once you start splitting the state into separate chunks. That's always been true with the disk/ram split and it just gets a bit hairier when you split the RAM/devices.
Dave
Quoted 2 lines
B.R.
Catherine
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
In reply to Catherine HoQuoted 14 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace: 1 0x000055f4a296dd84 in address_space_write_rom_internal () at exec.c:3458 2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552
Quoted 7 lines
Actually, on arm64 virt marchine, ramblock "dtb" will be filled into ram during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backend file.Fixes commit 18269069c310 ("migration: Introduce ignore-shared capability")Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>
(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)
About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.
Thanks,
Quoted 19 lines
--- hw/core/loader.c | 15 +++++++++++++++ include/exec/cpu-common.h | 1 + migration/ram.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-)hw/core/loader.c +1
-0@@ -53,6 +53,7 @@#include "hw/nvram/fw_cfg.h" #include "exec/memory.h" #include "exec/address-spaces.h" +#include "exec/cpu-common.h" #include "hw/boards.h" #include "qemu/cutils.h"
hw/core/loader.c int rom_add_option(const char *file, int32_t bootindex) · line 1092
Quoted 6 lines
hw/core/loader.c +3
-0@@ -1086,6 +1087,9 @@ int rom_add_option(const char *file, int32_t bootindex)static void rom_reset (void *unused) {Rom *rom; +MemoryRegion *mr; +hwaddr hw_addr; +hwaddr l;
[1]
Quoted 49 lines
hw/core/loader.c +11
-0QTAILQ_FOREACH(rom, &roms, next) {if (rom->fw_file) {@@ -1094,6 +1098,17 @@ static void rom_reset(void *unused)if (rom->data ==NULL ) {continue ; } + +/* bypass the rom blob in ignore-shared migration case*/ +if (runstate_check (RUN_STATE_INMIGRATE )) { +rcu_read_lock (); + mr =address_space_translate (rom->as, rom->addr, &hw_addr, &l, + true,MEMTXATTRS_UNSPECIFIED ); +rcu_read_unlock (); +if (mr->ram_block !=NULL &&ramblock_is_ignored (mr->ram_block)) +continue ; + } +if (rom->mr) {void *host =memory_region_get_ram_ptr (rom->mr);memcpy (host, rom->data, rom->datasize);include/exec/cpu-common.h +1
-0@@ -76,6 +76,7 @@ void *qemu_ram_get_host_addr(RAMBlock *rb);ram_addr_t qemu_ram_get_offset (RAMBlock *rb);ram_addr_t qemu_ram_get_used_length (RAMBlock *rb);bool qemu_ram_is_shared (RAMBlock *rb); +bool ramblock_is_ignored (RAMBlock *block);bool qemu_ram_is_uf_zeroable (RAMBlock *rb);void qemu_ram_set_uf_zeroable (RAMBlock *rb);bool qemu_ram_is_migratable (RAMBlock *rb);migration/ram.c +1
-1@@ -159,7 +159,7 @@ out:return ret; } -static bool ramblock_is_ignored (RAMBlock *block) +bool ramblock_is_ignored (RAMBlock *block) {return !qemu_ram_is_migratable (block) || (migrate_ignore_shared () &&qemu_ram_is_shared (block));Signature · 1 line
2.17.1
Regards,
Signature · 1 line
Peter Xu
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
Hi Peter Xu
Quoted 29 lines · Peter Xu
Quoted 8 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace:1
0x000055f4a296dd84inaddress_space_write_rom_internal() atexec.c:3458
Quoted 9 lines
2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552Actually, on arm64 virt marchine, ramblock "dtb" will be filled into ram during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backendfile.
Quoted 2 lines
Fixes commit 18269069c310 ("migration: Introduce ignore-sharedcapability")
Quoted 2 lines
Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)
Quoted 10 lines
About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (
runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.
Thanks, but I thought this method would break the x86 rom_reset logic during RUN_STATE_INMIGRATE.
Please see the debugging patch and log lines below:
hw/core/loader.c +0 -0
@@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t
bootindex)
static void rom_reset(void *unused)
{
Rom *rom;
-
QTAILQ_FOREACH(rom, &roms, next) {
+ if (runstate_check(RUN_STATE_INMIGRATE))
+ printf("rom name=%s\n",rom->name);
if (rom->fw_file) {
continue;
}rom name=kvmvapic.bin
rom name=linuxboot_dma.bin
rom name=bios-256k.bin
rom name=etc/acpi/tables
rom name=etc/table-loader
rom name=etc/acpi/rsdp
B.R.
Catherine
Quoted 88 lines
Thanks,
hw/core/loader.c int rom_add_option(const char *file, int32_t
Quoted 19 lines
--- hw/core/loader.c | 15 +++++++++++++++ include/exec/cpu-common.h | 1 + migration/ram.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-)hw/core/loader.c +1
-0@@ -53,6 +53,7 @@#include "hw/nvram/fw_cfg.h" #include "exec/memory.h" #include "exec/address-spaces.h" +#include "exec/cpu-common.h" #include "hw/boards.h" #include "qemu/cutils.h" @@ -1086,6 +1087,9 @@ int rom_add_option(const char *file, int32_tbootindex)
hw/core/loader.c int rom_add_option(const char *file, int32_t · line 1092
Quoted 6 lines
hw/core/loader.c +3
-0static void rom_reset (void *unused) {Rom *rom; +MemoryRegion *mr; +hwaddr hw_addr; +hwaddr l;[1]
hw/core/loader.c static void rom_reset(void *unused) · line 1105
Quoted 12 lines
hw/core/loader.c +5
-0QTAILQ_FOREACH(rom, &roms, next) {if (rom->fw_file) {@@ -1094,6 +1098,17 @@ static void rom_reset(void *unused)if (rom->data ==NULL ) {continue ; } + +/* bypass the rom blob in ignore-shared migration case*/ +if (runstate_check (RUN_STATE_INMIGRATE )) { +rcu_read_lock (); + mr = address_space_translate(rom->as, rom->addr, &hw_addr,&l,
hw/core/loader.c static void rom_reset(void *unused) · line 1108
Quoted 3 lines
hw/core/loader.c +3
-0+ true, MEMTXATTRS_UNSPECIFIED); +rcu_read_unlock (); + if (mr->ram_block != NULL &&
ramblock_is_ignored(mr->ram_block))Quoted 32 lines
hw/core/loader.c +3
-0+continue ; + } +if (rom->mr) {void *host =memory_region_get_ram_ptr (rom->mr);memcpy (host, rom->data, rom->datasize);include/exec/cpu-common.h +1
-0@@ -76,6 +76,7 @@ void *qemu_ram_get_host_addr(RAMBlock *rb);ram_addr_t qemu_ram_get_offset (RAMBlock *rb);ram_addr_t qemu_ram_get_used_length (RAMBlock *rb);bool qemu_ram_is_shared (RAMBlock *rb); +bool ramblock_is_ignored (RAMBlock *block);bool qemu_ram_is_uf_zeroable (RAMBlock *rb);void qemu_ram_set_uf_zeroable (RAMBlock *rb);bool qemu_ram_is_migratable (RAMBlock *rb);migration/ram.c +1
-2@@ -159,7 +159,7 @@ out:return ret; } -static bool ramblock_is_ignored (RAMBlock *block) +bool ramblock_is_ignored (RAMBlock *block) {return !qemu_ram_is_migratable (block) || (migrate_ignore_shared () &&qemu_ram_is_shared (block)); --Quoted 2 lines
2.17.1
Regards,
--
Peter Xu
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
Quoted 63 lines · Catherine Ho
Hi Peter Xu
Quoted 29 lines · Peter Xu
Quoted 8 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace:1
0x000055f4a296dd84inaddress_space_write_rom_internal() atexec.c:3458
Quoted 9 lines
2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552Actually, on arm64 virt marchine, ramblock "dtb" will be filled into ram during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backendfile.
Quoted 2 lines
Fixes commit 18269069c310 ("migration: Introduce ignore-sharedcapability")
Quoted 2 lines
Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)Quoted 10 lines
About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (
runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.Thanks, but I thought this method would break the x86
rom_resetlogic duringRUN_STATE_INMIGRATE.
Please see the debugging patch and log lines below:hw/core/loader.c +2
-1@@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t bootindex) static void rom_reset(void *unused) {Rom *rom; - QTAILQ_FOREACH(rom, &roms, next) { +if (runstate_check (RUN_STATE_INMIGRATE )) +printf ("rom name=%s\n" ,rom->name);if (rom->fw_file) {continue ;}
Quoted 6 lines
rom name=kvmvapic.bin
rom name=linuxboot_dma.bin
rom name=bios-256k.bin
rom name=etc/acpi/tables
rom name=etc/table-loader
rom name=etc/acpi/rsdp
Hi, Catherine,
I only see that rom names were dumped. Could you help explain what is broken? Thanks,
Signature · 1 line
Peter Xu
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
Hi Peter Xu
Quoted 75 lines · Peter Xu
Quoted 21 lines · Catherine Ho
Hi Peter Xu
Quoted 17 lines · Peter Xu
Quoted 8 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace:1
0x000055f4a296dd84inaddress_space_write_rom_internal() atexec.c:3458
Quoted 7 lines
2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552Actually, on arm64 virt marchine, ramblock "dtb" will be filled into
ram
Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backendfile.
Quoted 2 lines
Fixes commit 18269069c310 ("migration: Introduce ignore-sharedcapability")
Quoted 2 lines
Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
Quoted 8 lines
Quoted 7 lines
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (
runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.Thanks, but I thought this method would break the x86
rom_resetlogicduring
Quoted 19 lines
RUN_STATE_INMIGRATE.
Please see the debugging patch and log lines below:hw/core/loader.c +2
-1@@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t bootindex) static void rom_reset(void *unused) {Rom *rom; - QTAILQ_FOREACH(rom, &roms, next) { +if (runstate_check (RUN_STATE_INMIGRATE )) +printf ("rom name=%s\n" ,rom->name);if (rom->fw_file) {continue ;}Quoted 6 lines
rom name=kvmvapic.bin
rom name=linuxboot_dma.bin
rom name=bios-256k.bin
rom name=etc/acpi/tables
rom name=etc/table-loader
rom name=etc/acpi/rsdpHi, Catherine,
Quoted 3 lines
I only see that rom names were dumped. Could you help explain what is broken? Thanks,
Thanks for the suggestion. I haven't seen any obvious errors on x86 with this change.
I merely consider not to change the old code logic too much. Ok, I will change it as you suggested if no more comments.
B.R.
Catherine
Quoted 4 lines
--
Peter Xu
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
Quoted 79 lines · Catherine Ho
Hi Peter Xu
Quoted 75 lines · Peter Xu
Quoted 21 lines · Catherine Ho
Hi Peter Xu
Quoted 17 lines · Peter Xu
Quoted 8 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace:1
0x000055f4a296dd84inaddress_space_write_rom_internal() atexec.c:3458
Quoted 7 lines
2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552Actually, on arm64 virt marchine, ramblock "dtb" will be filled into
ram
Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backendfile.
Quoted 2 lines
Fixes commit 18269069c310 ("migration: Introduce ignore-sharedcapability")
Quoted 2 lines
Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
Quoted 8 lines
Quoted 7 lines
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (
runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.Thanks, but I thought this method would break the x86
rom_resetlogicduring
Quoted 19 lines
RUN_STATE_INMIGRATE.
Please see the debugging patch and log lines below:hw/core/loader.c +2
-1@@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t bootindex) static void rom_reset(void *unused) {Rom *rom; - QTAILQ_FOREACH(rom, &roms, next) { +if (runstate_check (RUN_STATE_INMIGRATE )) +printf ("rom name=%s\n" ,rom->name);if (rom->fw_file) {continue ;}Quoted 6 lines
rom name=kvmvapic.bin
rom name=linuxboot_dma.bin
rom name=bios-256k.bin
rom name=etc/acpi/tables
rom name=etc/table-loader
rom name=etc/acpi/rsdpHi, Catherine,
Quoted 7 lines
Quoted 3 lines
I only see that rom names were dumped. Could you help explain what is broken? Thanks,
Thanks for the suggestion. I haven't seen any obvious errors on x86 with this change.
I merely consider not to change the old code logic too much. Ok, I will change it as you suggested if no more comments.
Yeah let's see whether others would have any opinion on that since so far I don't see a problem (after all those ROM data should be migrated from source later on no matter whether they were modified on source).
Regards,
Signature · 1 line
Peter Xu
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
In reply to Peter XuHi Peter Xu
Quoted 75 lines · Peter Xu
Quoted 21 lines · Catherine Ho
Hi Peter Xu
Quoted 17 lines · Peter Xu
Quoted 8 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace:1
0x000055f4a296dd84inaddress_space_write_rom_internal() atexec.c:3458
Quoted 7 lines
2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552Actually, on arm64 virt marchine, ramblock "dtb" will be filled into
ram
Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backendfile.
Quoted 2 lines
Fixes commit 18269069c310 ("migration: Introduce ignore-sharedcapability")
Quoted 2 lines
Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
Quoted 8 lines
Quoted 7 lines
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (
runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.Thanks, but I thought this method would break the x86
rom_resetlogicduring
Quoted 19 lines
RUN_STATE_INMIGRATE.
Please see the debugging patch and log lines below:hw/core/loader.c +2
-1@@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t bootindex) static void rom_reset(void *unused) {Rom *rom; - QTAILQ_FOREACH(rom, &roms, next) { +if (runstate_check (RUN_STATE_INMIGRATE )) +printf ("rom name=%s\n" ,rom->name);if (rom->fw_file) {continue ;}Quoted 6 lines
rom name=kvmvapic.bin
rom name=linuxboot_dma.bin
rom name=bios-256k.bin
rom name=etc/acpi/tables
rom name=etc/table-loader
rom name=etc/acpi/rsdpHi, Catherine,
Quoted 4 lines
I only see that rom names were dumped. Could you help explain what is broken? Thanks,
Sorry, I have another concern here. What if there is no
memory_backend
file?
If there is no memory backend file (i.e. without -object memory-backend-file,id=dimm1,size=512M,mem-path=/path/memory)
Should the rom blobs still be written into ram in such case?
B.R.
Catherine
Quoted 3 lines
--
Peter Xu
Re: [Qemu-devel] [PATCH v2] migration: avoid filling ignore-shared ramblock when in incoming migration
Quoted 82 lines · Catherine Ho
Hi Peter Xu
Quoted 78 lines · Peter Xu
Quoted 21 lines · Catherine Ho
Hi Peter Xu
Quoted 17 lines · Peter Xu
Quoted 8 lines · Catherine Ho
Commit
18269069c310("migration: Introduce ignore-shared capability") addes ignore-shared capability to bypass the shared ramblock (e,g, membackend + numa node). It does good to live migration.This commit expectes that QEMU doesn't write to guest RAM until VM starts, but it does on aarch64 qemu:
Backtrace:1
0x000055f4a296dd84inaddress_space_write_rom_internal() atexec.c:3458
Quoted 7 lines
2 0x000055f4a296de3a in address_space_write_rom () at exec.c:3479 3 0x000055f4a2d519ff in rom_reset () at hw/core/loader.c:1101 4 0x000055f4a2d475ec in qemu_devices_reset () at hw/core/reset.c:69 5 0x000055f4a2c90a28 in qemu_system_reset () at vl.c:1675 6 0x000055f4a2c9851d in main () at vl.c:4552Actually, on arm64 virt marchine, ramblock "dtb" will be filled into
ram
Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
during
rom_reset. In ignore-shared incoming case, this rom filling is not required since all the data has been stored in memory backendfile.
Quoted 2 lines
Fixes commit 18269069c310 ("migration: Introduce ignore-sharedcapability")
Quoted 2 lines
Signed-off-by Catherine Ho <[email protected]>Suggested-by Yury Kotov <[email protected]>(note: IIUC normally you should have your signed-off to be the last
line before the suggested-by :)About the patch content, I have had a question on whether we should need to check ignore-shared at all... That question lies in:
Quoted 8 lines
Quoted 7 lines
https://patchwork.kernel.org/patch/10859889/#22546487
And if my understanding was correct above, IMHO the patch could be as simply be as "if (
runstate_check(RUN_STATE_INMIGRATE)) return;" at [1] below.Thanks, but I thought this method would break the x86
rom_resetlogicduring
Quoted 19 lines
RUN_STATE_INMIGRATE.
Please see the debugging patch and log lines below:hw/core/loader.c +2
-1@@ -1086,8 +1086,9 @@ int rom_add_option(const char *file, int32_t bootindex) static void rom_reset(void *unused) {Rom *rom; - QTAILQ_FOREACH(rom, &roms, next) { +if (runstate_check (RUN_STATE_INMIGRATE )) +printf ("rom name=%s\n" ,rom->name);if (rom->fw_file) {continue ;}Quoted 6 lines
rom name=kvmvapic.bin
rom name=linuxboot_dma.bin
rom name=bios-256k.bin
rom name=etc/acpi/tables
rom name=etc/table-loader
rom name=etc/acpi/rsdpHi, Catherine,
I only see that rom names were dumped. Could you help explain what is broken? Thanks,
Quoted 6 lines
Quoted 1 line
Sorry, I have another concern here. What if there is no
memory_backendfile?
If there is no memory backend file (i.e. without -object memory-backend-file,id=dimm1,size=512M,mem-path=/path/memory)Should the rom blobs still be written into ram in such case?
Please see my previous reply - I think it shouldn't be needed because we should migrate very soon after this point for those RAM. In other words, IIUC even if we do rom_reset() now with these ROMs then the RAM data should be re-filled again too with the migration stream coming in.
Regards,
Signature · 1 line
Peter Xu