mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
migration: write zero pages when postcopy enabled
During multifd migration, zero pages are written if they are migrated more than once. This may result in a migration thread 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> Reviewed-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20250512125124.147064-2-ppandit@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
371650534d
commit
249543d0c0
1 changed files with 20 additions and 2 deletions
|
@ -85,9 +85,27 @@ void multifd_recv_zero_page_process(MultiFDRecvParams *p)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < p->zero_num; i++) {
|
for (int i = 0; i < p->zero_num; i++) {
|
||||||
void *page = p->host + p->zero[i];
|
void *page = p->host + p->zero[i];
|
||||||
if (ramblock_recv_bitmap_test_byte_offset(p->block, p->zero[i])) {
|
bool received =
|
||||||
|
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 once.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* thread accessing that page may hang.
|
||||||
|
*
|
||||||
|
* When postcopy is enabled, always write the zero page as and when
|
||||||
|
* it is migrated.
|
||||||
|
*/
|
||||||
|
if (migrate_postcopy_ram() || received) {
|
||||||
memset(page, 0, multifd_ram_page_size());
|
memset(page, 0, multifd_ram_page_size());
|
||||||
} else {
|
}
|
||||||
|
if (!received) {
|
||||||
ramblock_recv_bitmap_set_offset(p->block, p->zero[i]);
|
ramblock_recv_bitmap_set_offset(p->block, p->zero[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue