qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Zhao Liu <zhao1.liu@intel.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PULL 02/18] i386/kvm/cpu: Init SMM cpu address space for hotplugged CPUs
Date: Thu, 30 Oct 2025 10:19:53 +0800	[thread overview]
Message-ID: <5a50deb8-c499-43b0-8456-ea784bc7f1fb@intel.com> (raw)
In-Reply-To: <aQG7wdY/lBjgzho3@intel.com>

On 10/29/2025 3:01 PM, Zhao Liu wrote:
>> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
>> index 7512be64d67..5716191fff1 100644
>> --- a/hw/i386/x86-common.c
>> +++ b/hw/i386/x86-common.c
>> @@ -183,6 +183,17 @@ void x86_cpu_plug(HotplugHandler *hotplug_dev,
>>           fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
>>       }
>>   
>> +    /*
>> +     * Non-hotplugged CPUs get their SMM cpu address space initialized in
>> +     * machine init done notifier: register_smram_listener().
>> +     *
>> +     * We need initialize the SMM cpu address space for the hotplugged CPU
>> +     * specifically.
>> +     */
>> +    if (kvm_enabled() && dev->hotplugged && x86_machine_is_smm_enabled(x86ms)) {
>> +        kvm_smm_cpu_address_space_init(cpu);
>> +    }
>> +
> 
> Unfortunately, the original KVM SMM patch caused this bug, but even
> more unfortunately, CPU_FOREACH in the machine_done callback is more
> fragile than I originally anticipated, now requiring more hack checks to
> fix. :-(
> 
> IMO, the root of the chaos is that KVM SMM doesn't do this in the CPU
> context like TCG did for a long time. I'll find time to sort all this
> out.

I had this idea before. It needs to move the initialization of KVM SMM 
MemoryRegion a bit earlier at least. And it seems to require more time 
than I expected, especially the effort to test the SMM functionality 
after the change. So I went with the most straightforward fix.

It will be great if you can find time to clean it up. Looking forward to it.

> Regards,
> Zhao
> 



  reply	other threads:[~2025-10-30  2:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 17:34 [PULL 00/18] Miscellaneous changes for 2025-10-28 Paolo Bonzini
2025-10-28 17:34 ` [PULL 01/18] scripts: clean up meson-buildoptions.py Paolo Bonzini
2025-10-28 17:34 ` [PULL 02/18] i386/kvm/cpu: Init SMM cpu address space for hotplugged CPUs Paolo Bonzini
2025-10-29  7:01   ` Zhao Liu
2025-10-30  2:19     ` Xiaoyao Li [this message]
2025-10-30  7:36   ` Michael Tokarev
2025-10-30  7:49     ` Xiaoyao Li
2025-10-30  8:03       ` Michael Tokarev
2025-10-28 17:34 ` [PULL 03/18] rcu: Unify force quiescent state Paolo Bonzini
2025-11-03 13:59   ` Regression with the "replay" test on target alpha (was: [PULL 03/18] rcu: Unify force quiescent state) Thomas Huth
2025-11-04  1:45     ` Regression with the "replay" test on target alpha Akihiko Odaki
2025-11-04  7:41       ` Thomas Huth
2025-11-04  8:08         ` Akihiko Odaki
2025-11-04  8:38           ` Thomas Huth
2025-11-04 12:18             ` Paolo Bonzini
2025-11-05  6:29               ` Akihiko Odaki
2025-11-07  7:41                 ` Thomas Huth
2025-11-07  7:49                   ` Paolo Bonzini
2025-10-28 17:34 ` [PULL 04/18] rust: remove useless glib_sys bindings Paolo Bonzini
2025-10-28 17:34 ` [PULL 05/18] rust: only leave leaf crates as workspace members Paolo Bonzini
2025-10-28 17:34 ` [PULL 06/18] qobject: make refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 07/18] char: rename CharBackend->CharFrontend Paolo Bonzini
2025-10-28 17:34 ` [PULL 08/18] accel/mshv: initialize thread name Paolo Bonzini
2025-10-28 17:34 ` [PULL 09/18] accel/mshv: use return value of handle_pio_str_read Paolo Bonzini
2025-10-28 17:34 ` [PULL 10/18] esp.c: fix esp_cdb_ready() FIFO wraparound limit calculation Paolo Bonzini
2025-10-29 11:42   ` Michael Tokarev
2025-10-28 17:34 ` [PULL 11/18] qtest/am53c974-test: add additional test for cmdfifo overflow Paolo Bonzini
2025-10-28 17:34 ` [PULL 12/18] rust/qemu-macros: Convert bit value to u8 within #[property] Paolo Bonzini
2025-10-28 17:34 ` [PULL 13/18] scsi: make SCSIRequest refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 14/18] qdev: Change PropertyInfo method print() to return malloc'ed string Paolo Bonzini
2025-10-28 17:34 ` [PULL 15/18] hw/i386/isapc.c: warn rather than reject modern x86 CPU models Paolo Bonzini
2025-10-28 17:34 ` [PULL 16/18] docs/about/deprecated.rst: document isapc deprecation for " Paolo Bonzini
2025-10-28 17:34 ` [PULL 17/18] target/i386: clear CPU_INTERRUPT_SIPI for all accelerators Paolo Bonzini
2025-10-28 17:34 ` [PULL 18/18] rust: migration: allow passing ParentField<> to vmstate_of! Paolo Bonzini
2025-10-29  6:34   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a50deb8-c499-43b0-8456-ea784bc7f1fb@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).