On Wed, Jul 16, 2025 at 05:22:46PM +0200, Paolo Bonzini wrote:
> Date: Wed, 16 Jul 2025 17:22:46 +0200
> From: Paolo Bonzini <pbonz...@redhat.com>
> Subject: Re: boot failure on top of current git
> 
> On 7/16/25 16:44, Paolo Abeni wrote:
> > Hi,
> > 
> > I'm observing boot failure for a rhel-9.7 VM. I'm using qemu git tree at
> > commit c079d3a31e.
> 
> No and I cannot reproduce it.
> 
> What host is it (processor) and kernel version?
> 
> Paolo

It sounds like x86_ext_save_areas[] wasn't initialized correctly.

I just checked the related logic, in the previous QEMU, for 
x86_cpu_post_initfn(),
it initialized x86_ext_save_areas[] first, then called 
accel_cpu_instance_init(),
so that KVM's xsave assertion didn't complain.

But now, when we move accel_cpu_instance_init() to x86_cpu_initfn(), KVM
checks x86_ext_save_areas[] before x86_ext_save_areas[] initialization.

I understand, we should initialize x86_ext_save_areas[] in
x86_cpu_initfn() as well. Maybe we need something like this:

---
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index da7d8dca633e..c8fccabeee71 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -9619,6 +9619,16 @@ static void 
x86_cpu_register_feature_bit_props(X86CPUClass *xcc,
 }

 static void x86_cpu_post_initfn(Object *obj)
+{
+#ifndef CONFIG_USER_ONLY
+    if (current_machine && current_machine->cgs) {
+        x86_confidential_guest_cpu_instance_init(
+            X86_CONFIDENTIAL_GUEST(current_machine->cgs), (CPU(obj)));
+    }
+#endif
+}
+
+static void x86_cpu_init_xsave(void)
 {
     static bool first = true;
     uint64_t supported_xcr0;
@@ -9639,13 +9649,6 @@ static void x86_cpu_post_initfn(Object *obj)
             }
         }
     }
-
-#ifndef CONFIG_USER_ONLY
-    if (current_machine && current_machine->cgs) {
-        x86_confidential_guest_cpu_instance_init(
-            X86_CONFIDENTIAL_GUEST(current_machine->cgs), (CPU(obj)));
-    }
-#endif
 }

 static void x86_cpu_init_default_topo(X86CPU *cpu)
@@ -9715,6 +9718,7 @@ static void x86_cpu_initfn(Object *obj)
         x86_cpu_load_model(cpu, xcc->model);
     }

+    x86_cpu_init_xsave();
     accel_cpu_instance_init(CPU(obj));
 }



Reply via email to