From: Denis V. Lunev <[email protected]>

Restoring a guest which has programmed the SynIC maps its message and
event pages once per vCPU, and each map rebuilds the flatview, so the
cpu sections cost vCPU count times the number of regions in the
machine.

Keep restoring the control bit and page addresses in post_load, and
move only the mapping to post_load_mr_update. VMBus still finds the
control bit set when its post_load creates SINT routes, and nothing in
the load reaches the pages through the address space. The saving
scales with vCPU count.

CC: Peter Xu <[email protected]>
CC: Fabiano Rosas <[email protected]>
CC: Paolo Bonzini <[email protected]>
CC: Marcelo Tosatti <[email protected]>
CC: Maciej S. Szmigiero <[email protected]>
CC: Zhao Liu <[email protected]>
Signed-off-by: Denis V. Lunev <[email protected]>
---
 target/i386/machine.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target/i386/machine.c b/target/i386/machine.c
index b5c6b127c9..ebfba102f8 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -863,16 +863,22 @@ static bool hyperv_synic_enable_needed(void *opaque)
 static int hyperv_synic_post_load(void *opaque, int version_id)
 {
     X86CPU *cpu = opaque;
-    hyperv_x86_synic_update(cpu);
+    hyperv_x86_synic_update_state(cpu);
     return 0;
 }
 
+static void hyperv_synic_post_load_mr_update(void *opaque)
+{
+    hyperv_x86_synic_update_mr(opaque);
+}
+
 static const VMStateDescription vmstate_msr_hyperv_synic = {
     .name = "cpu/msr_hyperv_synic",
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = hyperv_synic_enable_needed,
     .post_load = hyperv_synic_post_load,
+    .post_load_mr_update = hyperv_synic_post_load_mr_update,
     .fields = (const VMStateField[]) {
         VMSTATE_UINT64(env.msr_hv_synic_control, X86CPU),
         VMSTATE_UINT64(env.msr_hv_synic_evt_page, X86CPU),
-- 
2.53.0


Reply via email to