Skip to contentSkip to conversation

KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()

PATCH In review Sean Christopherson 4 participants 6 messages Feb 4, 2020 – Feb 5, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: nVMX: Remove stale comment from nested_vmx_load_cr3()

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.

---
 arch/x86/kvm/vmx/nested.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -2
index 7608924ee8c1..0c9b847f7a25 100644
@@ -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)
Signature · 1 line
2.24.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Sean Christopherson

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." :-)

Quoted 11 lines
---
 arch/x86/kvm/vmx/nested.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -0
index 7608924ee8c1..0c9b847f7a25 100644

arch/x86/kvm/vmx/nested.c static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val) · line 1081

Quoted 8 lines
arch/x86/kvm/vmx/nested.c +0 -2
@@ -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)
Signature · 1 line
Vitaly
#2 lore raw
In reply to Sean Christopherson
Quoted 14 lines · Sean Christopherson

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.

---
  arch/x86/kvm/vmx/nested.c | 2 --
  1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -0
index 7608924ee8c1..0c9b847f7a25 100644

arch/x86/kvm/vmx/nested.c static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val) · line 1081

Quoted 8 lines
arch/x86/kvm/vmx/nested.c +0 -2
@@ -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().

#3 lore raw
Quoted 21 lines · Krish Sadhukhan
Quoted 19 lines · Sean Christopherson

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.

---
 arch/x86/kvm/vmx/nested.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -2
index 7608924ee8c1..0c9b847f7a25 100644
@@ -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.
Quoted 8 lines

arch/x86/kvm/vmx/nested.c static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val) · line 1081

Quoted 3 lines
arch/x86/kvm/vmx/nested.c +0 -0
  */
 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.
*/

Reviewed-by
#4 lore raw
Quoted 28 lines · Sean Christopherson
Quoted 19 lines · Krish Sadhukhan
Quoted 18 lines · Sean Christopherson

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.

---
  arch/x86/kvm/vmx/nested.c | 2 --
  1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/nested.c +0 -1
index 7608924ee8c1..0c9b847f7a25 100644
@@ -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
Quoted 8 lines

arch/x86/kvm/vmx/nested.c static bool nested_cr3_valid(struct kvm_vcpu *vcpu, unsigned long val) · line 1081

Quoted 4 lines
arch/x86/kvm/vmx/nested.c +0 -1
- * 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().

Quoted 8 lines

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,

maintainer
#5 lore raw
Quoted 10 lines · Krish Sadhukhan
Quoted 10 lines

/*
  * 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.
  */

Quoted 5 lines

It  works.

With that,

Thanks, I folded in the change.

Paolo