[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100126011234.GL5087@nowhere>
Date: Tue, 26 Jan 2010 02:12:36 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
axboe@...nel.dk, rusty@...tcorp.com.au, akpm@...ux-foundation.org,
ebiederm@...ssion.com, tytso@....edu, Trond.Myklebust@...app.com,
aelder@....com, hch@...radead.org, viro@...iv.linux.org.uk,
davem@...emloft.net, netdev@...r.kernel.org, x86@...nel.org,
mingo@...hat.com, dan.j.williams@...el.com,
borislav.petkov@....com, ying.huang@...el.com, lenb@...nel.org,
neilb@...e.de, cl@...ux-foundation.org
Subject: Re: [PATCH 7/8] percpu: add __percpu sparse annotations to
hw_breakpoint
On Mon, Jan 25, 2010 at 05:06:37PM -0800, H. Peter Anvin wrote:
> On 01/25/2010 04:19 PM, Frederic Weisbecker wrote:
> > On Tue, Jan 26, 2010 at 12:22:14AM +0900, Tejun Heo wrote:
> >> Add __percpu sparse annotations to hw_breakpoint.
> >>
> >> These annotations are to make sparse consider percpu variables to be
> >> in a different address space and warn if accessed without going
> >> through percpu accessors. This patch doesn't affect normal builds.
> >>
> >> per_cpu(nr_task_bp_pinned, cpu) is replaced with
> >> &per_cpu(nr_task_bp_pinned[0], cpu). This is the same to the compiler
> >> but allows per_cpu() macro to correctly drop __percpu designation for
> >> the returned pointer.
> >
> > Ouch... It's unpleasant to see such workaround that messes up the
> > code just to make sparse happy.
> >
> > I guess __percpu is an address_space attribute? Is there no
> > way to force the address space change directly from the
> > per_cpu() macro?
> >
>
> Hmm... thinking more about it, we should be able to just move the & and
> [0] into the per_cpu() macro, addressing the situation, or does that
> cause problems elsewhere?
>
> -hpa
That would work only with arrays. per_cpu() can access either pointers
or direct values. Well that can be worked around with fake casts, but
I would except the (typeof(x) __force) to work and then offer a more
elegant solution.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists