public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, Bandan Das <bsd@redhat.com>,
	Wincy Van <fanwenyi0529@gmail.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid
Date: Tue, 15 Sep 2015 14:54:45 +0200	[thread overview]
Message-ID: <55F81515.8090405@redhat.com> (raw)
In-Reply-To: <BLU436-SMTP2539135088523E893EC341A805C0@phx.gbl>



On 15/09/2015 12:30, Wanpeng Li wrote:
> +	if (!nested) {
> +		vpid = find_first_zero_bit(vmx_vpid_bitmap, VMX_NR_VPIDS);
> +		if (vpid < VMX_NR_VPIDS) {
>  		vmx->vpid = vpid;
>  		__set_bit(vpid, vmx_vpid_bitmap);
> +		}
> +	} else {
> +		vpid = find_first_zero_bit(vmx_vpid_bitmap, VMX_NR_VPIDS);
> +		if (vpid < VMX_NR_VPIDS) {
> +			vmx->nested.vpid02 = vpid;
> +			__set_bit(vpid, vmx_vpid_bitmap);
> +		}

Messy indentation, and a lot of duplicate code.  Can you instead have
(which I think was Jan's suggestion too):

static int allocate_vpid(void);
static void free_vpid(int vpid);

That said, I like the simple solution to the "too many VPIDs for each L1
VCPU" processor.

Paolo

  reply	other threads:[~2015-09-15 12:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1442313034-14243-1-git-send-email-wanpeng.li@hotmail.com>
2015-09-15 10:30 ` [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid Wanpeng Li
2015-09-15 12:54   ` Paolo Bonzini [this message]
2015-09-16  3:58     ` Wanpeng Li
2015-09-15 10:30 ` [PATCH v2 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=55F81515.8090405@redhat.com \
    --to=pbonzini@redhat.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=wanpeng.li@hotmail.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