All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
@ 2013-12-19  2:40 Yang Zhang
  2013-12-19  2:57 ` Zhang, Yang Z
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yang Zhang @ 2013-12-19  2:40 UTC (permalink / raw)
  To: xen-devel; +Cc: Yang Zhang, andrew.cooper3, eddie.dong, jun.nakajima, JBeulich

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

With the feature of unrestricted guest, there should be no vmexit
be triggered when guest accesses the cr3 in non-paging mode. This
patch will clear the cr3 save/loading bit in vmcs control filed to
eliminate cr3 access vmexit on UG avaliable hardware.

The previous patch (commit c9efe34c119418a5ac776e5d91aeefcce4576518)
did the same thing compare to this one. But it will cause guest fail
to boot up on non-UG hardware which is repoted by Jan and it has been
reverted (commit 1e2bf05ec37cf04b0e01585eae524509179f165e).

This patch incorporate the fixing and guest are working well both in
UG and non-UG platform with this patch.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
---
changes in v3:
Revise the patch description according Jan's suggestion

changes in v2:
Fix the guest boot failure on non-UG platform.

There are some discussions around the first patch, please see the following link:
http://www.gossamer-threads.com/lists/xen/devel/302810

---
 xen/arch/x86/hvm/vmx/vmx.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index dfff628..f6409d6 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1157,7 +1157,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
             uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
                                  CPU_BASED_CR3_STORE_EXITING);
             v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
-            if ( !hvm_paging_enabled(v) )
+            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
                 v->arch.hvm_vmx.exec_control |= cr3_ctls;
 
             /* Trap CR3 updates if CR3 memory events are enabled. */
@@ -1231,7 +1231,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
     case 3:
         if ( paging_mode_hap(v->domain) )
         {
-            if ( !hvm_paging_enabled(v) )
+            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
                 v->arch.hvm_vcpu.hw_cr[3] =
                     v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
             vmx_load_pdptrs(v);
@@ -2487,10 +2487,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
 
     hvm_invalidate_regs_fields(regs);
 
-    if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
+    if ( paging_mode_hap(v->domain) )
     {
         __vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
-        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
+        if ( vmx_unrestricted_guest(v) || hvm_paging_enabled(v) )
+            v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
     }
 
     __vmread(VM_EXIT_REASON, &exit_reason);
-- 
1.7.1

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2013-12-19  2:40 [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled Yang Zhang
@ 2013-12-19  2:57 ` Zhang, Yang Z
  2013-12-19 14:33 ` Andrew Cooper
  2014-01-08  1:13 ` Zhang, Yang Z
  2 siblings, 0 replies; 8+ messages in thread
From: Zhang, Yang Z @ 2013-12-19  2:57 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, Dong, Eddie, Nakajima, Jun, JBeulich

Zhang, Yang Z wrote on 2013-12-19:
> From: Yang Zhang <yang.z.zhang@Intel.com>
> 
> With the feature of unrestricted guest, there should be no vmexit be
> triggered when guest accesses the cr3 in non-paging mode. This patch
> will clear the cr3 save/loading bit in vmcs control filed to eliminate
> cr3 access vmexit on UG avaliable hardware.
> 
> The previous patch (commit c9efe34c119418a5ac776e5d91aeefcce4576518)
> did the same thing compare to this one. But it will cause guest fail
> to boot up on non-UG hardware which is repoted by Jan and it has been
> reverted (commit 1e2bf05ec37cf04b0e01585eae524509179f165e).
> 
> This patch incorporate the fixing and guest are working well both in
> UG and non-UG platform with this patch.
> 

Hi, Jun and Andrew,

Please help to review this one which is different from the first one.
The main difference is that on non-UG hardware, guest may write cr3 before enabling paging. So we should not set guest_cr3 to the value of hw_cr3 which contain the EPT identify mapping address on non-paging mode .

> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> ---
> changes in v3:
> Revise the patch description according Jan's suggestion
> 
> changes in v2:
> Fix the guest boot failure on non-UG platform.
> 
> There are some discussions around the first patch, please see the
> following link: http://www.gossamer-threads.com/lists/xen/devel/302810
> 
> ---
>  xen/arch/x86/hvm/vmx/vmx.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index dfff628..f6409d6 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++
> b/xen/arch/x86/hvm/vmx/vmx.c @@ -1157,7 +1157,7 @@ static void
> vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
>              uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
>                                   CPU_BASED_CR3_STORE_EXITING);
>              v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
> -            if ( !hvm_paging_enabled(v) )
> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v)
> + )
>                  v->arch.hvm_vmx.exec_control |= cr3_ctls;
>              /* Trap CR3 updates if CR3 memory events are enabled. */
> @@ -1231,7 +1231,7 @@ static void vmx_update_guest_cr(struct vcpu *v,
> unsigned int cr)
>      case 3:
>          if ( paging_mode_hap(v->domain) )
>          {
> -            if ( !hvm_paging_enabled(v) )
> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v)
> + )
>                  v->arch.hvm_vcpu.hw_cr[3] =
> v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
>              vmx_load_pdptrs(v);
> @@ -2487,10 +2487,11 @@ void vmx_vmexit_handler(struct cpu_user_regs
> *regs)
> 
>      hvm_invalidate_regs_fields(regs);
> -    if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
> +    if ( paging_mode_hap(v->domain) )
>      {
>          __vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
> -        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
> +        if ( vmx_unrestricted_guest(v) || hvm_paging_enabled(v) )
> +            v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
>      }
>      
>      __vmread(VM_EXIT_REASON, &exit_reason);


Best regards,
Yang

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2013-12-19  2:40 [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled Yang Zhang
  2013-12-19  2:57 ` Zhang, Yang Z
@ 2013-12-19 14:33 ` Andrew Cooper
  2014-01-08  1:13 ` Zhang, Yang Z
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Cooper @ 2013-12-19 14:33 UTC (permalink / raw)
  To: Yang Zhang; +Cc: eddie.dong, JBeulich, jun.nakajima, xen-devel

On 19/12/13 02:40, Yang Zhang wrote:
> From: Yang Zhang <yang.z.zhang@Intel.com>
>
> With the feature of unrestricted guest, there should be no vmexit
> be triggered when guest accesses the cr3 in non-paging mode. This
> patch will clear the cr3 save/loading bit in vmcs control filed to
> eliminate cr3 access vmexit on UG avaliable hardware.
>
> The previous patch (commit c9efe34c119418a5ac776e5d91aeefcce4576518)
> did the same thing compare to this one. But it will cause guest fail
> to boot up on non-UG hardware which is repoted by Jan and it has been

"reported by"

> reverted (commit 1e2bf05ec37cf04b0e01585eae524509179f165e).
>
> This patch incorporate the fixing and guest are working well both in
> UG and non-UG platform with this patch.
>
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>

Looks plausible.

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

> ---
> changes in v3:
> Revise the patch description according Jan's suggestion
>
> changes in v2:
> Fix the guest boot failure on non-UG platform.
>
> There are some discussions around the first patch, please see the following link:
> http://www.gossamer-threads.com/lists/xen/devel/302810
>
> ---
>  xen/arch/x86/hvm/vmx/vmx.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index dfff628..f6409d6 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -1157,7 +1157,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
>              uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
>                                   CPU_BASED_CR3_STORE_EXITING);
>              v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
> -            if ( !hvm_paging_enabled(v) )
> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
>                  v->arch.hvm_vmx.exec_control |= cr3_ctls;
>  
>              /* Trap CR3 updates if CR3 memory events are enabled. */
> @@ -1231,7 +1231,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
>      case 3:
>          if ( paging_mode_hap(v->domain) )
>          {
> -            if ( !hvm_paging_enabled(v) )
> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
>                  v->arch.hvm_vcpu.hw_cr[3] =
>                      v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
>              vmx_load_pdptrs(v);
> @@ -2487,10 +2487,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
>  
>      hvm_invalidate_regs_fields(regs);
>  
> -    if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
> +    if ( paging_mode_hap(v->domain) )
>      {
>          __vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
> -        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
> +        if ( vmx_unrestricted_guest(v) || hvm_paging_enabled(v) )
> +            v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
>      }
>  
>      __vmread(VM_EXIT_REASON, &exit_reason);

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2013-12-19  2:40 [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled Yang Zhang
  2013-12-19  2:57 ` Zhang, Yang Z
  2013-12-19 14:33 ` Andrew Cooper
@ 2014-01-08  1:13 ` Zhang, Yang Z
  2014-01-08  2:19   ` Andrew Cooper
  2 siblings, 1 reply; 8+ messages in thread
From: Zhang, Yang Z @ 2014-01-08  1:13 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, Dong, Eddie, Nakajima, Jun, JBeulich

Zhang, Yang Z wrote on 2013-12-19:
> From: Yang Zhang <yang.z.zhang@Intel.com>
> 
> With the feature of unrestricted guest, there should be no vmexit be
> triggered when guest accesses the cr3 in non-paging mode. This patch
> will clear the cr3 save/loading bit in vmcs control filed to eliminate
> cr3 access vmexit on UG avaliable hardware.
> 
> The previous patch (commit c9efe34c119418a5ac776e5d91aeefcce4576518)
> did the same thing compare to this one. But it will cause guest fail
> to boot up on non-UG hardware which is repoted by Jan and it has been
> reverted (commit 1e2bf05ec37cf04b0e01585eae524509179f165e).
> 

Hi, Jun.

Can you help to review this patch?

> This patch incorporate the fixing and guest are working well both in
> UG and non-UG platform with this patch.
> 
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> ---
> changes in v3:
> Revise the patch description according Jan's suggestion
> 
> changes in v2:
> Fix the guest boot failure on non-UG platform.
> 
> There are some discussions around the first patch, please see the
> following link: http://www.gossamer-threads.com/lists/xen/devel/302810
> 
> ---
>  xen/arch/x86/hvm/vmx/vmx.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index dfff628..f6409d6 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++
> b/xen/arch/x86/hvm/vmx/vmx.c @@ -1157,7 +1157,7 @@ static void
> vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
>              uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
>                                   CPU_BASED_CR3_STORE_EXITING);
>              v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
> -            if ( !hvm_paging_enabled(v) )
> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v)
> + )
>                  v->arch.hvm_vmx.exec_control |= cr3_ctls;
>              /* Trap CR3 updates if CR3 memory events are enabled. */
> @@ -1231,7 +1231,7 @@ static void vmx_update_guest_cr(struct vcpu *v,
> unsigned int cr)
>      case 3:
>          if ( paging_mode_hap(v->domain) )
>          {
> -            if ( !hvm_paging_enabled(v) )
> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v)
> + )
>                  v->arch.hvm_vcpu.hw_cr[3] =
> v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
>              vmx_load_pdptrs(v);
> @@ -2487,10 +2487,11 @@ void vmx_vmexit_handler(struct cpu_user_regs
> *regs)
> 
>      hvm_invalidate_regs_fields(regs);
> -    if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
> +    if ( paging_mode_hap(v->domain) )
>      {
>          __vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
> -        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
> +        if ( vmx_unrestricted_guest(v) || hvm_paging_enabled(v) )
> +            v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
>      }
>      
>      __vmread(VM_EXIT_REASON, &exit_reason);


Best regards,
Yang

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2014-01-08  1:13 ` Zhang, Yang Z
@ 2014-01-08  2:19   ` Andrew Cooper
  2014-01-08  2:35     ` Zhang, Yang Z
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cooper @ 2014-01-08  2:19 UTC (permalink / raw)
  To: Zhang, Yang Z, xen-devel; +Cc: Dong, Eddie, Nakajima, Jun, JBeulich

On 08/01/2014 01:13, Zhang, Yang Z wrote:
> Zhang, Yang Z wrote on 2013-12-19:
>> From: Yang Zhang <yang.z.zhang@Intel.com>
>>
>> With the feature of unrestricted guest, there should be no vmexit be
>> triggered when guest accesses the cr3 in non-paging mode. This patch
>> will clear the cr3 save/loading bit in vmcs control filed to eliminate
>> cr3 access vmexit on UG avaliable hardware.
>>
>> The previous patch (commit c9efe34c119418a5ac776e5d91aeefcce4576518)
>> did the same thing compare to this one. But it will cause guest fail
>> to boot up on non-UG hardware which is repoted by Jan and it has been
>> reverted (commit 1e2bf05ec37cf04b0e01585eae524509179f165e).
>>
> Hi, Jun.
>
> Can you help to review this patch?

This got committed earlier today
http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=f4fed540e78ac8a2bd3b1dee53a5206dde25f613)
as you are a maintainer, and I (as an independent party as far as the
patch goes) reviewed it.

>
>> This patch incorporate the fixing and guest are working well both in
>> UG and non-UG platform with this patch.
>>
>> Reported-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
>> ---
>> changes in v3:
>> Revise the patch description according Jan's suggestion
>>
>> changes in v2:
>> Fix the guest boot failure on non-UG platform.
>>
>> There are some discussions around the first patch, please see the
>> following link: http://www.gossamer-threads.com/lists/xen/devel/302810
>>
>> ---
>>  xen/arch/x86/hvm/vmx/vmx.c |    9 +++++----
>>  1 files changed, 5 insertions(+), 4 deletions(-)
>> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
>> index dfff628..f6409d6 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++
>> b/xen/arch/x86/hvm/vmx/vmx.c @@ -1157,7 +1157,7 @@ static void
>> vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
>>              uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
>>                                   CPU_BASED_CR3_STORE_EXITING);
>>              v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
>> -            if ( !hvm_paging_enabled(v) )
>> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v)
>> + )
>>                  v->arch.hvm_vmx.exec_control |= cr3_ctls;
>>              /* Trap CR3 updates if CR3 memory events are enabled. */
>> @@ -1231,7 +1231,7 @@ static void vmx_update_guest_cr(struct vcpu *v,
>> unsigned int cr)
>>      case 3:
>>          if ( paging_mode_hap(v->domain) )
>>          {
>> -            if ( !hvm_paging_enabled(v) )
>> +            if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v)
>> + )
>>                  v->arch.hvm_vcpu.hw_cr[3] =
>> v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
>>              vmx_load_pdptrs(v);
>> @@ -2487,10 +2487,11 @@ void vmx_vmexit_handler(struct cpu_user_regs
>> *regs)
>>
>>      hvm_invalidate_regs_fields(regs);
>> -    if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
>> +    if ( paging_mode_hap(v->domain) )
>>      {
>>          __vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
>> -        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
>> +        if ( vmx_unrestricted_guest(v) || hvm_paging_enabled(v) )
>> +            v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
>>      }
>>      
>>      __vmread(VM_EXIT_REASON, &exit_reason);
>
> Best regards,
> Yang
>
>

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2014-01-08  2:19   ` Andrew Cooper
@ 2014-01-08  2:35     ` Zhang, Yang Z
  2014-01-08  8:42       ` Jan Beulich
  0 siblings, 1 reply; 8+ messages in thread
From: Zhang, Yang Z @ 2014-01-08  2:35 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel
  Cc: Keir Fraser, Dong, Eddie, Nakajima, Jun, JBeulich

Andrew Cooper wrote on 2014-01-08:
> On 08/01/2014 01:13, Zhang, Yang Z wrote:
>> Zhang, Yang Z wrote on 2013-12-19:
>>> From: Yang Zhang <yang.z.zhang@Intel.com>
>>> 
>>> With the feature of unrestricted guest, there should be no vmexit
>>> be triggered when guest accesses the cr3 in non-paging mode. This
>>> patch will clear the cr3 save/loading bit in vmcs control filed to
>>> eliminate
>>> cr3 access vmexit on UG avaliable hardware.
>>> 
>>> The previous patch (commit c9efe34c119418a5ac776e5d91aeefcce4576518)
>>> did the same thing compare to this one. But it will cause guest fail
>>> to boot up on non-UG hardware which is repoted by Jan and it has been
>>> reverted (commit 1e2bf05ec37cf04b0e01585eae524509179f165e).
>>> 
>> Hi, Jun.
>> 
>> Can you help to review this patch?
> 
> This got committed earlier today
> http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=f4fed540e78ac8
> a2b d3b1dee53a5206dde25f613) as you are a maintainer, and I (as an
> independent party as far as the patch goes) reviewed it.

I remember in old day, after a patch got committed, the maintainer will reply the mail to tell the author it is applied. Or else, it's hard for author to know it in time. Should we still follow this rule?

BTW: KVM always follow this rule.

> 
>> 
>>> This patch incorporate the fixing and guest are working well both
>>> in UG and non-UG platform with this patch.
>>> 
>>> Reported-by: Jan Beulich <jbeulich@suse.com>
>>> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
>>> ---
>>> changes in v3:
>>> Revise the patch description according Jan's suggestion
>>> 
>>> changes in v2:
>>> Fix the guest boot failure on non-UG platform.
>>> 
>>> There are some discussions around the first patch, please see the
>>> following link:
>>> http://www.gossamer-threads.com/lists/xen/devel/302810
>>> 
>>> ---
>>>  xen/arch/x86/hvm/vmx/vmx.c |    9 +++++----
>>>  1 files changed, 5 insertions(+), 4 deletions(-) diff --git
>>> a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index
>>> dfff628..f6409d6 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++
>>> b/xen/arch/x86/hvm/vmx/vmx.c @@ -1157,7 +1157,7 @@ static void
>>> vmx_update_guest_cr(struct vcpu *v, unsigned int cr)
>>>              uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
> CPU_BASED_CR3_STORE_EXITING);
>>>              v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
>>> -            if ( !hvm_paging_enabled(v) )
>>> +            if ( !hvm_paging_enabled(v) &&
>>> + !vmx_unrestricted_guest(v)
>>> + )
>>>                  v->arch.hvm_vmx.exec_control |= cr3_ctls;
>>>              /* Trap CR3 updates if CR3 memory events are enabled.
>>> */ @@ -1231,7 +1231,7 @@ static void vmx_update_guest_cr(struct
>>> vcpu *v, unsigned int cr)
>>>      case 3:
>>>          if ( paging_mode_hap(v->domain) )
>>>          {
>>> -            if ( !hvm_paging_enabled(v) )
>>> +            if ( !hvm_paging_enabled(v) &&
>>> + !vmx_unrestricted_guest(v)
>>> + )
>>>                  v->arch.hvm_vcpu.hw_cr[3] =
>>> v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
>>>              vmx_load_pdptrs(v);
>>> @@ -2487,10 +2487,11 @@ void vmx_vmexit_handler(struct cpu_user_regs
>>> *regs)
>>> 
>>>      hvm_invalidate_regs_fields(regs);
>>> -    if ( paging_mode_hap(v->domain) && hvm_paging_enabled(v) )
>>> +    if ( paging_mode_hap(v->domain) )
>>>      {
>>>          __vmread(GUEST_CR3, &v->arch.hvm_vcpu.hw_cr[3]);
>>> -        v->arch.hvm_vcpu.guest_cr[3] = v->arch.hvm_vcpu.hw_cr[3];
>>> +        if ( vmx_unrestricted_guest(v) || hvm_paging_enabled(v) )
>>> +            v->arch.hvm_vcpu.guest_cr[3] =
>>> + v->arch.hvm_vcpu.hw_cr[3];
>>>      }
>>>      
>>>      __vmread(VM_EXIT_REASON, &exit_reason);
>> 
>> Best regards,
>> Yang
>> 
>>


Best regards,
Yang

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2014-01-08  2:35     ` Zhang, Yang Z
@ 2014-01-08  8:42       ` Jan Beulich
  2014-01-14  4:52         ` Zhang, Yang Z
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2014-01-08  8:42 UTC (permalink / raw)
  To: Yang Z Zhang
  Cc: Andrew Cooper, Keir Fraser, Eddie Dong, Jun Nakajima, xen-devel

>>> On 08.01.14 at 03:35, "Zhang, Yang Z" <yang.z.zhang@intel.com> wrote:
> Andrew Cooper wrote on 2014-01-08:
>> On 08/01/2014 01:13, Zhang, Yang Z wrote:
>>> Can you help to review this patch?
>> 
>> This got committed earlier today
>> http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=f4fed540e78ac8 
>> a2b d3b1dee53a5206dde25f613) as you are a maintainer, and I (as an
>> independent party as far as the patch goes) reviewed it.
> 
> I remember in old day, after a patch got committed, the maintainer will 
> reply the mail to tell the author it is applied. Or else, it's hard for 
> author to know it in time. Should we still follow this rule?

As it requires extra work, and it's easy to check the tree (there
aren't that many commits during a day), and there are generally
no intermediate trees (i.e. just a single canonical one to look at),
I never reply with commit notifications. If anything like that is
being wanted, then this should be via an automatic commit
notification mechanism (and ISTR that there is a respective list
you could subscribe to).

Jan

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

* Re: [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled
  2014-01-08  8:42       ` Jan Beulich
@ 2014-01-14  4:52         ` Zhang, Yang Z
  0 siblings, 0 replies; 8+ messages in thread
From: Zhang, Yang Z @ 2014-01-14  4:52 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, Keir Fraser, Dong, Eddie, Nakajima, Jun, xen-devel

Jan Beulich wrote on 2014-01-08:
>>>> On 08.01.14 at 03:35, "Zhang, Yang Z" <yang.z.zhang@intel.com> wrote:
>> Andrew Cooper wrote on 2014-01-08:
>>> On 08/01/2014 01:13, Zhang, Yang Z wrote:
>>>> Can you help to review this patch?
>>> 
>>> This got committed earlier today
>>> http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=f4fed540e78
>>> ac
>>> 8 a2b d3b1dee53a5206dde25f613) as you are a maintainer, and I (as
>>> an independent party as far as the patch goes) reviewed it.
>> 
>> I remember in old day, after a patch got committed, the maintainer
>> will reply the mail to tell the author it is applied. Or else, it's
>> hard for author to know it in time. Should we still follow this rule?
> 
> As it requires extra work, and it's easy to check the tree (there
> aren't that many commits during a day), and there are generally no intermediate trees (i.e.
> just a single canonical one to look at), I never reply with commit
> notifications. If anything like that is being wanted, then this should
> be via an automatic commit notification mechanism (and ISTR that there
> is a respective list you could subscribe to).
> 

Yes, I should subscribe Xen change log list to track the committed patch. It can solve my concern.

> Jan


Best regards,
Yang

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

end of thread, other threads:[~2014-01-14  4:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-19  2:40 [PATCH v3] VMX: Eliminate cr3 save/loading exiting when UG enabled Yang Zhang
2013-12-19  2:57 ` Zhang, Yang Z
2013-12-19 14:33 ` Andrew Cooper
2014-01-08  1:13 ` Zhang, Yang Z
2014-01-08  2:19   ` Andrew Cooper
2014-01-08  2:35     ` Zhang, Yang Z
2014-01-08  8:42       ` Jan Beulich
2014-01-14  4:52         ` Zhang, Yang Z

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.