From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328AbcHOEbg (ORCPT ); Mon, 15 Aug 2016 00:31:36 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:39445 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbcHOEbf (ORCPT ); Mon, 15 Aug 2016 00:31:35 -0400 Date: Sun, 14 Aug 2016 21:31:33 -0700 (PDT) Message-Id: <20160814.213133.1692896664092434326.davem@davemloft.net> To: stephen@networkplumber.org Cc: vkuznets@redhat.com, netdev@vger.kernel.org, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, haiyangz@microsoft.com, kys@microsoft.com Subject: Re: [RFC 1/2] netvsc: reference counting fix From: David Miller In-Reply-To: <20160813113559.617b7c55@xeon-e3> References: <1470913137-29167-1-git-send-email-vkuznets@redhat.com> <1470913137-29167-3-git-send-email-vkuznets@redhat.com> <20160813113559.617b7c55@xeon-e3> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 14 Aug 2016 21:31:34 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Hemminger Date: Sat, 13 Aug 2016 11:35:59 -0700 > This is how I think it should be fixed, but not tested yet. > > Subjec: netvsc: use device not module reference counts > > Fix how the cross-device reference counting is handled. When VF is > associated with the synthetic interface, the VF driver module should > still be able to be unloaded. The module unload code will callback > with NETDEV_UNREGISTER event which breaks the connection safely. > (Fixes 9f4b5ba5db4 hv_netvsc: Implement support for VF drivers on Hyper-V) > > Signed-off-by: Stephen Hemminger This might not work. It is assumed that when a netdev unregister happens, it may be done so at any point in time. Therefore that NETDEV_UNREGISTER event must eliminate any and all references to a given netdev. And that works perfectly fine right now with all existing subsystems that take references to netdevs. You'll have to add something so that a NETDEV_UNREGISTER event tears this VF down and thus releases it's reference to the synthetic device.