All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
@ 2022-08-31 14:31 cgel.zte
  2022-08-31 16:17 ` Jim Mattson
  2022-09-22 18:45 ` Shuah Khan
  0 siblings, 2 replies; 6+ messages in thread
From: cgel.zte @ 2022-08-31 14:31 UTC (permalink / raw)
  To: pbonzini, shuah, seanjc
  Cc: dmatlack, jmattson, peterx, oupton, kvm, linux-kselftest,
	linux-kernel, Jinpeng Cui, Zeal Robot

From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>

Return value directly from expression instead of
getting value from redundant variable tsc_val.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
---
 tools/testing/selftests/kvm/include/x86_64/processor.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
index 0cbc71b7af50..75920678f34d 100644
--- a/tools/testing/selftests/kvm/include/x86_64/processor.h
+++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
@@ -237,7 +237,6 @@ static inline uint64_t get_desc64_base(const struct desc64 *desc)
 static inline uint64_t rdtsc(void)
 {
 	uint32_t eax, edx;
-	uint64_t tsc_val;
 	/*
 	 * The lfence is to wait (on Intel CPUs) until all previous
 	 * instructions have been executed. If software requires RDTSC to be
@@ -245,8 +244,8 @@ static inline uint64_t rdtsc(void)
 	 * execute LFENCE immediately after RDTSC
 	 */
 	__asm__ __volatile__("lfence; rdtsc; lfence" : "=a"(eax), "=d"(edx));
-	tsc_val = ((uint64_t)edx) << 32 | eax;
-	return tsc_val;
+
+	return ((uint64_t)edx) << 32 | eax;
 }
 
 static inline uint64_t rdtscp(uint32_t *aux)
-- 
2.25.1


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

* Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
  2022-08-31 14:31 [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val cgel.zte
@ 2022-08-31 16:17 ` Jim Mattson
  2022-09-20 19:30   ` Sean Christopherson
  2022-09-22 18:45 ` Shuah Khan
  1 sibling, 1 reply; 6+ messages in thread
From: Jim Mattson @ 2022-08-31 16:17 UTC (permalink / raw)
  To: cgel.zte
  Cc: pbonzini, shuah, seanjc, dmatlack, peterx, oupton, kvm,
	linux-kselftest, linux-kernel, Jinpeng Cui, Zeal Robot

On Wed, Aug 31, 2022 at 7:31 AM <cgel.zte@gmail.com> wrote:
>
> From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
>
> Return value directly from expression instead of
> getting value from redundant variable tsc_val.

Nit: I think you mean 'superfluous' rather than 'redundant'?

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> ---
>  tools/testing/selftests/kvm/include/x86_64/processor.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index 0cbc71b7af50..75920678f34d 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> @@ -237,7 +237,6 @@ static inline uint64_t get_desc64_base(const struct desc64 *desc)
>  static inline uint64_t rdtsc(void)
>  {
>         uint32_t eax, edx;
> -       uint64_t tsc_val;
>         /*
>          * The lfence is to wait (on Intel CPUs) until all previous
>          * instructions have been executed. If software requires RDTSC to be
> @@ -245,8 +244,8 @@ static inline uint64_t rdtsc(void)
>          * execute LFENCE immediately after RDTSC
>          */
>         __asm__ __volatile__("lfence; rdtsc; lfence" : "=a"(eax), "=d"(edx));
> -       tsc_val = ((uint64_t)edx) << 32 | eax;
> -       return tsc_val;
> +
> +       return ((uint64_t)edx) << 32 | eax;
>  }

This does beg the question: "Why?"

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

* Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
  2022-08-31 16:17 ` Jim Mattson
@ 2022-09-20 19:30   ` Sean Christopherson
  0 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2022-09-20 19:30 UTC (permalink / raw)
  To: Jim Mattson
  Cc: cgel.zte, pbonzini, shuah, dmatlack, peterx, oupton, kvm,
	linux-kselftest, linux-kernel, Jinpeng Cui, Zeal Robot

On Wed, Aug 31, 2022, Jim Mattson wrote:
> On Wed, Aug 31, 2022 at 7:31 AM <cgel.zte@gmail.com> wrote:
> > diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> > index 0cbc71b7af50..75920678f34d 100644
> > --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> > +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> > @@ -237,7 +237,6 @@ static inline uint64_t get_desc64_base(const struct desc64 *desc)
> >  static inline uint64_t rdtsc(void)
> >  {
> >         uint32_t eax, edx;
> > -       uint64_t tsc_val;
> >         /*
> >          * The lfence is to wait (on Intel CPUs) until all previous
> >          * instructions have been executed. If software requires RDTSC to be
> > @@ -245,8 +244,8 @@ static inline uint64_t rdtsc(void)
> >          * execute LFENCE immediately after RDTSC
> >          */
> >         __asm__ __volatile__("lfence; rdtsc; lfence" : "=a"(eax), "=d"(edx));
> > -       tsc_val = ((uint64_t)edx) << 32 | eax;
> > -       return tsc_val;
> > +
> > +       return ((uint64_t)edx) << 32 | eax;
> >  }
> 
> This does beg the question: "Why?"

Yeah, for this one I think having a local variable adds value.

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

* Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
  2022-08-31 14:31 [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val cgel.zte
  2022-08-31 16:17 ` Jim Mattson
@ 2022-09-22 18:45 ` Shuah Khan
  2022-09-22 19:41   ` Sean Christopherson
  2022-09-23  6:28   ` Greg Kroah-Hartman
  1 sibling, 2 replies; 6+ messages in thread
From: Shuah Khan @ 2022-09-22 18:45 UTC (permalink / raw)
  To: cgel.zte, pbonzini, shuah, seanjc, Greg Kroah-Hartman
  Cc: dmatlack, jmattson, peterx, oupton, kvm, linux-kselftest,
	linux-kernel, Jinpeng Cui, Zeal Robot

On 8/31/22 08:31, cgel.zte@gmail.com wrote:
> From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> 
> Return value directly from expression instead of
> getting value from redundant variable tsc_val.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> ---
>   tools/testing/selftests/kvm/include/x86_64/processor.h | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index 0cbc71b7af50..75920678f34d 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> @@ -237,7 +237,6 @@ static inline uint64_t get_desc64_base(const struct desc64 *desc)
>   static inline uint64_t rdtsc(void)
>   {
>   	uint32_t eax, edx;
> -	uint64_t tsc_val;
>   	/*
>   	 * The lfence is to wait (on Intel CPUs) until all previous
>   	 * instructions have been executed. If software requires RDTSC to be
> @@ -245,8 +244,8 @@ static inline uint64_t rdtsc(void)
>   	 * execute LFENCE immediately after RDTSC
>   	 */
>   	__asm__ __volatile__("lfence; rdtsc; lfence" : "=a"(eax), "=d"(edx));
> -	tsc_val = ((uint64_t)edx) << 32 | eax;
> -	return tsc_val;
> +
> +	return ((uint64_t)edx) << 32 | eax;
>   }
>   
>   static inline uint64_t rdtscp(uint32_t *aux)

My understanding is that this patch isn't coming from individuals that work
for ZTE. We won't be able to accept these patches. Refer to the following
for reasons why we can't accept these patches.

https://patchwork.kernel.org/project/linux-kselftest/patch/20220920063202.215088-1-ye.xingchen@zte.com.cn/

thanks,
-- Shuah

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

* Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
  2022-09-22 18:45 ` Shuah Khan
@ 2022-09-22 19:41   ` Sean Christopherson
  2022-09-23  6:28   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2022-09-22 19:41 UTC (permalink / raw)
  To: Shuah Khan
  Cc: cgel.zte, pbonzini, shuah, Greg Kroah-Hartman, dmatlack,
	jmattson, peterx, oupton, kvm, linux-kselftest, linux-kernel,
	Jinpeng Cui, Zeal Robot

On Thu, Sep 22, 2022, Shuah Khan wrote:
> On 8/31/22 08:31, cgel.zte@gmail.com wrote:
> > From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> > 
> > Return value directly from expression instead of
> > getting value from redundant variable tsc_val.
> > 
> > Reported-by: Zeal Robot <zealci@zte.com.cn>
> > Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> > ---

...

> My understanding is that this patch isn't coming from individuals that work
> for ZTE. We won't be able to accept these patches. Refer to the following
> for reasons why we can't accept these patches.

Ouch.  Thanks much for the heads up!

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

* Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
  2022-09-22 18:45 ` Shuah Khan
  2022-09-22 19:41   ` Sean Christopherson
@ 2022-09-23  6:28   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2022-09-23  6:28 UTC (permalink / raw)
  To: Shuah Khan
  Cc: cgel.zte, pbonzini, shuah, seanjc, dmatlack, jmattson, peterx,
	oupton, kvm, linux-kselftest, linux-kernel, Jinpeng Cui,
	Zeal Robot

On Thu, Sep 22, 2022 at 12:45:22PM -0600, Shuah Khan wrote:
> On 8/31/22 08:31, cgel.zte@gmail.com wrote:
> > From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> > 
> > Return value directly from expression instead of
> > getting value from redundant variable tsc_val.
> > 
> > Reported-by: Zeal Robot <zealci@zte.com.cn>
> > Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> > ---
> >   tools/testing/selftests/kvm/include/x86_64/processor.h | 5 ++---
> >   1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> > index 0cbc71b7af50..75920678f34d 100644
> > --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> > +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> > @@ -237,7 +237,6 @@ static inline uint64_t get_desc64_base(const struct desc64 *desc)
> >   static inline uint64_t rdtsc(void)
> >   {
> >   	uint32_t eax, edx;
> > -	uint64_t tsc_val;
> >   	/*
> >   	 * The lfence is to wait (on Intel CPUs) until all previous
> >   	 * instructions have been executed. If software requires RDTSC to be
> > @@ -245,8 +244,8 @@ static inline uint64_t rdtsc(void)
> >   	 * execute LFENCE immediately after RDTSC
> >   	 */
> >   	__asm__ __volatile__("lfence; rdtsc; lfence" : "=a"(eax), "=d"(edx));
> > -	tsc_val = ((uint64_t)edx) << 32 | eax;
> > -	return tsc_val;
> > +
> > +	return ((uint64_t)edx) << 32 | eax;
> >   }
> >   static inline uint64_t rdtscp(uint32_t *aux)
> 
> My understanding is that this patch isn't coming from individuals that work
> for ZTE. We won't be able to accept these patches. Refer to the following
> for reasons why we can't accept these patches.
> 
> https://patchwork.kernel.org/project/linux-kselftest/patch/20220920063202.215088-1-ye.xingchen@zte.com.cn/

Thanks for catching this.

Also this address has now been banned from the kernel mailing lists, so
watch out for patches sent to maintainers that do not show up on
lore.kernel.org.

thanks,

greg k-h

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

end of thread, other threads:[~2022-09-23  6:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 14:31 [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val cgel.zte
2022-08-31 16:17 ` Jim Mattson
2022-09-20 19:30   ` Sean Christopherson
2022-09-22 18:45 ` Shuah Khan
2022-09-22 19:41   ` Sean Christopherson
2022-09-23  6:28   ` Greg Kroah-Hartman

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.