public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: cgel.zte@gmail.com, pbonzini@redhat.com, shuah@kernel.org,
	dmatlack@google.com, peterx@redhat.com, oupton@google.com,
	kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jinpeng Cui <cui.jinpeng2@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val
Date: Tue, 20 Sep 2022 19:30:44 +0000	[thread overview]
Message-ID: <YyoU5E2eKD9dpjzH@google.com> (raw)
In-Reply-To: <CALMp9eT1yz0q1xn2nPtKBbnx_ixX4ivFk=qOayz70k_hxooaoQ@mail.gmail.com>

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.

  reply	other threads:[~2022-09-20 19:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-09-22 18:45 ` Shuah Khan
2022-09-22 19:41   ` Sean Christopherson
2022-09-23  6:28   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YyoU5E2eKD9dpjzH@google.com \
    --to=seanjc@google.com \
    --cc=cgel.zte@gmail.com \
    --cc=cui.jinpeng2@zte.com.cn \
    --cc=dmatlack@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=shuah@kernel.org \
    --cc=zealci@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox