From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Li RongQing <lirongqing@baidu.com>
Cc: kvm@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: fix counting of rmap entries in pte_list_add
Date: Mon, 21 Sep 2020 12:40:43 -0700 [thread overview]
Message-ID: <20200921194043.GA25005@linux.intel.com> (raw)
In-Reply-To: <1600684166-32430-1-git-send-email-lirongqing@baidu.com>
On Mon, Sep 21, 2020 at 06:29:26PM +0800, Li RongQing wrote:
> counting of rmap entries was missed when desc->sptes is full
> and desc->more is NULL
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index a5d0207e7189..8ffa4e40b650 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -1280,6 +1280,7 @@ static int pte_list_add(struct kvm_vcpu *vcpu, u64 *spte,
> if (desc->sptes[PTE_LIST_EXT-1]) {
> desc->more = mmu_alloc_pte_list_desc(vcpu);
> desc = desc->more;
> + count += PTE_LIST_EXT;
Kind of a nit, but what do you think about merging the two PTE_LIST_EXT-1
check? For me, that makes the resulting code more obviously correct, and it
might be slightly more performant as it avoids the extra comparison, though
the compiler may be smart enough to optimize that away without help.
while (desc->sptes[PTE_LIST_EXIT-1]) {
count += PTE_LIST_EXT;
if (!desc->more) {
desc->more = mmu_alloc_pte_list_desc(vcpu);
desc = desc->more;
break;
}
desc = desc->more;
}
> }
> for (i = 0; desc->sptes[i]; ++i)
> ++count;
> --
> 2.16.2
>
next prev parent reply other threads:[~2020-09-21 19:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 10:29 [PATCH] KVM: x86/mmu: fix counting of rmap entries in pte_list_add Li RongQing
2020-09-21 19:40 ` Sean Christopherson [this message]
2020-09-22 5:23 ` Li,Rongqing
-- strict thread matches above, loose matches on Subject: below --
2020-09-01 9:26 Li RongQing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200921194043.GA25005@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=kvm@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox