lkml.org 
[lkml]   [2024]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v19 056/130] KVM: x86/tdp_mmu: Init role member of struct kvm_mmu_page at allocation
Date
On Wed, 2024-03-20 at 17:11 -0700, Rick Edgecombe wrote:
> @@ -1378,6 +1375,8 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct
> kvm_page_fault *fault)
>                  * needs to be split.
>                  */
>                 sp = tdp_mmu_alloc_sp(vcpu);
> +               if (!(raw_gfn & kvm_gfn_shared_mask(kvm)))
> +                       kvm_mmu_alloc_private_spt(vcpu, sp);

This will try to allocate the private SP for normal VMs (which have a zero
shared mask), it should be:

diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index efed70580922..585c80fb62c5 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -1350,7 +1350,7 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct
kvm_page_fault *fault)
* needs to be split.
*/
sp = tdp_mmu_alloc_sp(vcpu);
- if (!(raw_gfn & kvm_gfn_shared_mask(kvm)))
+ if (kvm_is_private_gpa(kvm, raw_gfn << PAGE_SHIFT))
kvm_mmu_alloc_private_spt(vcpu, sp);
tdp_mmu_init_child_sp(sp, &iter);

\
 
 \ /
  Last update: 2024-05-27 16:47    [W:0.496 / U:1.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site