Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754258AbcCYRal (ORCPT ); Fri, 25 Mar 2016 13:30:41 -0400 Received: from mail.kernel.org ([198.145.29.136]:55801 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753501AbcCYRaj (ORCPT ); Fri, 25 Mar 2016 13:30:39 -0400 Date: Fri, 25 Mar 2016 12:30:32 -0500 From: Bjorn Helgaas To: Neil Horman Cc: "David S. Miller" , Nikolay Aleksandrov , netdev@vger.kernel.org, Alexander Duyck , linux-kernel@vger.kernel.org Subject: netpoll rtnl_dereference() usage Message-ID: <20160325173032.GC29822@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1047 Lines: 28 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