[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130207183725.GE2379@shamino.rdu.redhat.com>
Date: Thu, 7 Feb 2013 13:37:25 -0500
From: Neil Horman <nhorman@...driver.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org, fengguang.wu@...el.com,
David Miller <davem@...emloft.net>
Subject: Re: [PATCH] netpoll: cleanup sparse warnings
On Thu, Feb 07, 2013 at 07:52:56AM -0800, Eric Dumazet wrote:
> On Thu, 2013-02-07 at 09:56 -0500, Neil Horman wrote:
> > With my recent commit I introduced two sparse warnings. Looking closer there
> > were a few more in the same file, so I fixed them all up. Basic rcu pointer
> > dereferencing suff
>
> > - npinfo = np->dev->npinfo;
> > + /* rtnl_dereference would be preferable here but
> > + * rcu_cleanup_netpoll path can put us in here safely without
> > + * holding the rtnl, so plain rcu_dereference it is
> > + */
> > + npinfo = rcu_dereference(np->dev->npinfo);
> > if (!npinfo)
> > return;
> >
>
> Are you sure it wont trigger a LOCKDEP complain (CONFIG_PROVE_RCU=y) ?
>
Hm, looking at it, you're probably right. We're not holding the rcu_read_lock,
and I'd forgotten that rcu_dereference implicitly checks that rcu_read_lock is
held. I guess, since the only paths that we get here on are in a bh rcu
quiescence point or with the rtnl held we should probably make this:
rcu_dereference_protected(np->dev->npinfo, rtnl_locked() || in_interrupt());
Although, thinking about this further somewhat begs the question as to how we
prevent one context from calling __netpoll_cleanup in a path holding rtnl, while
in parallel calling __netpoll_cleanup from the rcu callback. That might not be
a huge deal as __netpoll_cleanup uses spinlocks to do list modification, and an
atomic_dec_and_test to gate the free, but it still seems ugly.
What do you think?
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists