[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: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH 1/1] spapr: Check SMT based on KVM_CAP_PPC_SMT_POSSIBLE |
Date: |
Fri, 12 Jan 2018 01:16:22 +1100 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Fri, Jan 05, 2018 at 10:47:22PM -0200, 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(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index d1acfe8858..ea2503cd2f 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -345,7 +345,19 @@ static int spapr_fixup_cpu_dt(void *fdt,
> sPAPRMachineState *spapr)
> PowerPCCPU *cpu = POWERPC_CPU(cs);
> DeviceClass *dc = DEVICE_GET_CLASS(cs);
> int index = spapr_vcpu_id(cpu);
> - int compat_smt = MIN(smp_threads, ppc_compat_max_threads(cpu));
> +
> + /* set smt to maximum for this current pvr if the number
> + * passed is higher than defined by PVR compat mode AND
> + * if KVM cannot emulate it.*/
> + int compat_smt = smp_threads;
> + if ((kvmppc_cap_smt_possible() & smp_threads) != smp_threads &&
> + smp_threads > ppc_compat_max_threads(cpu)) {
> + compat_smt = ppc_compat_max_threads(cpu);
I don't think this is the right approach. We've been trying to remove
places where host properties (such as those read from KVM
capabilities) affect guest visible properties of the VM - like vsmt.
Places like that break migration and often libvirt expectations as
well.
This is putting one back in, and so a step in the wrong direction.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature