Skip to contentSkip to conversation

kvm: correct comment description issue

PATCH In review Peng Hao 2 participants 3 messages Feb 18, 2022 – Feb 22, 2022

Subsystems (3)
lore
Share & tools
lore

Peng Hao

author
#0 lore raw

PATCH 1/1 kvm: correct comment description issue

loaded_vmcs does not have this field 'vcpu', modify this comment.

---
 arch/x86/kvm/vmx/vmx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx/vmx.c +4 -4
index 7dce746c175f..0ffcfe54eea5 100644
@@ -644,10 +644,10 @@ static void __loaded_vmcs_clear(void *arg)
 
 	/*
 	 * Ensure all writes to loaded_vmcs, including deleting it from its
-	 * current percpu list, complete before setting loaded_vmcs->vcpu to
-	 * -1, otherwise a different cpu can see vcpu == -1 first and add
-	 * loaded_vmcs to its percpu list before it's deleted from this cpu's
-	 * list. Pairs with the smp_rmb() in vmx_vcpu_load_vmcs().
+	 * current percpu list, complete before setting loaded_vmcs->cpu to
+	 * -1, otherwise a different cpu can see loaded_vmcs->cpu == -1 first
+	 * and add loaded_vmcs to its percpu list before it's deleted from this
+	 * cpu's list. Pairs with the smp_rmb() in vmx_vcpu_load_vmcs().
 	 */
 	smp_wmb();
 
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

"KVM: VMX:" for the scope. A more specific shortlog would also be helfpul, stating that a comment is being modified doesn't provide any info about what comment.

Quoted 1 line · Peng Hao

loaded_vmcs does not have this field 'vcpu', modify this comment.

It would be helpful to state that loaded_vmcs has 'cpu', not 'vcpu'. It's hard to identify what's being changed.

Something like this?

KVM: VMX: Fix typos above smp_wmb() comment in __loaded_vmcs_clear()

Fix a comment documenting the memory barrier related to clearing a loaded_vmcs; loaded_vmcs tracks the host CPU the VMCS is loaded on via the field 'cpu', it doesn't have a 'vcpu' field.

With a tweaked shortlog/changelog (doesn't have to be exactly the above),

Quoted 27 lines
---
 arch/x86/kvm/vmx/vmx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx/vmx.c +4 -4
index 7dce746c175f..0ffcfe54eea5 100644
@@ -644,10 +644,10 @@ static void __loaded_vmcs_clear(void *arg)
 
 	/*
 	 * Ensure all writes to loaded_vmcs, including deleting it from its
-	 * current percpu list, complete before setting loaded_vmcs->vcpu to
-	 * -1, otherwise a different cpu can see vcpu == -1 first and add
-	 * loaded_vmcs to its percpu list before it's deleted from this cpu's
-	 * list. Pairs with the smp_rmb() in vmx_vcpu_load_vmcs().
+	 * current percpu list, complete before setting loaded_vmcs->cpu to
+	 * -1, otherwise a different cpu can see loaded_vmcs->cpu == -1 first
+	 * and add loaded_vmcs to its percpu list before it's deleted from this
+	 * cpu's list. Pairs with the smp_rmb() in vmx_vcpu_load_vmcs().
 	 */
 	smp_wmb();
 
Signature · 1 line
2.27.0
author
#2 lore raw
Quoted 13 lines · Sean Christopherson

"KVM: VMX:" for the scope. A more specific shortlog would also be helfpul, stating that a comment is being modified doesn't provide any info about what comment.

Quoted 1 line · Peng Hao

loaded_vmcs does not have this field 'vcpu', modify this comment.

It would be helpful to state that loaded_vmcs has 'cpu', not 'vcpu'. It's hard to identify what's being changed.

Something like this?

Quoted 8 lines

KVM: VMX: Fix typos above smp_wmb() comment in __loaded_vmcs_clear()

Fix a comment documenting the memory barrier related to clearing a loaded_vmcs; loaded_vmcs tracks the host CPU the VMCS is loaded on via the field 'cpu', it doesn't have a 'vcpu' field.

With a tweaked shortlog/changelog (doesn't have to be exactly the above),

Thanks for the suggestions for these patches, I will send again.

Quoted 29 lines
Quoted 27 lines
---
 arch/x86/kvm/vmx/vmx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx/vmx.c +4 -5
index 7dce746c175f..0ffcfe54eea5 100644
@@ -644,10 +644,10 @@ static void __loaded_vmcs_clear(void *arg)
 
      /*
       * Ensure all writes to loaded_vmcs, including deleting it from its
-      * current percpu list, complete before setting loaded_vmcs->vcpu to
-      * -1, otherwise a different cpu can see vcpu == -1 first and add
-      * loaded_vmcs to its percpu list before it's deleted from this cpu's
-      * list. Pairs with the smp_rmb() in vmx_vcpu_load_vmcs().
+      * current percpu list, complete before setting loaded_vmcs->cpu to
+      * -1, otherwise a different cpu can see loaded_vmcs->cpu == -1 first
+      * and add loaded_vmcs to its percpu list before it's deleted from this
+      * cpu's list. Pairs with the smp_rmb() in vmx_vcpu_load_vmcs().
       */
      smp_wmb();
 
--

2.27.0