* [PULL 1/2] migration/postcopy: ensure preempt channel is ready before loading states
2024-04-07 18:43 [PULL 0/2] Migration 20240407 patches peterx
@ 2024-04-07 18:43 ` peterx
2024-04-07 18:43 ` [PULL 2/2] MAINTAINERS: Adjust migration documentation files peterx
2024-04-09 8:47 ` [PULL 0/2] Migration 20240407 patches Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: peterx @ 2024-04-07 18:43 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Wei Wang, Lei Wang, Avihai Horon, Fabiano Rosas, peterx,
Prasad Pandit, qemu-stable
From: Wei Wang <wei.w.wang@intel.com>
Before loading the guest states, ensure that the preempt channel has been
ready to use, as some of the states (e.g. via virtio_load) might trigger
page faults that will be handled through the preempt channel. So yield to
the main thread in the case that the channel create event hasn't been
dispatched.
Cc: qemu-stable <qemu-stable@nongnu.org>
Fixes: 9358982744 ("migration: Send requested page directly in rp-return thread")
Originally-by: Lei Wang <lei4.wang@intel.com>
Link: https://lore.kernel.org/all/9aa5d1be-7801-40dd-83fd-f7e041ced249@intel.com/T/
Signed-off-by: Lei Wang <lei4.wang@intel.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Link: https://lore.kernel.org/r/20240405034056.23933-1-wei.w.wang@intel.com
[peterx: add a todo section, add Fixes and copy stable for 8.0+]
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/savevm.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/migration/savevm.c b/migration/savevm.c
index 388d7af7cd..e7c1215671 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2342,6 +2342,27 @@ static int loadvm_handle_cmd_packaged(MigrationIncomingState *mis)
QEMUFile *packf = qemu_file_new_input(QIO_CHANNEL(bioc));
+ /*
+ * Before loading the guest states, ensure that the preempt channel has
+ * been ready to use, as some of the states (e.g. via virtio_load) might
+ * trigger page faults that will be handled through the preempt channel.
+ * So yield to the main thread in the case that the channel create event
+ * hasn't been dispatched.
+ *
+ * TODO: if we can move migration loadvm out of main thread, then we
+ * won't block main thread from polling the accept() fds. We can drop
+ * this as a whole when that is done.
+ */
+ do {
+ if (!migrate_postcopy_preempt() || !qemu_in_coroutine() ||
+ mis->postcopy_qemufile_dst) {
+ break;
+ }
+
+ aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self());
+ qemu_coroutine_yield();
+ } while (1);
+
ret = qemu_loadvm_state_main(packf, mis);
trace_loadvm_handle_cmd_packaged_main(ret);
qemu_fclose(packf);
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PULL 2/2] MAINTAINERS: Adjust migration documentation files
2024-04-07 18:43 [PULL 0/2] Migration 20240407 patches peterx
2024-04-07 18:43 ` [PULL 1/2] migration/postcopy: ensure preempt channel is ready before loading states peterx
@ 2024-04-07 18:43 ` peterx
2024-04-09 8:47 ` [PULL 0/2] Migration 20240407 patches Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: peterx @ 2024-04-07 18:43 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Wei Wang, Lei Wang, Avihai Horon, Fabiano Rosas, peterx,
Prasad Pandit
From: Avihai Horon <avihaih@nvidia.com>
Commit 8cb2f8b172e7 ("docs/migration: Create migration/ directory")
changed migration documentation file structure but forgot to update the
entries in the MAINTAINERS file.
Commit 4c6f8a79ae53 ("docs/migration: Split 'dirty limit'") extracted
dirty limit documentation to a new file without updating dirty limit
section in MAINTAINERS file.
Fix the above.
Fixes: 8cb2f8b172e7 ("docs/migration: Create migration/ directory")
Fixes: 4c6f8a79ae53 ("docs/migration: Split 'dirty limit'")
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Link: https://lore.kernel.org/r/20240407081125.13951-1-avihaih@nvidia.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
MAINTAINERS | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index e71183eef9..d3fc2a06e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2170,7 +2170,7 @@ S: Supported
F: hw/vfio/*
F: include/hw/vfio/
F: docs/igd-assign.txt
-F: docs/devel/vfio-migration.rst
+F: docs/devel/migration/vfio.rst
vfio-ccw
M: Eric Farman <farman@linux.ibm.com>
@@ -2231,6 +2231,7 @@ F: qapi/virtio.json
F: net/vhost-user.c
F: include/hw/virtio/
F: docs/devel/virtio*
+F: docs/devel/migration/virtio.rst
virtio-balloon
M: Michael S. Tsirkin <mst@redhat.com>
@@ -3422,7 +3423,7 @@ F: migration/
F: scripts/vmstate-static-checker.py
F: tests/vmstate-static-checker-data/
F: tests/qtest/migration-test.c
-F: docs/devel/migration.rst
+F: docs/devel/migration/
F: qapi/migration.json
F: tests/migration/
F: util/userfaultfd.c
@@ -3442,6 +3443,7 @@ F: include/sysemu/dirtylimit.h
F: migration/dirtyrate.c
F: migration/dirtyrate.h
F: include/sysemu/dirtyrate.h
+F: docs/devel/migration/dirty-limit.rst
Detached LUKS header
M: Hyman Huang <yong.huang@smartx.com>
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL 0/2] Migration 20240407 patches
2024-04-07 18:43 [PULL 0/2] Migration 20240407 patches peterx
2024-04-07 18:43 ` [PULL 1/2] migration/postcopy: ensure preempt channel is ready before loading states peterx
2024-04-07 18:43 ` [PULL 2/2] MAINTAINERS: Adjust migration documentation files peterx
@ 2024-04-09 8:47 ` Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2024-04-09 8:47 UTC (permalink / raw)
To: peterx
Cc: qemu-devel, Wei Wang, Lei Wang, Avihai Horon, Fabiano Rosas,
Prasad Pandit
On Sun, 7 Apr 2024 at 19:43, <peterx@redhat.com> wrote:
>
> From: Peter Xu <peterx@redhat.com>
>
> The following changes since commit ce64e6224affb8b4e4b019f76d2950270b391af5:
>
> Merge tag 'qemu-sparc-20240404' of https://github.com/mcayland/qemu into staging (2024-04-04 15:28:06 +0100)
>
> are available in the Git repository at:
>
> https://gitlab.com/peterx/qemu.git tags/migration-20240407-pull-request
>
> for you to fetch changes up to 8e0b21e375f0f6e6dbaeaecc1d52e2220f163e40:
>
> MAINTAINERS: Adjust migration documentation files (2024-04-07 14:40:55 -0400)
>
> ----------------------------------------------------------------
> Migration pull for 9.0-rc3
>
> - Wei/Lei's fix on a rare postcopy race that can hang the channel (since 8.0)
> - Avihai's fix on maintainers file, points to the right doc links
>
> ----------------------------------------------------------------
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread