public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* netpoll rtnl_dereference() usage
@ 2016-03-25 17:30 Bjorn Helgaas
  2016-03-25 18:16 ` Neil Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Helgaas @ 2016-03-25 17:30 UTC (permalink / raw)
  To: Neil Horman
  Cc: David S. Miller, Nikolay Aleksandrov, netdev, Alexander Duyck,
	linux-kernel

Hi Neil,

Since we're looking at netpoll, here's another question (or two).
0790bbb68f9d ("netpoll: cleanup sparse warnings") adds this:

@@ -1236,7 +1236,11 @@ void __netpoll_cleanup(struct netpoll *np)
        struct netpoll_info *npinfo;
        unsigned long flags;
 
-       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 = rtnl_dereference(np->dev->npinfo);
        if (!npinfo)
                return;

The comment seems to contradict the code: the comment says "we would
like to use rtnl_dereference(), but we have to use rcu_dereference()."
But the code in fact *does* use rtnl_dereference().

Also, "rcu_cleanup_netpoll" doesn't exist; maybe it's a typo for
rcu_cleanup_netpoll_info()?  I don't see the path that leads from
rcu_cleanup_netpoll_info() to __netpoll_cleanup(), but I don't claim
to understand the netpoll async subtleties.

Bjorn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-25 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 17:30 netpoll rtnl_dereference() usage Bjorn Helgaas
2016-03-25 18:16 ` Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox