public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]  kvm: correct comment description issue
@ 2022-02-18 11:05 Peng Hao
  2022-02-18 16:04 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Peng Hao @ 2022-02-18 11:05 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, linux-kernel

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

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 arch/x86/kvm/vmx/vmx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 7dce746c175f..0ffcfe54eea5 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -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


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

* Re: [PATCH]  kvm: correct comment description issue
  2022-02-18 11:05 [PATCH] kvm: correct comment description issue Peng Hao
@ 2022-02-18 16:04 ` Sean Christopherson
  2022-02-22  2:34   ` Hao Peng
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2022-02-18 16:04 UTC (permalink / raw)
  To: Peng Hao; +Cc: pbonzini, kvm, linux-kernel

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

On Fri, Feb 18, 2022, Peng Hao wrote:
> 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),

Reviewed-by: Sean Christopherson <seanjc@google.com>

> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 7dce746c175f..0ffcfe54eea5 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -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
> 

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

* Re: [PATCH] kvm: correct comment description issue
  2022-02-18 16:04 ` Sean Christopherson
@ 2022-02-22  2:34   ` Hao Peng
  0 siblings, 0 replies; 3+ messages in thread
From: Hao Peng @ 2022-02-22  2:34 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: pbonzini, kvm, linux-kernel

On Sat, Feb 19, 2022 at 12:04 AM Sean Christopherson <seanjc@google.com> wrote:
>
> "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.
>
> On Fri, Feb 18, 2022, Peng Hao wrote:
> > 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),
>
Thanks for the suggestions for these patches, I will send again.

> Reviewed-by: Sean Christopherson <seanjc@google.com>
>
> > Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> > ---
> >  arch/x86/kvm/vmx/vmx.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index 7dce746c175f..0ffcfe54eea5 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -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
> >

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

end of thread, other threads:[~2022-02-22  2:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-18 11:05 [PATCH] kvm: correct comment description issue Peng Hao
2022-02-18 16:04 ` Sean Christopherson
2022-02-22  2:34   ` Hao Peng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox