Hello Jiaxin,

On 07/29/20 10:37, Wu, Jiaxin wrote:
> Hi Laszlo,
>
> Appreciate your feedback! Thank you very much.

if you are still interested in using this feature, I have some good
news.

As of current edk2 master (to be entirely precise: as of edk2 commit
cbccf995920a), and as of upstream QEMU commit 6e2e2e8a4220, the "VCPU
hotplug with SMM" feature is considered complete.

Both the singular "virsh setvcpu" command (which gives you precise NUMA
affinity for the VCPU being hot-plugged), and the plural "virsh
setvcpus" command, are expected to work. (For plugging.)

I'm repeating a short summary here about the necessary configuration on
your end:

* install a Linux guest as described in my Wiki article:

  
https://github.com/tianocore/tianocore.github.io/wiki/Testing-SMM-with-QEMU,-KVM-and-libvirt

* modify the domain XML for the guest:,

 - replace the "pc-q35-2.9" machine type with "pc-q35-5.2"

 - replace the following stanza:

   <vcpu placement='static'>4</vcpu>

   with:

  <vcpu placement='static' current='2'>4</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
    <vcpu id='2' enabled='yes' hotpluggable='yes'/>
    <vcpu id='3' enabled='no' hotpluggable='yes'/>
  </vcpus>

* With Linux guests, you may have to online the just-plugged VCPUs in
  the guest as a separate step (dependent on your guest Linux
  distribution). For this, you can either use (in the guest) commands
  like

  echo 1 > /sys/devices/system/cpu/cpu2/online
  echo 1 > /sys/devices/system/cpu/cpu3/online

  (note that the numbering is in order of the Linux guest learning of
  the processor).

  Alternatively, in case you used the plural "virsh setvcpus" command,
  *and* you have the guest agent running in your guest, you can follow
  up with

  virsh setvcpus ... --guest

  on the host side (the "--guest" option being the important one). This
  will ask the QEMU guest agent to perform the same onlining as the
  explicit "echo" commands above.

* Windows guests do not need separate onlining of the hot-added CPUs.
  The oldest Windows release that (to my knowledge) supports CPU hotplug
  is Windows Server 2008 R2 *Datacenter* edition.

Thanks
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#65786): https://edk2.groups.io/g/devel/message/65786
Mute This Topic: https://groups.io/mt/77236412/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to