All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
@ 2020-02-04 15:32 Sean Christopherson
  2020-02-04 16:15 ` Vitaly Kuznetsov
  2020-02-04 19:57 ` Krish Sadhukhan
  0 siblings, 2 replies; 7+ messages in thread
From: Sean Christopherson @ 2020-02-04 15:32 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel

The blurb pertaining to the return value of nested_vmx_load_cr3() no
longer matches reality, remove it entirely as the behavior it is
attempting to document is quite obvious when reading the actual code.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/vmx/nested.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 7608924ee8c1..0c9b847f7a25 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -1076,8 +1076,6 @@ static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val)
 /*
  * Load guest's/host's cr3 at nested entry/exit. nested_ept is true if we are
  * emulating VM entry into a guest with EPT enabled.
- * Returns 0 on success, 1 on failure. Invalid state exit qualification code
- * is assigned to entry_failure_code on failure.
  */
 static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool nested_ept,
 			       u32 *entry_failure_code)
-- 
2.24.1


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

* Re: [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
  2020-02-04 15:32 [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3() Sean Christopherson
@ 2020-02-04 16:15 ` Vitaly Kuznetsov
  2020-02-04 19:57 ` Krish Sadhukhan
  1 sibling, 0 replies; 7+ messages in thread
From: Vitaly Kuznetsov @ 2020-02-04 16:15 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Wanpeng Li, Jim Mattson, Joerg Roedel, kvm, linux-kernel, Paolo Bonzini

Sean Christopherson <sean.j.christopherson@intel.com> writes:

> The blurb pertaining to the return value of nested_vmx_load_cr3() no
> longer matches reality, remove it entirely as the behavior it is
> attempting to document is quite obvious when reading the actual code.

"And if it doesn't seem that obvious just try staring at it for a few
years, do some small (60-70 patches) refactorings and fix several dozens
of bugs. It will." :-)

>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 7608924ee8c1..0c9b847f7a25 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1076,8 +1076,6 @@ static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val)
>  /*
>   * Load guest's/host's cr3 at nested entry/exit. nested_ept is true if we are
>   * emulating VM entry into a guest with EPT enabled.
> - * Returns 0 on success, 1 on failure. Invalid state exit qualification code
> - * is assigned to entry_failure_code on failure.
>   */
>  static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool nested_ept,
>  			       u32 *entry_failure_code)

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


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

* Re: [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
  2020-02-04 15:32 [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3() Sean Christopherson
  2020-02-04 16:15 ` Vitaly Kuznetsov
@ 2020-02-04 19:57 ` Krish Sadhukhan
  2020-02-04 20:36   ` Sean Christopherson
  1 sibling, 1 reply; 7+ messages in thread
From: Krish Sadhukhan @ 2020-02-04 19:57 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini
  Cc: Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel, kvm,
	linux-kernel


On 2/4/20 7:32 AM, Sean Christopherson wrote:
> The blurb pertaining to the return value of nested_vmx_load_cr3() no
> longer matches reality, remove it entirely as the behavior it is
> attempting to document is quite obvious when reading the actual code.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>   arch/x86/kvm/vmx/nested.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 7608924ee8c1..0c9b847f7a25 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1076,8 +1076,6 @@ static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val)
>   /*
>    * Load guest's/host's cr3 at nested entry/exit. nested_ept is true if we are
>    * emulating VM entry into a guest with EPT enabled.
> - * Returns 0 on success, 1 on failure. Invalid state exit qualification code
> - * is assigned to entry_failure_code on failure.
>    */
>   static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool nested_ept,
>   			       u32 *entry_failure_code)

I think it's worth keeping the last part which is " Exit qualification 
code is assigned to entry_failure_code on failure." because "Entry 
Failure" and "Exit Qualification" might sound bit confusing until you 
actually look at the caller nested_vmx_enter_non_root_mode().


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

* Re: [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
  2020-02-04 19:57 ` Krish Sadhukhan
@ 2020-02-04 20:36   ` Sean Christopherson
  2020-02-04 22:01     ` Krish Sadhukhan
  0 siblings, 1 reply; 7+ messages in thread
From: Sean Christopherson @ 2020-02-04 20:36 UTC (permalink / raw)
  To: Krish Sadhukhan
  Cc: Paolo Bonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel

On Tue, Feb 04, 2020 at 11:57:39AM -0800, Krish Sadhukhan wrote:
> 
> On 2/4/20 7:32 AM, Sean Christopherson wrote:
> >The blurb pertaining to the return value of nested_vmx_load_cr3() no
> >longer matches reality, remove it entirely as the behavior it is
> >attempting to document is quite obvious when reading the actual code.
> >
> >Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> >---
> >  arch/x86/kvm/vmx/nested.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> >diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> >index 7608924ee8c1..0c9b847f7a25 100644
> >--- a/arch/x86/kvm/vmx/nested.c
> >+++ b/arch/x86/kvm/vmx/nested.c
> >@@ -1076,8 +1076,6 @@ static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val)
> >  /*
> >   * Load guest's/host's cr3 at nested entry/exit. nested_ept is true if we are
> >   * emulating VM entry into a guest with EPT enabled.
> >- * Returns 0 on success, 1 on failure. Invalid state exit qualification code
> >- * is assigned to entry_failure_code on failure.
> >   */
> >  static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool nested_ept,
> >  			       u32 *entry_failure_code)
> 
> I think it's worth keeping the last part which is " Exit qualification code
> is assigned to entry_failure_code on failure." because "Entry Failure" and
> "Exit Qualification" might sound bit confusing until you actually look at
> the caller nested_vmx_enter_non_root_mode().

Hmm, something like this?

/*
 * Load guest's/host's cr3 at nested entry/exit.  @nested_ept is true if we are
 * emulating VM-Entry into a guest with EPT enabled.  On failure, the expected
 * Exit Qualification (for a VM-Entry consistency check VM-Exit) is assigned to
 * @entry_failure_code.
 */

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

* Re: [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
  2020-02-04 20:36   ` Sean Christopherson
@ 2020-02-04 22:01     ` Krish Sadhukhan
  2020-02-05 14:31       ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Krish Sadhukhan @ 2020-02-04 22:01 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Paolo Bonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel



On 02/04/2020 12:36 PM, Sean Christopherson wrote:
> On Tue, Feb 04, 2020 at 11:57:39AM -0800, Krish Sadhukhan wrote:
>> On 2/4/20 7:32 AM, Sean Christopherson wrote:
>>> The blurb pertaining to the return value of nested_vmx_load_cr3() no
>>> longer matches reality, remove it entirely as the behavior it is
>>> attempting to document is quite obvious when reading the actual code.
>>>
>>> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>>> ---
>>>   arch/x86/kvm/vmx/nested.c | 2 --
>>>   1 file changed, 2 deletions(-)
>>>
>>> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
>>> index 7608924ee8c1..0c9b847f7a25 100644
>>> --- a/arch/x86/kvm/vmx/nested.c
>>> +++ b/arch/x86/kvm/vmx/nested.c
>>> @@ -1076,8 +1076,6 @@ static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val)
>>>   /*
>>>    * Load guest's/host's cr3 at nested entry/exit. nested_ept is true if we are
>>>    * emulating VM entry into a guest with EPT enabled.
>>> - * Returns 0 on success, 1 on failure. Invalid state exit qualification code
>>> - * is assigned to entry_failure_code on failure.
>>>    */
>>>   static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool nested_ept,
>>>   			       u32 *entry_failure_code)
>> I think it's worth keeping the last part which is " Exit qualification code
>> is assigned to entry_failure_code on failure." because "Entry Failure" and
>> "Exit Qualification" might sound bit confusing until you actually look at
>> the caller nested_vmx_enter_non_root_mode().
> Hmm, something like this?
>
> /*
>   * Load guest's/host's cr3 at nested entry/exit.  @nested_ept is true if we are
>   * emulating VM-Entry into a guest with EPT enabled.  On failure, the expected
>   * Exit Qualification (for a VM-Entry consistency check VM-Exit) is assigned to
>   * @entry_failure_code.
>   */
It  works.

With that,

Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>

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

* Re: [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
  2020-02-04 22:01     ` Krish Sadhukhan
@ 2020-02-05 14:31       ` Paolo Bonzini
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2020-02-05 14:31 UTC (permalink / raw)
  To: Krish Sadhukhan, Sean Christopherson
  Cc: Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel, kvm,
	linux-kernel

On 04/02/20 23:01, Krish Sadhukhan wrote:
>>
>> /*
>>   * Load guest's/host's cr3 at nested entry/exit.  @nested_ept is true
>> if we are
>>   * emulating VM-Entry into a guest with EPT enabled.  On failure, the
>> expected
>>   * Exit Qualification (for a VM-Entry consistency check VM-Exit) is
>> assigned to
>>   * @entry_failure_code.
>>   */
> It  works.
> 
> With that,
> 
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>

Thanks, I folded in the change.

Paolo


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

* Re: [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()
@ 2020-02-05  1:57 linmiaohe
  0 siblings, 0 replies; 7+ messages in thread
From: linmiaohe @ 2020-02-05  1:57 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Paolo Bonzini, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel

Sean Christopherson <sean.j.christopherson@intel.com> writes:
> The blurb pertaining to the return value of nested_vmx_load_cr3() no longer matches reality, remove it entirely as the behavior it is attempting to document is quite obvious when reading the actual code.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> - * Returns 0 on success, 1 on failure. Invalid state exit qualification code
> - * is assigned to entry_failure_code on failure.
>  */
> static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool nested_ept,
> 			       u32 *entry_failure_code)

It seems the comment is uncorrect as it return -EINVAL on failure. Thanks.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>


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

end of thread, other threads:[~2020-02-05 14:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 15:32 [PATCH] KVM: nVMX: Remove stale comment from nested_vmx_load_cr3() Sean Christopherson
2020-02-04 16:15 ` Vitaly Kuznetsov
2020-02-04 19:57 ` Krish Sadhukhan
2020-02-04 20:36   ` Sean Christopherson
2020-02-04 22:01     ` Krish Sadhukhan
2020-02-05 14:31       ` Paolo Bonzini
2020-02-05  1:57 linmiaohe

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.