From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] fib_trie: fix warning from rcu_assign_poinger
Date: Tue, 18 Mar 2008 07:06:54 -0700 [thread overview]
Message-ID: <20080318140654.GA8222@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080317142706.235594c9@extreme>
On Mon, Mar 17, 2008 at 02:27:06PM -0700, Stephen Hemminger wrote:
> This gets rid of a warning caused by the test in rcu_assign_pointer.
> I tried to fix rcu_assign_pointer, but that devolved into a long
> set of discussions about doing it right that came to no real solution.
> Since the test in rcu_assign_pointer for constant NULL would never succeed in
> fib_trie, just open code instead.
Indeed -- fooling gcc is nontrivial. :-/
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> ---
> net/ipv4/fib_trie.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index a7d089e..ce6cb34 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -177,10 +177,13 @@ static inline struct tnode *node_parent_rcu(struct node *node)
> return rcu_dereference(ret);
> }
>
> +/* Same as rcu_assign_pointer
> + * but that macro() assumes that value is a pointer.
> + */
> static inline void node_set_parent(struct node *node, struct tnode *ptr)
> {
> - rcu_assign_pointer(node->parent,
> - (unsigned long)ptr | NODE_TYPE(node));
> + smp_wmb();
> + node->parent = (unsigned long)ptr | NODE_TYPE(node);
> }
>
> static inline struct node *tnode_get_child(struct tnode *tn, unsigned int i)
> --
> 1.5.4.3
>
next prev parent reply other threads:[~2008-03-19 19:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 21:02 [PATCH] fib_trie: print information on all routing tables Stephen Hemminger
[not found] ` <20080317142706.235594c9@extreme>
2008-03-18 14:06 ` Paul E. McKenney [this message]
2008-03-23 1:02 ` [PATCH] fib_trie: fix warning from rcu_assign_poinger David Miller
2008-03-24 5:45 ` [PATCH] fib_trie: print information on all routing tables 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=20080318140654.GA8222@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.