mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: paulmck@linux.vnet.ibm.com, Michael Chan <mchan@broadcom.com>,
	linux-kernel@vger.kernel.org
Subject: Re: RCU: how to suppress warnings from rcu_assign_pointer?
Date: Sat, 30 Jul 2011 14:17:05 +0200	[thread overview]
Message-ID: <1312028225.2873.104.camel@edumazet-laptop> (raw)
In-Reply-To: <20110729105058.2cb9fa86@nehalam.ftrdhcpuser.net>

Le vendredi 29 juillet 2011 à 10:50 -0700, Stephen Hemminger a écrit :
> Gcc now generates warnings from rcu_assign_pointer when passed the
> address of something for example:
> 	rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc);
> This warning is harmless and should be surpressed but there maybe
> other cases where we want that Gcc warning.
> 
> I tried various combinations of in rcu_assign_pointer macro
>   #pragma GCC diagnostic push
>   #pragma GCC diagnostic ignored "-Wlogical-op"
>   ...
>   #pragma GCC diagnostic pop
> but macro's and pragma's don't nest with the correct scope for
> this.
> 
> Maybe some one with more Gcc foo and time to waste could take
> a crack at it.

I would just remove the test from rcu_assign_pointer().

We now have RCU_INIT_POINTER() for places we dont want/afford the
smp_wmb()


diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 8f4f881..f372e88 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -365,9 +365,7 @@ extern int rcu_my_thread_group_empty(void);
 	})
 #define __rcu_assign_pointer(p, v, space) \
 	({ \
-		if (!__builtin_constant_p(v) || \
-		    ((v) != NULL)) \
-			smp_wmb(); \
+		smp_wmb(); \
 		(p) = (typeof(*v) __force space *)(v); \
 	})
 



  reply	other threads:[~2011-07-30 12:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110728142723.77a2c308@nehalam.ftrdhcpuser.net>
     [not found] ` <20110728214442.GV2403@linux.vnet.ibm.com>
     [not found]   ` <20110728145510.0ec0db01@nehalam.ftrdhcpuser.net>
     [not found]     ` <20110729003843.GA2373@linux.vnet.ibm.com>
2011-07-29 17:50       ` Stephen Hemminger
2011-07-30 12:17         ` Eric Dumazet [this message]
2011-07-31  3:16           ` David Miller
2011-08-01  5:23             ` Paul E. McKenney
2011-08-01  8:47               ` Eric Dumazet
2011-08-01 16:19                 ` [PATCH] rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER Stephen Hemminger
2011-08-02  5:44                   ` David Miller
2011-08-02 10:32                     ` Paul E. McKenney
2011-08-02 11:29                       ` David Miller

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=1312028225.2873.104.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=shemminger@vyatta.com \
    /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®