lkml.org 
[lkml]   [2019]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/5] x86/umwait: Initialize umwait control values
On Mon, 17 Jun 2019, Fenghua Yu wrote:
> On Tue, Jun 11, 2019 at 10:46:55PM +0200, Thomas Gleixner wrote:
> > On Sun, 9 Jun 2019, Fenghua Yu wrote:
> > > > Sounds good, but:
> > > >
> > > > > +#define MSR_IA32_UMWAIT_CONTROL_C02 BIT(0)
> > > >
> > > > > +static u32 umwait_control_cached = 100000;
> > > >
> > > > The code seems to disagree.
> > >
> > > The definition of bit[0] is: C0.2 is disabled when bit[0]=1. So
> > > 100000 means C0.2 is enabled (and max time is 100000).
> >
> > which is totally non obvious. If you have to encode the control bit, then
> > please make it explicit, i.e. mask out the disable bit in the initializer.
>
> Is this right?
>
> static u32 umwait_control_cached = 100000 & ~MSR_IA32_UMWAIT_CONTROL_C02_DISABLED;

Works, but looks pretty odd. I'd rather create an explicit initializer
macro, something like:

UMWAIT_CTRL_VAL(100000, UMWAIT_DISABLED);

Hmm?

Thanks,

tglx

\
 
 \ /
  Last update: 2019-06-18 09:06    [W:0.151 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site