public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>,
	Kyung Min Park <kyung.min.park@intel.com>,
	X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Andi Kleen <ak@linux.intel.com>, Tony Luck <tony.luck@intel.com>,
	"Raj\, Ashok" <ashok.raj@intel.com>,
	"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay
Date: Sat, 21 Mar 2020 00:23:50 +0100	[thread overview]
Message-ID: <87zhcaobjt.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <CALCETrUxOd6P-Yh78qjmOYnh9jY0ggeb4vB=coVjMjthXMTREg@mail.gmail.com>

Andy Lutomirski <luto@kernel.org> writes:

> On Fri, Mar 20, 2020 at 3:00 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>>
>> Andy Lutomirski <luto@kernel.org> writes:
>> > On Thu, Mar 19, 2020 at 9:13 PM Kyung Min Park <kyung.min.park@intel.com> wrote:
>> >>  void use_tsc_delay(void)
>> >>  {
>> >> -       if (delay_fn == delay_loop)
>> >> +       if (static_cpu_has(X86_FEATURE_WAITPKG)) {
>> >> +               delay_halt_fn = delay_halt_tpause;
>> >> +               delay_fn = delay_halt;
>> >> +       } else if (delay_fn == delay_loop) {
>> >>                 delay_fn = delay_tsc;
>> >> +       }
>> >>  }
>> >
>> > This is an odd way to dispatch: you're using static_cpu_has(), but
>> > you're using it once to populate a function pointer.  Why not just put
>> > the static_cpu_has() directly into delay_halt() and open-code the
>> > three variants?
>>
>> Two: mwaitx and tpause.
>
> I was imagining there would also be a variant for systems with neither feature.

Oh I see, you want to get rid of both function pointers. That's tricky.

The boot time function is delay_loop() which is using the magic (1 << 12)
boot time value until calibration in one way or the other happens and
something calls use_tsc_delay() or use_mwaitx_delay(). Yes, that's all
horrible but X86_FEATURE_TSC is unusable for this.

Let me think about it.

Thanks,

        tglx









  reply	other threads:[~2020-03-20 23:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20  4:13 [PATCH v2 0/2] x86/delay: Introduce TPAUSE instruction Kyung Min Park
2020-03-20  4:13 ` [PATCH v2 1/2] x86/delay: Refactor delay_mwaitx() for TPAUSE support Kyung Min Park
2020-03-20  4:13 ` [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay Kyung Min Park
2020-03-20  4:23   ` Andy Lutomirski
2020-03-20 10:00     ` Thomas Gleixner
2020-03-20 21:51       ` Andy Lutomirski
2020-03-20 23:23         ` Thomas Gleixner [this message]
2020-03-20 23:57           ` Andy Lutomirski
2020-03-30 23:42             ` Park, Kyung Min
2020-03-20 10:07   ` Joe Perches
2020-03-23  5:18     ` Park, Kyung Min
2020-03-20  9:57 ` [PATCH v2 0/2] x86/delay: Introduce TPAUSE instruction Thomas Gleixner
2020-03-20 23:43   ` Park, Kyung Min

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=87zhcaobjt.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=ak@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=kyung.min.park@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ravi.v.shankar@intel.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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