From: Peter Zijlstra <peterz@infradead.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: dwmw2@infradead.org, pjt@google.com,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
gregkh@linux-foundation.org, tim.c.chen@linux.intel.com,
dave.hansen@intel.com, tglx@linutronix.de, luto@amacapital.net,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] x86/retpoline: Also fill return buffer after idle
Date: Tue, 9 Jan 2018 10:37:56 +0100 [thread overview]
Message-ID: <20180109093756.GF6176@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180108235126.28736-1-andi@firstfloor.org>
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
>
next prev parent reply other threads:[~2018-01-09 9:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-08 23:51 [PATCH] x86/retpoline: Also fill return buffer after idle Andi Kleen
2018-01-09 0:00 ` David Woodhouse
2018-01-09 0:24 ` Andi Kleen
2018-01-09 0:28 ` David Woodhouse
2018-01-09 9:37 ` Peter Zijlstra [this message]
2018-01-09 13:58 ` David Woodhouse
2018-01-09 14:12 ` Peter Zijlstra
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=20180109093756.GF6176@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=dave.hansen@intel.com \
--cc=dwmw2@infradead.org \
--cc=gregkh@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=pjt@google.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.