[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1360293933.28557.92.camel@edumazet-glaptop>
Date: Thu, 07 Feb 2013 19:25:33 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Neil Horman <nhorman@...driver.com>
Cc: netdev@...r.kernel.org, fengguang.wu@...el.com,
David Miller <davem@...emloft.net>
Subject: Re: [PATCH] netpoll: cleanup sparse warnings
On Thu, 2013-02-07 at 13:37 -0500, Neil Horman wrote:
> 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?
I think you could use
rcu_dereference_check(p, lockdep_rtnl_is_held() || something)
--
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