From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbdK0TXv (ORCPT ); Mon, 27 Nov 2017 14:23:51 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:56596 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751537AbdK0TXt (ORCPT ); Mon, 27 Nov 2017 14:23:49 -0500 Date: Tue, 28 Nov 2017 04:22:54 +0900 (KST) Message-Id: <20171128.042254.1904551835549520772.davem@davemloft.net> To: otubo@redhat.com Cc: xen-devel@lists.xenproject.org, netdev@vger.kernel.org, paul.durrant@citrix.com, wei.liu2@citrix.com, linux-kernel@vger.kernel.org, vkuznets@redhat.com, cavery@redhat.com, cheshi@redhat.com, mgamal@redhat.com, jgross@suse.com, boris.ostrovsky@oracle.com Subject: Re: [PATCHv2] xen-netfront: remove warning when unloading module From: David Miller In-Reply-To: <20171123141835.5820-1-otubo@redhat.com> References: <20171123141835.5820-1-otubo@redhat.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / 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]); Mon, 27 Nov 2017 11:23:49 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eduardo Otubo Date: Thu, 23 Nov 2017 15:18:35 +0100 > v2: > * Replace busy wait with wait_event()/wake_up_all() > * Cannot garantee that at the time xennet_remove is called, the > xen_netback state will not be XenbusStateClosed, so added a > condition for that > * There's a small chance for the xen_netback state is > XenbusStateUnknown by the time the xen_netfront switches to Closed, > so added a condition for that. > > When unloading module xen_netfront from guest, dmesg would output > warning messages like below: > > [ 105.236836] xen:grant_table: WARNING: g.e. 0x903 still in use! > [ 105.236839] deferring g.e. 0x903 (pfn 0x35805) > > This problem relies on netfront and netback being out of sync. By the time > netfront revokes the g.e.'s netback didn't have enough time to free all of > them, hence displaying the warnings on dmesg. > > The trick here is to make netfront to wait until netback frees all the g.e.'s > and only then continue to cleanup for the module removal, and this is done by > manipulating both device states. > > Signed-off-by: Eduardo Otubo Applied, thank you.