lkml.org 
[lkml]   [2011]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: x86: A fast way to check capabilities of the current cpu
On Fri, 21 Jan 2011, Tejun Heo wrote:

> On Fri, Jan 21, 2011 at 11:21:02AM -0600, Christoph Lameter wrote:
> > > I don't think percpu_read_stable() can be used here. It's not
> > > guaranteed to be stable across different cpus.
> >
> > Why would that matter? The caller has to disabled preemption anyways since
> > otherwise the processor may change which means that the result of the
> > operation is useless.
>
> Because
>
> preempt_disable();
> this_cpu_has();
> preempt_enable();
> preempt_disable();
> this_cpu_has();
> preempt_enable();
>
> might malfunction. percpu_read_stable() is pretty much applicable
> only to stuff local to the thread.

Ok then lets change it to percpu_read

> > > Also, can we just implement what's necessary on top of this_cpu_has()?
> > > this_cpu_has() already has constant handling, so there's no need to
> > > add this_cpu_test_bit() at this point.
> >
> > Not sure what you mean. this_cpu_test_bit is necessary because
> > test_cpu_cap expects a regular pointer and performs a regular load.
> > this_cpu_constant_test_bit handles the segment prefix necessary for a per
> > cpu load.
> >
> > The constant refers to the bit.
>
> Oh, you're right. Sorry about that. Can you please then add a
> comment noting that the operation is x86 only? Maybe prefix it with
> x86_?

For a function defined in an specific include file and only used in arch
specific code?


\
 
 \ /
  Last update: 2011-01-21 18:49    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean