- sw_64: Added sw64 architecture related updates - virtio-crypto: verify src&dst buffer length for sym request - vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present - qga: Fix suspend on Linux guests without systemd - tests: vhost-user-test: release mutex on protocol violation - qapi: support updating expected test output via make - block: Fix misleading hexadecimal format - block/rbd: fix write zeroes with growing images - block/nbd.c: Fixed IO request coroutine not being wakeup when kill NBD server - block/nfs: Fix 32-bit Windows build - qapi/qdev: Tidy up device_add documentation - hw/xen/xen_pt: fix uninitialized variable - migration/ram: Fix error handling in ram_write_tracking_start() - docs/about/build-platforms: Refine the distro support policy - xen-block: Avoid leaks on new error path - QGA VSS: Add wrapper to send log to debugger and stderr - chardev/char-socket: set s->listener = NULL in char_socket_finalize - qapi/block: Tidy up block-latency-histogram-set documentation - disas/riscv Fix ctzw disassemble - vfio: Fix vfio_get_dev_region() trace event - migration/ram: Fix populate_read_range() - Check and report for incomplete 'global' option format Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
51 lines
1.9 KiB
Diff
51 lines
1.9 KiB
Diff
From 93fc70a80b9734301472bb827cf3685366bfeb19 Mon Sep 17 00:00:00 2001
|
|
From: qihao <qihao_yewu@cmss.chinamobile.com>
|
|
Date: Fri, 28 Jul 2023 10:39:55 +0800
|
|
Subject: [PATCH] migration/ram: Fix error handling in
|
|
ram_write_tracking_start()
|
|
|
|
cherry picked from commit 72ef3a370836aa07261ad7aaeea27ed5cbcee342
|
|
|
|
If something goes wrong during uffd_change_protection(), we would miss
|
|
to unregister uffd-wp and not release our reference. Fix it by
|
|
performing the uffd_change_protection(true) last.
|
|
|
|
Note that a uffd_change_protection(false) on the recovery path without a
|
|
prior uffd_change_protection(false) is fine.
|
|
|
|
Fixes: 278e2f551a09 ("migration: support UFFD write fault processing in ram_save_iterate()")
|
|
Cc: qemu-stable@nongnu.org
|
|
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
Signed-off-by: David Hildenbrand <david@redhat.com>
|
|
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
Signed-off-by: qihao_yewu <qihao_yewu@cmss.chinamobile.com>
|
|
---
|
|
migration/ram.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/migration/ram.c b/migration/ram.c
|
|
index 12b8c653d8..f422fd0bc2 100644
|
|
--- a/migration/ram.c
|
|
+++ b/migration/ram.c
|
|
@@ -2140,13 +2140,14 @@ int ram_write_tracking_start(void)
|
|
block->max_length, UFFDIO_REGISTER_MODE_WP, NULL)) {
|
|
goto fail;
|
|
}
|
|
+ block->flags |= RAM_UF_WRITEPROTECT;
|
|
+ memory_region_ref(block->mr);
|
|
+
|
|
/* Apply UFFD write protection to the block memory range */
|
|
if (uffd_change_protection(rs->uffdio_fd, block->host,
|
|
block->max_length, true, false)) {
|
|
goto fail;
|
|
}
|
|
- block->flags |= RAM_UF_WRITEPROTECT;
|
|
- memory_region_ref(block->mr);
|
|
|
|
trace_ram_write_tracking_ramblock_start(block->idstr, block->page_size,
|
|
block->host, block->max_length);
|
|
--
|
|
2.41.0.windows.1
|
|
|