Re: [PATCH linux-next] KVM: selftests: remove redundant variable tsc_val

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 31, 2022, Jim Mattson wrote:
> On Wed, Aug 31, 2022 at 7:31 AM <cgel.zte@xxxxxxxxx> 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.



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux