From: Josh Triplett <josh@joshtriplett.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
lttng-dev@lists.lttng.org, linux-sparse@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
sparse@chrisli.org
Subject: Re: [RFC] adding into middle of RCU list
Date: Thu, 29 Aug 2013 19:16:37 -0700 [thread overview]
Message-ID: <20130830021637.GA21862@leaf> (raw)
In-Reply-To: <20130830005733.GA20664@linux.vnet.ibm.com>
On Thu, Aug 29, 2013 at 05:57:33PM -0700, Paul E. McKenney wrote:
> On Fri, Aug 23, 2013 at 02:08:22PM -0700, Paul E. McKenney wrote:
> > On Fri, Aug 23, 2013 at 01:16:53PM -0400, Mathieu Desnoyers wrote:
> > > #define __rcu_assign_pointer(p, v, space) \
> > > do { \
> > > smp_wmb(); \
> > > (p) = (typeof(*v) __force space *)(v); \
> > > } while (0)
> >
> > Or I need to fix this one as well. ;-)
>
> In that vein... Is there anything like typeof() that also preserves
> sparse's notion of address space? Wrapping an ACCESS_ONCE() around
> "p" in the assignment above results in sparse errors.
typeof() will preserve sparse's notion of address space as long as you
do typeof(p), not typeof(*p):
$ cat test.c
#define as(n) __attribute__((address_space(n),noderef))
#define __force __attribute__((force))
int main(void)
{
int target = 0;
int as(1) *foo = (__force typeof(target) as(1) *) ⌖
typeof(foo) bar = foo;
return *bar;
}
$ sparse test.c
test.c:9:13: warning: dereference of noderef expression
Notice that sparse didn't warn on the assignment of foo to bar (because
typeof propagated the address space of 1), and warned on the dereference
of bar (because typeof propagated noderef).
- Josh Triplett
next prev parent reply other threads:[~2013-08-30 2:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130822213318.49a57fa2@nehalam.linuxnetplumber.net>
[not found] ` <20130823164637.GB3871@linux.vnet.ibm.com>
[not found] ` <20130823171653.GA16558@Krystal>
[not found] ` <20130823210822.GD3871@linux.vnet.ibm.com>
2013-08-30 0:57 ` [RFC] adding into middle of RCU list Paul E. McKenney
2013-08-30 2:16 ` Josh Triplett [this message]
2013-08-31 21:32 ` Paul E. McKenney
2013-09-01 20:42 ` Josh Triplett
2013-09-01 22:26 ` Paul E. McKenney
2013-09-01 22:43 ` Josh Triplett
2013-09-01 23:42 ` [PATCH] rcu: Make rcu_assign_pointer's assignment volatile and type-safe Josh Triplett
2013-09-02 2:01 ` Paul E. McKenney
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=20130830021637.GA21862@leaf \
--to=josh@joshtriplett.org \
--cc=linux-sparse@vger.kernel.org \
--cc=lttng-dev@lists.lttng.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sparse@chrisli.org \
--cc=stephen@networkplumber.org \
/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;
as well as URLs for NNTP newsgroup(s).