From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbdK0JAx (ORCPT ); Mon, 27 Nov 2017 04:00:53 -0500 Received: from mx2.suse.de ([195.135.220.15]:60301 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224AbdK0JAu (ORCPT ); Mon, 27 Nov 2017 04:00:50 -0500 Subject: Re: [PATCHv2] xen-netfront: remove warning when unloading module To: Eduardo Otubo , xen-devel@lists.xenproject.org Cc: 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, boris.ostrovsky@oracle.com References: <20171123141835.5820-1-otubo@redhat.com> From: Juergen Gross Message-ID: <74dc58e4-5317-f864-dcf5-c2b283744930@suse.com> Date: Mon, 27 Nov 2017 10:00:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171123141835.5820-1-otubo@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/11/17 15:18, Eduardo Otubo wrote: > 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 Acked-by: Juergen Gross Juergen