[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 4/4] nested vmx: enable VMCS shadowing feature



>>> On 18.01.13 at 07:07, Dongxiao Xu <dongxiao.xu@xxxxxxxxx> wrote:
> @@ -843,6 +856,45 @@ static int construct_vmcs(struct vcpu *v)
>          }
>      }
>  
> +    /* non-root VMREAD/VMWRITE bitmap. */
> +    if ( cpu_has_vmx_vmcs_shadowing )
> +    {
> +        unsigned long *vmread_bitmap, *vmwrite_bitmap;
> +
> +        vmread_bitmap = alloc_xenheap_page();
> +        if ( !vmread_bitmap )
> +        {
> +            gdprintk(XENLOG_ERR, "nest: allocation for vmread bitmap 
> failed\n");
> +            ret = -ENOMEM;
> +            goto out1;
> +        }
> +        v->arch.hvm_vmx.vmread_bitmap = vmread_bitmap;
> +
> +        vmwrite_bitmap = alloc_xenheap_page();
> +        if ( !vmwrite_bitmap )
> +        {
> +            gdprintk(XENLOG_ERR, "nest: allocation for vmwrite bitmap 
> failed\n");
> +            ret = -ENOMEM;
> +            goto out2;
> +        }
> +        v->arch.hvm_vmx.vmwrite_bitmap = vmwrite_bitmap;
> +
> +        memset(vmread_bitmap, 0, PAGE_SIZE);
> +        memset(vmwrite_bitmap, 0, PAGE_SIZE);

clear_page()

> +
> +        /* 
> +         * For the following 4 encodings, we need to handle them in VMM.
> +         * Let them vmexit as usual.
> +         */
> +        set_bit(IO_BITMAP_A, vmwrite_bitmap);
> +        set_bit(IO_BITMAP_A_HIGH, vmwrite_bitmap);
> +        set_bit(IO_BITMAP_B, vmwrite_bitmap);
> +        set_bit(IO_BITMAP_B_HIGH, vmwrite_bitmap);
> +
> +        __vmwrite(VMREAD_BITMAP, virt_to_maddr(vmread_bitmap));
> +        __vmwrite(VMWRITE_BITMAP, virt_to_maddr(vmwrite_bitmap));
> +    }

Does this really need to be done always (i.e. even when nested
HVM isn't enabled)?

Also, considering that the only time you access these bitmaps is in
the initialization function - do they really need to use Xen heap
allocations (rather than Dom heap ones)? This is going to make a
difference again very soon.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.