All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Nested VMX: load current_vmcs only when it exists
@ 2014-05-09  4:56 Yang Zhang
  2014-05-09  5:53 ` Tian, Kevin
  2014-05-09  9:46 ` Jan Beulich
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Zhang @ 2014-05-09  4:56 UTC (permalink / raw)
  To: xen-devel; +Cc: Yang Zhang, kevin.tian, keir.xen, Edmund H White, JBeulich

From: Yang Zhang <yang.z.zhang@Intel.com>

There may not have valid vmcs on current CPU. So only load it when it exists.

This original fixing is from Edmud <edmund.h.white@intel.com>.

Signed-off-by: Edmund H White <edmund.h.white@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index cc84ca2..7564895 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -824,8 +824,12 @@ void virtual_vmcs_enter(void *vvmcs)
 
 void virtual_vmcs_exit(void *vvmcs)
 {
+    struct vmcs_struct *cur = this_cpu(current_vmcs);
+
     __vmpclear(pfn_to_paddr(domain_page_map_to_mfn(vvmcs)));
-    __vmptrld(virt_to_maddr(this_cpu(current_vmcs)));
+    if ( cur )
+        __vmptrld(virt_to_maddr(cur));
+
 }
 
 u64 virtual_vmcs_vmread(void *vvmcs, u32 vmcs_encoding)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Nested VMX: load current_vmcs only when it exists
  2014-05-09  4:56 [PATCH] Nested VMX: load current_vmcs only when it exists Yang Zhang
@ 2014-05-09  5:53 ` Tian, Kevin
  2014-05-09  9:40   ` Andrew Cooper
  2014-05-09  9:46 ` Jan Beulich
  1 sibling, 1 reply; 5+ messages in thread
From: Tian, Kevin @ 2014-05-09  5:53 UTC (permalink / raw)
  To: Zhang, Yang Z, xen-devel@lists.xensource.com
  Cc: keir.xen@gmail.com, White, Edmund H, JBeulich@suse.com

> From: Zhang, Yang Z
> Sent: Friday, May 09, 2014 12:56 PM
> 
> From: Yang Zhang <yang.z.zhang@Intel.com>
> 
> There may not have valid vmcs on current CPU. So only load it when it exists.
> 
> This original fixing is from Edmud <edmund.h.white@intel.com>.
> 
> Signed-off-by: Edmund H White <edmund.h.white@intel.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>

Acked-by: Kevin Tian <kevin.tian@intel.com>

> ---
>  xen/arch/x86/hvm/vmx/vmcs.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index cc84ca2..7564895 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -824,8 +824,12 @@ void virtual_vmcs_enter(void *vvmcs)
> 
>  void virtual_vmcs_exit(void *vvmcs)
>  {
> +    struct vmcs_struct *cur = this_cpu(current_vmcs);
> +
>      __vmpclear(pfn_to_paddr(domain_page_map_to_mfn(vvmcs)));
> -    __vmptrld(virt_to_maddr(this_cpu(current_vmcs)));
> +    if ( cur )
> +        __vmptrld(virt_to_maddr(cur));
> +
>  }
> 
>  u64 virtual_vmcs_vmread(void *vvmcs, u32 vmcs_encoding)
> --
> 1.7.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Nested VMX: load current_vmcs only when it exists
  2014-05-09  5:53 ` Tian, Kevin
@ 2014-05-09  9:40   ` Andrew Cooper
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2014-05-09  9:40 UTC (permalink / raw)
  To: Tian, Kevin
  Cc: Zhang, Yang Z, xen-devel@lists.xensource.com, keir.xen@gmail.com,
	JBeulich@suse.com, White, Edmund H

On 09/05/14 06:53, Tian, Kevin wrote:
>> From: Zhang, Yang Z
>> Sent: Friday, May 09, 2014 12:56 PM
>>
>> From: Yang Zhang <yang.z.zhang@Intel.com>
>>
>> There may not have valid vmcs on current CPU. So only load it when it exists.
>>
>> This original fixing is from Edmud <edmund.h.white@intel.com>.
>>
>> Signed-off-by: Edmund H White <edmund.h.white@intel.com>
>> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> Acked-by: Kevin Tian <kevin.tian@intel.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
>> ---
>>  xen/arch/x86/hvm/vmx/vmcs.c |    6 +++++-
>>  1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
>> index cc84ca2..7564895 100644
>> --- a/xen/arch/x86/hvm/vmx/vmcs.c
>> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
>> @@ -824,8 +824,12 @@ void virtual_vmcs_enter(void *vvmcs)
>>
>>  void virtual_vmcs_exit(void *vvmcs)
>>  {
>> +    struct vmcs_struct *cur = this_cpu(current_vmcs);
>> +
>>      __vmpclear(pfn_to_paddr(domain_page_map_to_mfn(vvmcs)));
>> -    __vmptrld(virt_to_maddr(this_cpu(current_vmcs)));
>> +    if ( cur )
>> +        __vmptrld(virt_to_maddr(cur));
>> +
>>  }
>>
>>  u64 virtual_vmcs_vmread(void *vvmcs, u32 vmcs_encoding)
>> --
>> 1.7.1
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Nested VMX: load current_vmcs only when it exists
  2014-05-09  4:56 [PATCH] Nested VMX: load current_vmcs only when it exists Yang Zhang
  2014-05-09  5:53 ` Tian, Kevin
@ 2014-05-09  9:46 ` Jan Beulich
  2014-05-09 16:30   ` White, Edmund H
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2014-05-09  9:46 UTC (permalink / raw)
  To: Yang Zhang; +Cc: xen-devel, kevin.tian, keir.xen, Edmund H White

>>> On 09.05.14 at 06:56, <yang.z.zhang@intel.com> wrote:
> From: Yang Zhang <yang.z.zhang@Intel.com>
> 
> There may not have valid vmcs on current CPU. So only load it when it 
> exists.

Under what condition(s) might that happen?

> This original fixing is from Edmud <edmund.h.white@intel.com>.

Rather than stating this here, the From: above should say so.

> Signed-off-by: Edmund H White <edmund.h.white@intel.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> ---
>  xen/arch/x86/hvm/vmx/vmcs.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index cc84ca2..7564895 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -824,8 +824,12 @@ void virtual_vmcs_enter(void *vvmcs)
>  
>  void virtual_vmcs_exit(void *vvmcs)
>  {
> +    struct vmcs_struct *cur = this_cpu(current_vmcs);
> +
>      __vmpclear(pfn_to_paddr(domain_page_map_to_mfn(vvmcs)));
> -    __vmptrld(virt_to_maddr(this_cpu(current_vmcs)));
> +    if ( cur )
> +        __vmptrld(virt_to_maddr(cur));
> +
>  }
>  
>  u64 virtual_vmcs_vmread(void *vvmcs, u32 vmcs_encoding)
> -- 
> 1.7.1
> 
> .

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Nested VMX: load current_vmcs only when it exists
  2014-05-09  9:46 ` Jan Beulich
@ 2014-05-09 16:30   ` White, Edmund H
  0 siblings, 0 replies; 5+ messages in thread
From: White, Edmund H @ 2014-05-09 16:30 UTC (permalink / raw)
  To: Jan Beulich, Zhang, Yang Z; +Cc: xen-devel, Tian, Kevin, keir.xen@gmail.com

It can happen if no domU vcpu has previously been scheduled on this hardware thread. 
________________________________________
From: Jan Beulich [JBeulich@suse.com]
Sent: Friday, May 09, 2014 2:46 AM
To: Zhang, Yang Z
Cc: keir.xen@gmail.com; White, Edmund H; Tian, Kevin; xen-devel
Subject: Re: [PATCH] Nested VMX: load current_vmcs only when it exists

>>> On 09.05.14 at 06:56, <yang.z.zhang@intel.com> wrote:
> From: Yang Zhang <yang.z.zhang@Intel.com>
>
> There may not have valid vmcs on current CPU. So only load it when it
> exists.

Under what condition(s) might that happen?

> This original fixing is from Edmud <edmund.h.white@intel.com>.

Rather than stating this here, the From: above should say so.

> Signed-off-by: Edmund H White <edmund.h.white@intel.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> ---
>  xen/arch/x86/hvm/vmx/vmcs.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index cc84ca2..7564895 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -824,8 +824,12 @@ void virtual_vmcs_enter(void *vvmcs)
>
>  void virtual_vmcs_exit(void *vvmcs)
>  {
> +    struct vmcs_struct *cur = this_cpu(current_vmcs);
> +
>      __vmpclear(pfn_to_paddr(domain_page_map_to_mfn(vvmcs)));
> -    __vmptrld(virt_to_maddr(this_cpu(current_vmcs)));
> +    if ( cur )
> +        __vmptrld(virt_to_maddr(cur));
> +
>  }
>
>  u64 virtual_vmcs_vmread(void *vvmcs, u32 vmcs_encoding)
> --
> 1.7.1
>
> .

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-09 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-09  4:56 [PATCH] Nested VMX: load current_vmcs only when it exists Yang Zhang
2014-05-09  5:53 ` Tian, Kevin
2014-05-09  9:40   ` Andrew Cooper
2014-05-09  9:46 ` Jan Beulich
2014-05-09 16:30   ` White, Edmund H

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.