[Qemu-devel] [PATCH v2 0/2] Small fixes for SMT guests in Power9

Jose Ricardo Ziviani posted 2 patches 6 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180114192349.22212-1-joserz@linux.vnet.ibm.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
hw/ppc/spapr.c       | 10 ++++++++++
target/ppc/compat.c  |  2 +-
target/ppc/kvm.c     |  5 +++++
target/ppc/kvm_ppc.h |  6 ++++++
4 files changed, 22 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH v2 0/2] Small fixes for SMT guests in Power9
Posted by Jose Ricardo Ziviani 6 years, 3 months ago
v2:
 - divided in two patches:
    (1) enables smt8 mode to P9 guests
    (2) checks if host supports the # of threads/core required
        limitation: doesn't check guest running in compat mode

This patchset contains 2 changes:

(1) A P9 guest defined like -smp sockets=1,cores=1,threads=8 will be silently
changed to threads=4:

(guest) # lscpu
Architecture:          ppc64le
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    4
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
...
(qemu) info cpus
* CPU #0: nip=0xc0000000000db9cc thread_id=9440
  CPU #1: nip=0xc0000000000db9cc thread_id=9441
  CPU #2: nip=0xc0000000000db9cc thread_id=9442
  CPU #3: nip=0xc0000000000db9cc thread_id=9443
  CPU #4: nip=0x0000000000000100 (halted) thread_id=9444
  CPU #5: nip=0x0000000000000100 (halted) thread_id=9445
  CPU #6: nip=0x0000000000000100 (halted) thread_id=9446
  CPU #7: nip=0x0000000000000100 (halted) thread_id=9447

This patch enables P9 guests to use emulated smt because KVM supports it:

(guest) # lscpu
Architecture:          ppc64le
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    8
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1

(qemu) info cpus
* CPU #0: nip=0xc0000000000d30ac thread_id=68400
  CPU #1: nip=0xc0000000000d30ac thread_id=68401
  CPU #2: nip=0xc0000000000d30ac thread_id=68402
  CPU #3: nip=0xc0000000000d30ac thread_id=68403
  CPU #4: nip=0xc0000000000d30ac thread_id=68404
  CPU #5: nip=0xc0000000000d30ac thread_id=68405
  CPU #6: nip=0xc0000000000d30ac thread_id=68406
  CPU #7: nip=0xc0000000000d30ac thread_id=68407

CPU hotplugging also works as expected:

(qemu) device_add host-spapr-cpu-core,id=core8,core-id=8
(qemu) info cpus
* CPU #0: nip=0xc0000000000d30ac thread_id=68400
  CPU #1: nip=0xc0000000000d30ac thread_id=68401
  CPU #2: nip=0xc0000000000d30ac thread_id=68402
  CPU #3: nip=0xc0000000000d30ac thread_id=68403
  CPU #4: nip=0xc0000000000d30ac thread_id=68404
  CPU #5: nip=0xc0000000000d30ac thread_id=68405
  CPU #6: nip=0xc0000000000d30ac thread_id=68406
  CPU #7: nip=0xc0000000000d30ac thread_id=68407
  CPU #8: nip=0xc0000000000d30ac thread_id=68492
  CPU #9: nip=0xc0000000000d30ac thread_id=68493
  CPU #10: nip=0xc0000000000d30ac thread_id=68494
  CPU #11: nip=0xc0000000000d30ac thread_id=68495
  CPU #12: nip=0xc0000000000d30ac thread_id=68496
  CPU #13: nip=0xc0000000000d30ac thread_id=68497
  CPU #14: nip=0xc0000000000d30ac thread_id=68498
  CPU #15: nip=0xc0000000000d30ac thread_id=68499

(guest) # lscpu
Architecture:          ppc64le
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    8
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1

(2) Checks if KVM supports the number of threads required

If users try to pass more threads/core than the host supports it displays an
error message and quits:

qemu-system-ppc64: KVM does not support 8 threads/core.
Available VSMT modes: 4 2 1.

Jose Ricardo Ziviani (2):
  ppc: Change Power9 compat table to support at most 8 threads/core
  ppc: spapr: Check if thread argument is supported by host KVM

 hw/ppc/spapr.c       | 10 ++++++++++
 target/ppc/compat.c  |  2 +-
 target/ppc/kvm.c     |  5 +++++
 target/ppc/kvm_ppc.h |  6 ++++++
 4 files changed, 22 insertions(+), 1 deletion(-)

-- 
2.14.3