public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Neil Horman <nhorman@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
	netdev@vger.kernel.org, Alexander Duyck <aduyck@mirantis.com>,
	linux-kernel@vger.kernel.org
Subject: netpoll rtnl_dereference() usage
Date: Fri, 25 Mar 2016 12:30:32 -0500	[thread overview]
Message-ID: <20160325173032.GC29822@localhost> (raw)

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

             reply	other threads:[~2016-03-25 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25 17:30 Bjorn Helgaas [this message]
2016-03-25 18:16 ` netpoll rtnl_dereference() usage Neil Horman

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=20160325173032.GC29822@localhost \
    --to=helgaas@kernel.org \
    --cc=aduyck@mirantis.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=nikolay@cumulusnetworks.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