From: Wanpeng Li <wanpeng.li@hotmail.com>
To: Jan Kiszka <jan.kiszka@siemens.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: Bandan Das <bsd@redhat.com>, Wincy Van <fanwenyi0529@gmail.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid
Date: Wed, 16 Sep 2015 17:14:27 +0800 [thread overview]
Message-ID: <BLU436-SMTP2571DCB6E1540CC50CE3DBF805B0@phx.gbl> (raw)
In-Reply-To: <55F9323A.3080900@siemens.com>
On 9/16/15 5:11 PM, Jan Kiszka wrote:
> On 2015-09-16 09:19, Wanpeng Li wrote:
>> Enhance allocate/free_vid to handle shadow vpid.
>>
>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
>> ---
>> arch/x86/kvm/vmx.c | 23 +++++++++++------------
>> 1 file changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 9ff6a3f..c5222b8 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -4155,29 +4155,28 @@ static int alloc_identity_pagetable(struct kvm *kvm)
>> return r;
>> }
>>
>> -static void allocate_vpid(struct vcpu_vmx *vmx)
>> +static int allocate_vpid(void)
>> {
>> int vpid;
>>
>> - vmx->vpid = 0;
>> if (!enable_vpid)
>> - return;
>> + return 0;
>> spin_lock(&vmx_vpid_lock);
>> vpid = find_first_zero_bit(vmx_vpid_bitmap, VMX_NR_VPIDS);
>> - if (vpid < VMX_NR_VPIDS) {
>> - vmx->vpid = vpid;
>> + if (vpid < VMX_NR_VPIDS)
>> __set_bit(vpid, vmx_vpid_bitmap);
>> - }
>> + else
>> + vpid = 0;
>> spin_unlock(&vmx_vpid_lock);
>> + return vpid;
>> }
>>
>> -static void free_vpid(struct vcpu_vmx *vmx)
>> +static void free_vpid(int vpid)
>> {
>> if (!enable_vpid)
> || vpid == 0
>
> Otherwise you clear bit zero and cause the next allocate_vpid return 0 -
> from the bitmap.
Will do, thanks. :-)
Regards,
Wanpeng Li
next prev parent reply other threads:[~2015-09-16 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1442387950-116085-1-git-send-email-wanpeng.li@hotmail.com>
2015-09-16 7:19 ` Wanpeng Li
2015-09-16 9:11 ` Jan Kiszka
2015-09-16 9:14 ` Wanpeng Li [this message]
2015-09-16 7:19 ` [PATCH v4 2/2] KVM: nVMX: nested VPID emulation Wanpeng Li
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=BLU436-SMTP2571DCB6E1540CC50CE3DBF805B0@phx.gbl \
--to=wanpeng.li@hotmail.com \
--cc=bsd@redhat.com \
--cc=fanwenyi0529@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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
all inboxes | Powered by JetHome®