[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3658BA65DD26AF4BA909BEB2C6DF6181A2A63C6A@ORSMSX102.amr.corp.intel.com>
Date: Mon, 30 Mar 2020 23:42:37 +0000
From: "Park, Kyung Min" <kyung.min.park@...el.com>
To: Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
CC: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Greg KH <gregkh@...uxfoundation.org>,
Andi Kleen <ak@...ux.intel.com>,
"Luck, Tony" <tony.luck@...el.com>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
"Yu, Fenghua" <fenghua.yu@...el.com>
Subject: RE: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay
Hi Andy/Thomas,
On Fri, Mar 20, 2020 at 4:23 PM Thomas Gleixner <tglx@...utronix.de> wrote:
> >
> > Andy Lutomirski <luto@...nel.org> writes:
> >
> > > On Fri, Mar 20, 2020 at 3:00 AM Thomas Gleixner <tglx@...utronix.de>
> wrote:
> > >>
> > >> Andy Lutomirski <luto@...nel.org> writes:
> > >> > On Thu, Mar 19, 2020 at 9:13 PM Kyung Min Park
> <kyung.min.park@...el.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.
>
> This is definitely not worth overoptimizing. It's a *delay* function
> -- the retpoline isn't going to kill us :)
Since the use_tsc_delay() is used just once in __init tsc_init(),
how about adding "__init" to the use_tsc_delay() and keep these function pointers?
Powered by blists - more mailing lists