qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] migrate/ram: let ram_save_target_page_legacy() return if qemu file got error
@ 2023-08-15  7:21 Guoyi Tu
  2023-08-15 12:35 ` Fabiano Rosas
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Guoyi Tu @ 2023-08-15  7:21 UTC (permalink / raw)
  To: Juan Quintela, Peter Xu, Leonardo Bras; +Cc: tugy, qemu-devel

When the migration process of a virtual machine using huge pages is 
cancelled,
QEMU will continue to complete the processing of the current huge page
through the qemu file object got an error set. These processing, such as
compression and encryption, will consume a lot of CPU resources which may
affact the the performance of the other VMs.

To terminate the migration process more quickly and minimize unnecessary
resource occupancy, it's neccessary to add logic to check the error status
of qemu file object in the beginning of ram_save_target_page_legacy 
function,
and make sure the function returns immediately if qemu file got an error.

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
---
  migration/ram.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/migration/ram.c b/migration/ram.c
index 9040d66e61..3e2ebf3004 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2133,6 +2133,10 @@ static int ram_save_target_page_legacy(RAMState 
*rs, PageSearchStatus *pss)
      ram_addr_t offset = ((ram_addr_t)pss->page) << TARGET_PAGE_BITS;
      int res;

+    if (qemu_file_get_error(pss->pss_channel)) {
+        return -1;
+    }
+
      if (control_save_page(pss, block, offset, &res)) {
          return res;
      }
-- 
2.27.0

--
Guoyi


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-09-04 12:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15  7:21 [PATCH] migrate/ram: let ram_save_target_page_legacy() return if qemu file got error Guoyi Tu
2023-08-15 12:35 ` Fabiano Rosas
2023-08-15 22:19   ` Peter Xu
2023-08-15 22:42     ` Fabiano Rosas
2023-08-16 14:48       ` Peter Xu
2023-08-16 15:15         ` Fabiano Rosas
2023-08-17  2:19           ` Guoyi Tu
2023-08-17 13:35             ` Peter Xu
2023-08-17 14:29               ` Guoyi Tu
2023-08-17 14:32           ` Guoyi Tu
2023-08-16  2:09     ` Guoyi Tu
     [not found] ` <1289281636.5044.1692148361356.JavaMail.root@jt-retransmission-dep-56f978df86-2gmr2>
2023-08-16  2:01   ` Guoyi Tu
2023-08-16 12:18 ` Fabiano Rosas
2023-09-04 11:55 ` Guoyi Tu

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).