+AD4- -----Original Message----- +AD4- From: Sean Christopherson +AFs-mailto:sean.j.christopherson+AEA-intel.com+AF0- +AD4- Sent: Tuesday, September 22, 2020 3:41 AM +AD4- To: Li,Rongqing +ADw-lirongqing+AEA-baidu.com+AD4- +AD4- Cc: kvm+AEA-vger.kernel.org+ADs- x86+AEA-kernel.org +AD4- Subject: Re: +AFs-PATCH+AF0- KVM: x86/mmu: fix counting of rmap entries in +AD4- pte+AF8-list+AF8-add +AD4- +AD4- On Mon, Sep 21, 2020 at 06:29:26PM +-0800, Li RongQing wrote: +AD4- +AD4- counting of rmap entries was missed when desc-+AD4-sptes is full and +AD4- +AD4- desc-+AD4-more is NULL +AD4- +AD4- +AD4- +AD4- Signed-off-by: Li RongQing +ADw-lirongqing+AEA-baidu.com+AD4- +AD4- +AD4- --- +AD4- +AD4- arch/x86/kvm/mmu/mmu.c +AHw- 1 +- +AD4- +AD4- 1 file changed, 1 insertion(+-) +AD4- +AD4- +AD4- +AD4- diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index +AD4- +AD4- a5d0207e7189..8ffa4e40b650 100644 +AD4- +AD4- --- a/arch/x86/kvm/mmu/mmu.c +AD4- +AD4- +-+-+- b/arch/x86/kvm/mmu/mmu.c +AD4- +AD4- +AEAAQA- -1280,6 +-1280,7 +AEAAQA- static int pte+AF8-list+AF8-add(struct kvm+AF8-vcpu +ACo-vcpu, u64 +AD4- +ACo-spte, +AD4- +AD4- if (desc-+AD4-sptes+AFs-PTE+AF8-LIST+AF8-EXT-1+AF0-) +AHs- +AD4- +AD4- desc-+AD4-more +AD0- mmu+AF8-alloc+AF8-pte+AF8-list+AF8-desc(vcpu)+ADs- +AD4- +AD4- desc +AD0- desc-+AD4-more+ADs- +AD4- +AD4- +- count +-+AD0- PTE+AF8-LIST+AF8-EXT+ADs- +AD4- +AD4- Kind of a nit, but what do you think about merging the two PTE+AF8-LIST+AF8-EXT-1 +AD4- check? For me, that makes the resulting code more obviously correct, and it +AD4- might be slightly more performant as it avoids the extra comparison, though +AD4- the compiler may be smart enough to optimize that away without help. +AD4- +AD4- while (desc-+AD4-sptes+AFs-PTE+AF8-LIST+AF8-EXIT-1+AF0-) +AHs- +AD4- count +-+AD0- PTE+AF8-LIST+AF8-EXT+ADs- +AD4- +AD4- if (+ACE-desc-+AD4-more) +AHs- +AD4- desc-+AD4-more +AD0- mmu+AF8-alloc+AF8-pte+AF8-list+AF8-desc(vcpu)+ADs- +AD4- desc +AD0- desc-+AD4-more+ADs- +AD4- break+ADs- +AD4- +AH0- +AD4- desc +AD0- desc-+AD4-more+ADs- +AD4- +AH0- +AD4- Ok, I will send V2 as you suggested Thanks -Li