From: Nicholas Piggin <npiggin@gmail.com>
To: Fabiano Rosas <farosas@linux.ibm.com>, kvm-ppc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed
Date: Wed, 20 Jan 2021 00:05:20 +0000 [thread overview]
Message-ID: <1611099866.a9bsenxeey.astroid@bobo.none> (raw)
In-Reply-To: <87a6t4bpp2.fsf@linux.ibm.com>
Excerpts from Fabiano Rosas's message of January 20, 2021 7:07 am:
> Nicholas Piggin <npiggin@gmail.com> writes:
>
>> Excerpts from Fabiano Rosas's message of January 19, 2021 11:46 am:
>>> Resending because the previous got spam-filtered:
>>>
>>> Nicholas Piggin <npiggin@gmail.com> writes:
>>>
>>>> This reverts much of commit c01015091a770 ("KVM: PPC: Book3S HV: Run HPT
>>>> guests on POWER9 radix hosts"), which was required to run HPT guests on
>>>> RPT hosts on early POWER9 CPUs without support for "mixed mode", which
>>>> meant the host could not run with MMU on while guests were running.
>>>>
>>>> This code has some corner case bugs, e.g., when the guest hits a machine
>>>> check or HMI the primary locks up waiting for secondaries to switch LPCR
>>>> to host, which they never do. This could all be fixed in software, but
>>>> most CPUs in production have mixed mode support, and those that don't
>>>> are believed to be all in installations that don't use this capability.
>>>> So simplify things and remove support.
>>>
>>> With this patch in a DD2.1 machine + indep_threads_mode=N +
>>> disable_radix, QEMU aborts and dumps registers, is that intended?
>>
>> Yes. That configuration is hanging handling MCEs in the guest with some
>> threads waiting forever to synchronize. Paul suggested it was never a
>> supported configuration so we might just remove it.
>>
>
> OK, so:
>
> Tested-by: Fabiano Rosas <farosas@linux.ibm.com>
>
>>> Could we use the 'no_mixing_hpt_and_radix' logic in check_extension to
>>> advertise only KVM_CAP_PPC_MMU_RADIX to the guest via OV5 so it doesn't
>>> try to run hash?
>>>
>>> For instance, if I hack QEMU's 'spapr_dt_ov5_platform_support' from
>>> OV5_MMU_BOTH to OV5_MMU_RADIX_300 then it boots succesfuly, but the
>>> guest turns into radix, due to this code in prom_init:
>>>
>>> prom_parse_mmu_model:
>>>
>>> case OV5_FEAT(OV5_MMU_RADIX): /* Only Radix */
>>> prom_debug("MMU - radix only\n");
>>> if (prom_radix_disable) {
>>> /*
>>> * If we __have__ to do radix, we're better off ignoring
>>> * the command line rather than not booting.
>>> */
>>> prom_printf("WARNING: Ignoring cmdline option disable_radix\n");
>>> }
>>> support->radix_mmu = true;
>>> break;
>>>
>>> It seems we could explicitly say that the host does not support hash and
>>> that would align with the above code.
>>
>> I'm not sure, sounds like you could, on the other hand these aborts seem
>> like the prefered failure mode for these kinds of configuration issues,
>> I don't know what the policy is, is reverting back to radix acceptable?
>>
>
> Yeah, I couldn't find documentation about why we're reverting back to
> radix. I personally dislike it, but there is already a precedent so I'm
> not sure. A radix guest on a hash host does the same transparent
> conversion AFAICT.
>
> But despite that, this patch removes support for hash MMU in this
> particular scenario. I don't see why continuing to tell the guest we
> support hash.
>
> Anyway, here's a patch if you decide to go that way (tested w/ DD2.1 &
> 2.3 machines):
Thanks, I don't mind it, have to see if the maintainer will take it :)
You could add a small changelog / SOB and I could putit after my patch?
>
> ---
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index 0a056c64c317b..53743555676d6 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -314,6 +314,7 @@ struct kvmppc_ops {
> int size);
> int (*enable_svm)(struct kvm *kvm);
> int (*svm_off)(struct kvm *kvm);
> + bool (*hash_possible)(void);
> };
>
> extern struct kvmppc_ops *kvmppc_hv_ops;
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 6f612d240392f..2d1e8aba22b85 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -5599,6 +5599,15 @@ static int kvmhv_svm_off(struct kvm *kvm)
> return ret;
> }
>
> +static bool kvmppc_hash_possible(void)
> +{
> + if (radix_enabled() && no_mixing_hpt_and_radix)
> + return false;
> +
> + return cpu_has_feature(CPU_FTR_ARCH_300) &&
> + cpu_has_feature(CPU_FTR_HVMODE);
> +}
Just be careful, it's hash_v3 specifically. Either make this return true
for arch < 300 add the ARCH_300 check in the ioctl, or rename to include
v3.
> +
> static struct kvmppc_ops kvm_ops_hv = {
> .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv,
> .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv,
> @@ -5642,6 +5651,7 @@ static struct kvmppc_ops kvm_ops_hv = {
> .store_to_eaddr = kvmhv_store_to_eaddr,
> .enable_svm = kvmhv_enable_svm,
> .svm_off = kvmhv_svm_off,
> + .hash_possible = kvmppc_hash_possible,
> };
>
How about adding an op which can check extensions? It could return false
if it wasn't checked and so default to the generic checks in
kvm_vm_ioctl_check_extension, and take a pointer to 'r' to set.
> static int kvm_init_subcore_bitmap(void)
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index cf52d26f49cd7..99ced6c570e74 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -611,8 +611,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> r = !!(hv_enabled && radix_enabled());
> break;
> case KVM_CAP_PPC_MMU_HASH_V3:
> - r = !!(hv_enabled && cpu_has_feature(CPU_FTR_ARCH_300) &&
> - cpu_has_feature(CPU_FTR_HVMODE));
> + r = !!(hv_enabled && kvmppc_hv_ops->hash_possible());
> break;
> case KVM_CAP_PPC_NESTED_HV:
> r = !!(hv_enabled && kvmppc_hv_ops->enable_nested &&
Thanks,
Nick
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Piggin <npiggin@gmail.com>
To: Fabiano Rosas <farosas@linux.ibm.com>, kvm-ppc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support
Date: Wed, 20 Jan 2021 10:05:20 +1000 [thread overview]
Message-ID: <1611099866.a9bsenxeey.astroid@bobo.none> (raw)
In-Reply-To: <87a6t4bpp2.fsf@linux.ibm.com>
Excerpts from Fabiano Rosas's message of January 20, 2021 7:07 am:
> Nicholas Piggin <npiggin@gmail.com> writes:
>
>> Excerpts from Fabiano Rosas's message of January 19, 2021 11:46 am:
>>> Resending because the previous got spam-filtered:
>>>
>>> Nicholas Piggin <npiggin@gmail.com> writes:
>>>
>>>> This reverts much of commit c01015091a770 ("KVM: PPC: Book3S HV: Run HPT
>>>> guests on POWER9 radix hosts"), which was required to run HPT guests on
>>>> RPT hosts on early POWER9 CPUs without support for "mixed mode", which
>>>> meant the host could not run with MMU on while guests were running.
>>>>
>>>> This code has some corner case bugs, e.g., when the guest hits a machine
>>>> check or HMI the primary locks up waiting for secondaries to switch LPCR
>>>> to host, which they never do. This could all be fixed in software, but
>>>> most CPUs in production have mixed mode support, and those that don't
>>>> are believed to be all in installations that don't use this capability.
>>>> So simplify things and remove support.
>>>
>>> With this patch in a DD2.1 machine + indep_threads_mode=N +
>>> disable_radix, QEMU aborts and dumps registers, is that intended?
>>
>> Yes. That configuration is hanging handling MCEs in the guest with some
>> threads waiting forever to synchronize. Paul suggested it was never a
>> supported configuration so we might just remove it.
>>
>
> OK, so:
>
> Tested-by: Fabiano Rosas <farosas@linux.ibm.com>
>
>>> Could we use the 'no_mixing_hpt_and_radix' logic in check_extension to
>>> advertise only KVM_CAP_PPC_MMU_RADIX to the guest via OV5 so it doesn't
>>> try to run hash?
>>>
>>> For instance, if I hack QEMU's 'spapr_dt_ov5_platform_support' from
>>> OV5_MMU_BOTH to OV5_MMU_RADIX_300 then it boots succesfuly, but the
>>> guest turns into radix, due to this code in prom_init:
>>>
>>> prom_parse_mmu_model:
>>>
>>> case OV5_FEAT(OV5_MMU_RADIX): /* Only Radix */
>>> prom_debug("MMU - radix only\n");
>>> if (prom_radix_disable) {
>>> /*
>>> * If we __have__ to do radix, we're better off ignoring
>>> * the command line rather than not booting.
>>> */
>>> prom_printf("WARNING: Ignoring cmdline option disable_radix\n");
>>> }
>>> support->radix_mmu = true;
>>> break;
>>>
>>> It seems we could explicitly say that the host does not support hash and
>>> that would align with the above code.
>>
>> I'm not sure, sounds like you could, on the other hand these aborts seem
>> like the prefered failure mode for these kinds of configuration issues,
>> I don't know what the policy is, is reverting back to radix acceptable?
>>
>
> Yeah, I couldn't find documentation about why we're reverting back to
> radix. I personally dislike it, but there is already a precedent so I'm
> not sure. A radix guest on a hash host does the same transparent
> conversion AFAICT.
>
> But despite that, this patch removes support for hash MMU in this
> particular scenario. I don't see why continuing to tell the guest we
> support hash.
>
> Anyway, here's a patch if you decide to go that way (tested w/ DD2.1 &
> 2.3 machines):
Thanks, I don't mind it, have to see if the maintainer will take it :)
You could add a small changelog / SOB and I could putit after my patch?
>
> ---
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index 0a056c64c317b..53743555676d6 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -314,6 +314,7 @@ struct kvmppc_ops {
> int size);
> int (*enable_svm)(struct kvm *kvm);
> int (*svm_off)(struct kvm *kvm);
> + bool (*hash_possible)(void);
> };
>
> extern struct kvmppc_ops *kvmppc_hv_ops;
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 6f612d240392f..2d1e8aba22b85 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -5599,6 +5599,15 @@ static int kvmhv_svm_off(struct kvm *kvm)
> return ret;
> }
>
> +static bool kvmppc_hash_possible(void)
> +{
> + if (radix_enabled() && no_mixing_hpt_and_radix)
> + return false;
> +
> + return cpu_has_feature(CPU_FTR_ARCH_300) &&
> + cpu_has_feature(CPU_FTR_HVMODE);
> +}
Just be careful, it's hash_v3 specifically. Either make this return true
for arch < 300 add the ARCH_300 check in the ioctl, or rename to include
v3.
> +
> static struct kvmppc_ops kvm_ops_hv = {
> .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv,
> .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv,
> @@ -5642,6 +5651,7 @@ static struct kvmppc_ops kvm_ops_hv = {
> .store_to_eaddr = kvmhv_store_to_eaddr,
> .enable_svm = kvmhv_enable_svm,
> .svm_off = kvmhv_svm_off,
> + .hash_possible = kvmppc_hash_possible,
> };
>
How about adding an op which can check extensions? It could return false
if it wasn't checked and so default to the generic checks in
kvm_vm_ioctl_check_extension, and take a pointer to 'r' to set.
> static int kvm_init_subcore_bitmap(void)
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index cf52d26f49cd7..99ced6c570e74 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -611,8 +611,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> r = !!(hv_enabled && radix_enabled());
> break;
> case KVM_CAP_PPC_MMU_HASH_V3:
> - r = !!(hv_enabled && cpu_has_feature(CPU_FTR_ARCH_300) &&
> - cpu_has_feature(CPU_FTR_HVMODE));
> + r = !!(hv_enabled && kvmppc_hv_ops->hash_possible());
> break;
> case KVM_CAP_PPC_NESTED_HV:
> r = !!(hv_enabled && kvmppc_hv_ops->enable_nested &&
Thanks,
Nick
next prev parent reply other threads:[~2021-01-20 0:05 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 6:28 [PATCH 0/4] a few KVM patches Nicholas Piggin
2021-01-18 6:28 ` Nicholas Piggin
2021-01-18 6:28 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode Nicholas Piggin
2021-01-18 6:28 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support Nicholas Piggin
2021-01-19 1:46 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed Fabiano Rosas
2021-01-19 1:46 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support Fabiano Rosas
2021-01-19 3:27 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed Nicholas Piggin
2021-01-19 3:27 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support Nicholas Piggin
2021-01-19 21:07 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed Fabiano Rosas
2021-01-19 21:07 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support Fabiano Rosas
2021-01-20 0:05 ` Nicholas Piggin [this message]
2021-01-20 0:05 ` Nicholas Piggin
2021-01-20 14:27 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed Fabiano Rosas
2021-01-20 14:27 ` [PATCH 1/4] KVM: PPC: Book3S HV: Remove support for running HPT guest on RPT host without mixed mode support Fabiano Rosas
2021-02-05 16:41 ` [PATCH] KVM: PPC: Don't always report hash MMU capability for P9 < DD2.2 Fabiano Rosas
2021-02-05 16:41 ` Fabiano Rosas
2021-01-18 6:28 ` [PATCH 2/4] KVM: PPC: Book3S HV: Fix radix guest SLB side channel Nicholas Piggin
2021-01-18 6:28 ` Nicholas Piggin
2021-01-19 1:39 ` Fabiano Rosas
2021-01-19 1:39 ` Fabiano Rosas
2021-02-10 1:28 ` Paul Mackerras
2021-02-10 1:28 ` Paul Mackerras
2021-02-10 2:51 ` Nicholas Piggin
2021-02-10 2:51 ` Nicholas Piggin
2021-01-18 6:28 ` [PATCH 3/4] KVM: PPC: Book3S HV: No need to clear radix host SLB before loading guest Nicholas Piggin
2021-01-18 6:28 ` Nicholas Piggin
2021-01-18 6:28 ` [PATCH 4/4] KVM: PPC: Book3S HV: Use POWER9 SLBIA IH=6 variant to clear SLB Nicholas Piggin
2021-01-18 6:28 ` Nicholas Piggin
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=1611099866.a9bsenxeey.astroid@bobo.none \
--to=npiggin@gmail.com \
--cc=farosas@linux.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.