From: Prasad Pandit <ppandit@redhat.com>
To: qemu-devel@nongnu.org
Cc: peterx@redhat.com, farosas@suse.de, berrange@redhat.com,
Prasad Pandit <pjp@fedoraproject.org>
Subject: [PATCH v10 3/3] migration: write zero pages when postcopy enabled
Date: Thu, 8 May 2025 17:58:49 +0530 [thread overview]
Message-ID: <20250508122849.207213-4-ppandit@redhat.com> (raw)
In-Reply-To: <20250508122849.207213-1-ppandit@redhat.com>
From: Prasad Pandit <pjp@fedoraproject.org>
During multifd migration, zero pages are are written if
they are migrated more than ones.
This may result in a migration hang issue when Multifd
and Postcopy are enabled together.
When Postcopy is enabled, always write zero pages as and
when they are migrated.
Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
---
migration/multifd-zero-page.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
v10: new patch, not present in v9 or earlier versions.
diff --git a/migration/multifd-zero-page.c b/migration/multifd-zero-page.c
index dbc1184921..9bfb3ef803 100644
--- a/migration/multifd-zero-page.c
+++ b/migration/multifd-zero-page.c
@@ -85,9 +85,27 @@ void multifd_recv_zero_page_process(MultiFDRecvParams *p)
{
for (int i = 0; i < p->zero_num; i++) {
void *page = p->host + p->zero[i];
- if (ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
+
+ /*
+ * During multifd migration zero page is written to the memory
+ * only if it is migrated more than ones.
+ *
+ * It becomes a problem when both Multifd & Postcopy options are
+ * enabled. If the zero page which was skipped during multifd phase,
+ * is accessed during the Postcopy phase of the migration, a page
+ * fault occurs. But this page fault is not served because the
+ * 'receivedmap' says the zero page is already received. Thus the
+ * migration hangs.
+ *
+ * When Postcopy is enabled, always write the zero page as and when
+ * it is migrated.
+ *
+ */
+ if (migrate_postcopy_ram() ||
+ ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
memset(page, 0, multifd_ram_page_size());
- } else {
+ }
+ if (!ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
ramblock_recv_bitmap_set_offset(p->block, p->zero[i]);
}
}
--
2.49.0
next prev parent reply other threads:[~2025-05-08 12:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 12:28 [PATCH v10 0/3] Allow to enable multifd and postcopy migration together Prasad Pandit
2025-05-08 12:28 ` [PATCH v10 1/3] migration: enable multifd and postcopy together Prasad Pandit
2025-05-08 14:06 ` Fabiano Rosas
2025-05-08 12:28 ` [PATCH v10 2/3] tests/qtest/migration: add postcopy tests with multifd Prasad Pandit
2025-05-08 19:04 ` Peter Xu
2025-05-09 5:26 ` Prasad Pandit
2025-05-09 14:30 ` Peter Xu
2025-05-13 6:20 ` Prasad Pandit
2025-05-08 12:28 ` Prasad Pandit [this message]
2025-05-08 13:57 ` [PATCH v10 3/3] migration: write zero pages when postcopy enabled Fabiano Rosas
2025-05-08 15:40 ` Peter Xu
2025-05-09 6:04 ` Prasad Pandit
2025-05-09 15:11 ` Peter Xu
2025-05-12 6:26 ` Prasad Pandit
2025-05-12 15:06 ` Peter Xu
2025-05-09 5:31 ` Prasad Pandit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250508122849.207213-4-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=peterx@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).