* [PATCH] KVM: PPC: Book3S HV: Disable HPT resizing on POWER9 for now
@ 2017-02-17 21:41 Paul Mackerras
2017-02-18 2:36 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2017-02-17 21:41 UTC (permalink / raw)
To: kvm, kvm-ppc; +Cc: David Gibson
The new HPT resizing code added in commit b5baa6877315 ("KVM: PPC:
Book3S HV: KVM-HV HPT resizing implementation", 2016-12-20) doesn't
have code to handle the new HPTE format which POWER9 uses. Thus it
would be best not to advertise it to userspace on POWER9 systems
until it works properly.
Also, since resize_hpt_rehash_hpte() contains BUG_ON() calls that
could be hit on POWER9, let's prevent it from being called on POWER9
for now.
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 ++++++
arch/powerpc/kvm/powerpc.c | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index b68b342..f3158fb 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -1370,6 +1370,12 @@ static int resize_hpt_rehash(struct kvm_resize_hpt *resize)
unsigned long i;
int rc;
+ /*
+ * resize_hpt_rehash_hpte() doesn't handle the new-format HPTEs
+ * that POWER9 uses, and could well hit a BUG_ON on POWER9.
+ */
+ if (cpu_has_feature(CPU_FTR_ARCH_300))
+ return -EIO;
for (i = 0; i < kvmppc_hpt_npte(&kvm->arch.hpt); i++) {
rc = resize_hpt_rehash_hpte(resize, i);
if (rc != 0)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2b3e4e6..fcb253b 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -613,7 +613,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
r = 1;
break;
case KVM_CAP_SPAPR_RESIZE_HPT:
- r = !!hv_enabled;
+ /* Disable this on POWER9 until code handles new HPTE format */
+ r = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);
break;
#endif
case KVM_CAP_PPC_HTM:
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Disable HPT resizing on POWER9 for now
2017-02-17 21:41 [PATCH] KVM: PPC: Book3S HV: Disable HPT resizing on POWER9 for now Paul Mackerras
@ 2017-02-18 2:36 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-02-18 2:36 UTC (permalink / raw)
To: Paul Mackerras; +Cc: kvm, kvm-ppc
[-- Attachment #1: Type: text/plain, Size: 2358 bytes --]
On Sat, Feb 18, 2017 at 08:41:40AM +1100, Paul Mackerras wrote:
> The new HPT resizing code added in commit b5baa6877315 ("KVM: PPC:
> Book3S HV: KVM-HV HPT resizing implementation", 2016-12-20) doesn't
> have code to handle the new HPTE format which POWER9 uses. Thus it
> would be best not to advertise it to userspace on POWER9 systems
> until it works properly.
>
> Also, since resize_hpt_rehash_hpte() contains BUG_ON() calls that
> could be hit on POWER9, let's prevent it from being called on POWER9
> for now.
>
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
I probably would have put the check on entry to the prepare path,
rather than deep in the rehashing, but we need the fix one way or
another.
> ---
> arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 ++++++
> arch/powerpc/kvm/powerpc.c | 3 ++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> index b68b342..f3158fb 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> @@ -1370,6 +1370,12 @@ static int resize_hpt_rehash(struct kvm_resize_hpt *resize)
> unsigned long i;
> int rc;
>
> + /*
> + * resize_hpt_rehash_hpte() doesn't handle the new-format HPTEs
> + * that POWER9 uses, and could well hit a BUG_ON on POWER9.
> + */
> + if (cpu_has_feature(CPU_FTR_ARCH_300))
> + return -EIO;
> for (i = 0; i < kvmppc_hpt_npte(&kvm->arch.hpt); i++) {
> rc = resize_hpt_rehash_hpte(resize, i);
> if (rc != 0)
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 2b3e4e6..fcb253b 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -613,7 +613,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> r = 1;
> break;
> case KVM_CAP_SPAPR_RESIZE_HPT:
> - r = !!hv_enabled;
> + /* Disable this on POWER9 until code handles new HPTE format */
> + r = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);
> break;
> #endif
> case KVM_CAP_PPC_HTM:
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-18 2:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17 21:41 [PATCH] KVM: PPC: Book3S HV: Disable HPT resizing on POWER9 for now Paul Mackerras
2017-02-18 2:36 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox