From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Yang, Sheng" <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] KVM: VMX: Enable Virtual Processor Identification (VPID)
Date: Thu, 24 Jan 2008 13:50:20 +0200 [thread overview]
Message-ID: <47987B7C.1080509@qumranet.com> (raw)
In-Reply-To: <200801241426.55928.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Yang, Sheng wrote:
> To allow TLB entries to be retained across VM entry and VM exit, the VMM can
> now identify distinct address spaces through a new virtual-processor ID
> (VPID) field of the VMCS.
>
>
> +#define VPID_BITMAP_SIZE (1 << 16)*BITS_PER_BYTE
>
This is strange; I think that just (1 << 16) would be simpler later on.
Please also rename to VMX_NR_VPIDS, since this header is generally
implementation independent (just declares vmx constants).
> static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
> @@ -86,6 +90,9 @@ static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
> static struct page *vmx_io_bitmap_a;
> static struct page *vmx_io_bitmap_b;
>
> +static DECLARE_BITMAP(vmx_vpid_bitmap, VPID_BITMAP_SIZE / BITS_PER_BYTE);
>
Like here, you could pass VPID_BITMAP_SIZE.
>
> +static void allocate_vpid(struct vcpu_vmx *vmx)
> +{
> + int vpid;
> +
> + vmx->vpid = 0;
> + if (!enable_vpid || !cpu_has_vmx_vpid())
> + return;
> + spin_lock(&vmx_vpid_lock);
> + vpid = find_first_zero_bit(vmx_vpid_bitmap, VPID_BITMAP_SIZE);
>
This can overflow since VPID_BITMAP_SIZE is 64K * 8.
> apic_access_page));
>
> + if (vmx->vpid != 0) {
> + vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
> + printk(KERN_DEBUG "VPID enabled, VPID is 0x%x\n", vmx->vpid);
> + }
>
Please drop the printk().
> ap_b);
>
> + set_bit(0, vmx_vpid_bitmap); /* 0 is reversed for host */
> +
>
reversed -> reserved, some letters got reserved here. See also Rik can
Riel's signature.
Need to add vpid support to vmx_flush_tlb() (and perhaps call it from
vmx_set_cr3).
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-01-24 11:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-24 6:26 [PATCH] KVM: VMX: Enable Virtual Processor Identification (VPID) Yang, Sheng
[not found] ` <200801241426.55928.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-24 11:15 ` Aurelien Jarno
[not found] ` <4798736D.8000002-rXXEIb44qovR7s880joybQ@public.gmane.org>
2008-01-25 1:47 ` Yang, Sheng
2008-01-24 11:50 ` Avi Kivity [this message]
[not found] ` <47987B7C.1080509-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-25 4:12 ` Yang, Sheng
[not found] ` <200801251212.29031.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-25 6:52 ` Avi Kivity
[not found] ` <4799873F.1070503-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-25 7:01 ` Yang, Sheng
[not found] ` <200801251501.54884.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2008-01-25 7:03 ` Avi Kivity
[not found] ` <479989C0.90307-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-25 8:34 ` Yang, Sheng
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=47987B7C.1080509@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.