From: Tejun Heo <tj@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Pekka Enbeerg <penberg@cs.helsinki.fi>,
linux-kernel@vger.kernel.org,
Eric Dumazet <eric.dumazet@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
akpm@linux-foundation.org
Subject: Re: x86: A fast way to check capabilities of the current cpu
Date: Fri, 21 Jan 2011 18:28:36 +0100 [thread overview]
Message-ID: <20110121172836.GK2832@htj.dyndns.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1101211114530.15692@router.home>
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.
> > 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_?
Thanks.
--
tejun
next prev parent reply other threads:[~2011-01-21 17:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 20:07 Christoph Lameter
2010-12-15 20:11 ` x86: Avoid passing struct cpuinfo pointer to mce_available Christoph Lameter
2010-12-15 20:56 ` x86: A fast way to check capabilities of the current cpu Andrew Morton
2010-12-15 21:03 ` H. Peter Anvin
2010-12-15 21:30 ` Miguel Ojeda
2010-12-15 21:39 ` H. Peter Anvin
2010-12-15 21:48 ` Miguel Ojeda
2010-12-16 6:25 ` Miles Bader
2010-12-16 10:17 ` Miguel Ojeda
2010-12-16 10:29 ` Miles Bader
2010-12-16 15:38 ` H. Peter Anvin
2010-12-17 4:26 ` Miles Bader
2011-01-21 17:11 ` Tejun Heo
2011-01-21 17:21 ` Christoph Lameter
2011-01-21 17:28 ` Tejun Heo [this message]
2011-01-21 17:46 ` Christoph Lameter
2011-01-21 17:48 ` Tejun Heo
2011-01-21 17:57 ` Christoph Lameter
2011-01-21 18:12 ` Tejun Heo
2011-01-21 18:20 ` Christoph Lameter
2011-01-21 22:32 ` H. Peter Anvin
2011-01-24 17:05 ` Christoph Lameter
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=20110121172836.GK2832@htj.dyndns.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=eric.dumazet@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=penberg@cs.helsinki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®