[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH 1/1] spapr: Check SMT based on KVM_CAP_PPC_SMT_POS
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-ppc] [PATCH 1/1] spapr: Check SMT based on KVM_CAP_PPC_SMT_POSSIBLE |
Date: |
Thu, 11 Jan 2018 12:29:54 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 06/01/2018 01:47, Jose Ricardo Ziviani wrote:
> Power9 supports 4 HW threads/core but it's possible to emulate
> doorbells to implement virtual SMT. KVM has the KVM_CAP_PPC_SMT_POSSIBLE
> which returns a bitmap with all SMT modes supported by the host.
>
> Today, QEMU forces the SMT mode based on PVR compat table, this is
> silently done in spapr_fixup_cpu_dt. Then, if user passes thread=8 the
> guest will end up with 4 threads/core without any feedback to the user.
> It is confusing and will crash QEMU if a cpu is hotplugged in that
> guest.
>
> This patch makes use of KVM_CAP_PPC_SMT_POSSIBLE to check if the host
> supports the SMT mode so it allows Power9 guests to have 8 threads/core
> if desired.
>
> Reported-by: Satheesh Rajendran <address@hidden>
> Signed-off-by: Jose Ricardo Ziviani <address@hidden>
> ---
> hw/ppc/spapr.c | 14 +++++++++++++-
> hw/ppc/trace-events | 1 +
> target/ppc/kvm.c | 5 +++++
> target/ppc/kvm_ppc.h | 6 ++++++
> 4 files changed, 25 insertions(+), 1 deletion(-)
According to the tests I have done on P9 and P8, you should also set
vsmt to the max value found in KVM_CAP_PPC_SMT_POSSIBLE to keep the same
vcpu_id on a P8 and P9 with the same configuration "-smp
W,sockets=X,cores=Y,threads=Z".
This is required for migration.
The formula is in spapr_cpu_core_realize():
cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i);
Thanks,
Laurent