Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225068

Re: [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid
Date 2015-09-15 15:00 +0200
Message-ID <q8Y02-5gY-13@gated-at.bofh.it> (permalink)
References <q8VOy-2cy-17@gated-at.bofh.it> <q8VOy-2cy-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow  vpid Wanpeng Li <wanpeng.li@hotmail.com> - 2015-09-15 12:40 +0200
  Re: [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle  shadow vpid Paolo Bonzini <pbonzini@redhat.com> - 2015-09-15 15:00 +0200
    Re: [PATCH v2 1/2] KVM: nVMX: enhance allocate/free_vpid to handle  shadow vpid Wanpeng Li <wanpeng.li@hotmail.com> - 2015-09-16 06:00 +0200

csiph-web