[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180109093756.GF6176@hirez.programming.kicks-ass.net>
Date: Tue, 9 Jan 2018 10:37:56 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Andi Kleen <andi@...stfloor.org>
Cc: dwmw2@...radead.org, pjt@...gle.com, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, gregkh@...ux-foundation.org,
tim.c.chen@...ux.intel.com, dave.hansen@...el.com,
tglx@...utronix.de, luto@...capital.net,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] x86/retpoline: Also fill return buffer after idle
On Mon, Jan 08, 2018 at 03:51:26PM -0800, Andi Kleen wrote:
> @@ -107,8 +109,15 @@ static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
> }
>
> __monitor((void *)¤t_thread_info()->flags, 0, 0);
> - if (!need_resched())
> + if (!need_resched()) {
> __mwait(eax, ecx);
> + /*
> + * idle could have cleared the return buffer,
> + * so fill it to prevent uncontrolled
> + * speculation.
> + */
> + fill_return_buffer();
wouldn't something like:
if (static_cpu_has(X86_FEATURE_RETPOLINE))
fill_return_buffer();
be much saner? Then we avoid the entire call when not needed and you
don't have to muck with the asm either.
Also, you forgot mwait_idle() in process.c
> + }
> }
> current_clr_polling();
> }
> --
> 2.14.3
>
Powered by blists - more mailing lists