lkml.org 
[lkml]   [2020]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/2] x86/delay: Introduce TPAUSE delay
Date
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.

> That will also make it a lot easier to understand the oddity with
> start and cycles.

Indeed. That makes sense. Should have thought about it :)

Thanks,

tglx

\
 
 \ /
  Last update: 2020-03-20 11:01    [W:0.093 / U:1.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site