diff mbox series

[RFC,2/6] KVM: X86: Walk shadow page starting with shadow_root_level

Message ID 20211210092508.7185-3-jiangshanlai@gmail.com (mailing list archive)
State New, archived
Headers show
Series KVM: X86: Add and use shadow page with level promoted or acting as pae_root | expand

Commit Message

Lai Jiangshan Dec. 10, 2021, 9:25 a.m. UTC
From: Lai Jiangshan <laijs@linux.alibaba.com>

Walking from the root page of the shadow page table should start with
the level of the shadow page table: shadow_root_level.

Also change a small defect in audit_mappings(), it is believed
that the current walking level is more valuable to print.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
 arch/x86/kvm/mmu/mmu_audit.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Sean Christopherson Jan. 4, 2022, 8:34 p.m. UTC | #1
On Fri, Dec 10, 2021, Lai Jiangshan wrote:
> From: Lai Jiangshan <laijs@linux.alibaba.com>
> 
> Walking from the root page of the shadow page table should start with
> the level of the shadow page table: shadow_root_level.
> 
> Also change a small defect in audit_mappings(), it is believed
> that the current walking level is more valuable to print.
> 
> Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
> ---
>  arch/x86/kvm/mmu/mmu_audit.c | 5 ++---

I vote we remove mmu_audit.c.  It has bitrotted horribly, and none of the
current set of KVM developers even knows how to use it effectively.
Paolo Bonzini Jan. 4, 2022, 8:37 p.m. UTC | #2
On 1/4/22 21:34, Sean Christopherson wrote:
> On Fri, Dec 10, 2021, Lai Jiangshan wrote:
>> From: Lai Jiangshan<laijs@linux.alibaba.com>
>>
>> Walking from the root page of the shadow page table should start with
>> the level of the shadow page table: shadow_root_level.
>>
>> Also change a small defect in audit_mappings(), it is believed
>> that the current walking level is more valuable to print.
>>
>> Signed-off-by: Lai Jiangshan<laijs@linux.alibaba.com>
>> ---
>>   arch/x86/kvm/mmu/mmu_audit.c | 5 ++---
> 
> I vote we remove mmu_audit.c.  It has bitrotted horribly, and none of the
> current set of KVM developers even knows how to use it effectively.

No complaints.

Paolo
Maxim Levitsky Jan. 4, 2022, 8:43 p.m. UTC | #3
On Tue, 2022-01-04 at 21:37 +0100, Paolo Bonzini wrote:
> On 1/4/22 21:34, Sean Christopherson wrote:
> > On Fri, Dec 10, 2021, Lai Jiangshan wrote:
> > > From: Lai Jiangshan<laijs@linux.alibaba.com>
> > > 
> > > Walking from the root page of the shadow page table should start with
> > > the level of the shadow page table: shadow_root_level.
> > > 
> > > Also change a small defect in audit_mappings(), it is believed
> > > that the current walking level is more valuable to print.
> > > 
> > > Signed-off-by: Lai Jiangshan<laijs@linux.alibaba.com>
> > > ---
> > >   arch/x86/kvm/mmu/mmu_audit.c | 5 ++---
> > 
> > I vote we remove mmu_audit.c.  It has bitrotted horribly, and none of the
> > current set of KVM developers even knows how to use it effectively.
> 
> No complaints.

I played with it once, its not that bad IMHO.

Best regards,
	Maxim Levitsky

> 
> Paolo
>
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/mmu_audit.c b/arch/x86/kvm/mmu/mmu_audit.c
index 9e7dcf999f08..6bbbf85b3e46 100644
--- a/arch/x86/kvm/mmu/mmu_audit.c
+++ b/arch/x86/kvm/mmu/mmu_audit.c
@@ -63,7 +63,7 @@  static void mmu_spte_walk(struct kvm_vcpu *vcpu, inspect_spte_fn fn)
 		hpa_t root = vcpu->arch.mmu->root_hpa;
 
 		sp = to_shadow_page(root);
-		__mmu_spte_walk(vcpu, sp, fn, vcpu->arch.mmu->root_level);
+		__mmu_spte_walk(vcpu, sp, fn, vcpu->arch.mmu->shadow_root_level);
 		return;
 	}
 
@@ -119,8 +119,7 @@  static void audit_mappings(struct kvm_vcpu *vcpu, u64 *sptep, int level)
 	hpa =  pfn << PAGE_SHIFT;
 	if ((*sptep & PT64_BASE_ADDR_MASK) != hpa)
 		audit_printk(vcpu->kvm, "levels %d pfn %llx hpa %llx "
-			     "ent %llxn", vcpu->arch.mmu->root_level, pfn,
-			     hpa, *sptep);
+			     "ent %llxn", level, pfn, hpa, *sptep);
 }
 
 static void inspect_spte_has_rmap(struct kvm *kvm, u64 *sptep)