lkml.org 
[lkml]   [2015]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 3/4] x86, mwaitt: introduce mwaix delay with a configurable timer
On Jun 12, 2015 1:43 AM, "Borislav Petkov" <bp@suse.de> wrote:
>
> On Tue, Jun 09, 2015 at 09:46:52AM -0700, Andy Lutomirski wrote:
> > I don't like this hack. The compiler is entirely within is rights to
> > poke addr's cacheline (i.e. the stack) between the two instructions.
> > I'd suggest either making the thing a full cacheline long or using a
> > single asm statement.
>
> How about this:
>
> /*
> * This should be a memory location in a cache line which is
> * unlikely to be touched by other processors. The actual
> * content is immaterial as it is not actually modified in any way.
> */
> mwait_ptr = &current_thread_info()->flags;
>
> and then
>
> __monitor(mwait_ptr, 0, 0);
>
> We already do this in mwait_play_dead().
>
> However, am I even correct in assuming that ->flags won't really be
> touched as we're doing delay() and nothing pokes into current anyway?

We poke flags remotely, but not frequently enough for this to be a
problem. However, I don't know that touching current in udelay is
okay.

How about some read-mostly percpu variable, such as cpu_tss?

--Andy


\
 
 \ /
  Last update: 2015-06-13 01:41    [W:1.968 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site