* FAILED: patch "[PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit" failed to apply to 4.19-stable tree
@ 2019-06-23 20:27 gregkh
2019-06-25 10:45 ` [PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT Jiri Palecek
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2019-06-23 20:27 UTC (permalink / raw)
To: sean.j.christopherson, jpalecek, pbonzini; +Cc: stable
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b6b80c78af838bef17501416d5d383fedab0010a Mon Sep 17 00:00:00 2001
From: Sean Christopherson <sean.j.christopherson@intel.com>
Date: Thu, 13 Jun 2019 10:22:23 -0700
Subject: [PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit
NPT
SVM's Nested Page Tables (NPT) reuses x86 paging for the host-controlled
page walk. For 32-bit KVM, this means PAE paging is used even when TDP
is enabled, i.e. the PAE root array needs to be allocated.
Fixes: ee6268ba3a68 ("KVM: x86: Skip pae_root shadow allocation if tdp enabled")
Cc: stable@vger.kernel.org
Reported-by: Jiri Palecek <jpalecek@web.de>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1e9ba81accba..d3c3d5e5ffd4 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5602,14 +5602,18 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
struct page *page;
int i;
- if (tdp_enabled)
- return 0;
-
/*
- * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64.
- * Therefore we need to allocate shadow page tables in the first
- * 4GB of memory, which happens to fit the DMA32 zone.
+ * When using PAE paging, the four PDPTEs are treated as 'root' pages,
+ * while the PDP table is a per-vCPU construct that's allocated at MMU
+ * creation. When emulating 32-bit mode, cr3 is only 32 bits even on
+ * x86_64. Therefore we need to allocate the PDP table in the first
+ * 4GB of memory, which happens to fit the DMA32 zone. Except for
+ * SVM's 32-bit NPT support, TDP paging doesn't use PAE paging and can
+ * skip allocating the PDP table.
*/
+ if (tdp_enabled && kvm_x86_ops->get_tdp_level(vcpu) > PT32E_ROOT_LEVEL)
+ return 0;
+
page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_DMA32);
if (!page)
return -ENOMEM;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT
2019-06-23 20:27 FAILED: patch "[PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit" failed to apply to 4.19-stable tree gregkh
@ 2019-06-25 10:45 ` Jiri Palecek
2019-06-25 19:30 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Palecek @ 2019-06-25 10:45 UTC (permalink / raw)
To: stable; +Cc: Sean Christopherson, Paolo Bonzini
Original commit id b6b80c78 ported to stable/linux-4.19.y.
SVM's Nested Page Tables (NPT) reuses x86 paging for the host-controlled
page walk. For 32-bit KVM, this means PAE paging is used even when TDP
is enabled, i.e. the PAE root array needs to be allocated.
Fixes: ee6268ba3a68 ("KVM: x86: Skip pae_root shadow allocation if tdp enabled")
Cc: stable@vger.kernel.org
Reported-by: Jiri Palecek <jpalecek@web.de>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/mmu.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 779ed52047d1..e0f982e35c96 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5386,7 +5386,16 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
struct page *page;
int i;
- if (tdp_enabled)
+ /*
+ * When using PAE paging, the four PDPTEs are treated as 'root' pages,
+ * while the PDP table is a per-vCPU construct that's allocated at MMU
+ * creation. When emulating 32-bit mode, cr3 is only 32 bits even on
+ * x86_64. Therefore we need to allocate the PDP table in the first
+ * 4GB of memory, which happens to fit the DMA32 zone. Except for
+ * SVM's 32-bit NPT support, TDP paging doesn't use PAE paging and can
+ * skip allocating the PDP table.
+ */
+ if (tdp_enabled && kvm_x86_ops->get_tdp_level(vcpu) > PT32E_ROOT_LEVEL)
return 0;
/*
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT
2019-06-25 10:45 ` [PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT Jiri Palecek
@ 2019-06-25 19:30 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2019-06-25 19:30 UTC (permalink / raw)
To: Jiri Palecek; +Cc: stable, Sean Christopherson, Paolo Bonzini
On Tue, Jun 25, 2019 at 12:45:24PM +0200, Jiri Palecek wrote:
>Original commit id b6b80c78 ported to stable/linux-4.19.y.
>
>SVM's Nested Page Tables (NPT) reuses x86 paging for the host-controlled
>page walk. For 32-bit KVM, this means PAE paging is used even when TDP
>is enabled, i.e. the PAE root array needs to be allocated.
>
>Fixes: ee6268ba3a68 ("KVM: x86: Skip pae_root shadow allocation if tdp enabled")
>Cc: stable@vger.kernel.org
>Reported-by: Jiri Palecek <jpalecek@web.de>
>Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Could you add your signed-off-by please?
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-25 19:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-23 20:27 FAILED: patch "[PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit" failed to apply to 4.19-stable tree gregkh
2019-06-25 10:45 ` [PATCH] KVM: x86/mmu: Allocate PAE root array when using SVM's 32-bit NPT Jiri Palecek
2019-06-25 19:30 ` Sasha Levin
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.