From: Paul Durrant <Paul.Durrant@citrix.com> To: "'Eduardo Otubo'" <otubo@redhat.com>, "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org> Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>, Wei Liu <wei.liu2@citrix.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "vkuznets@redhat.com" <vkuznets@redhat.com>, "cavery@redhat.com" <cavery@redhat.com>, "cheshi@redhat.com" <cheshi@redhat.com>, "mgamal@redhat.com" <mgamal@redhat.com> Subject: RE: [PATCH] xen-netfront: remove warning when unloading module Date: Mon, 20 Nov 2017 10:55:55 +0000 [thread overview] Message-ID: <593f1c5a3bf24a2dbce56287391e776d@AMSPEX02CL03.citrite.net> (raw) In-Reply-To: <20171120104109.11585-1-otubo@redhat.com> > -----Original Message----- > From: Eduardo Otubo [mailto:otubo@redhat.com] > Sent: 20 November 2017 10:41 > To: xen-devel@lists.xenproject.org > Cc: netdev@vger.kernel.org; Paul Durrant <Paul.Durrant@citrix.com>; Wei > Liu <wei.liu2@citrix.com>; linux-kernel@vger.kernel.org; > vkuznets@redhat.com; cavery@redhat.com; cheshi@redhat.com; > mgamal@redhat.com; Eduardo Otubo <otubo@redhat.com> > Subject: [PATCH] xen-netfront: remove warning when unloading module > > 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 <otubo@redhat.com> > --- > drivers/net/xen-netfront.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c > index 8b8689c6d887..b948e2a1ce40 100644 > --- a/drivers/net/xen-netfront.c > +++ b/drivers/net/xen-netfront.c > @@ -2130,6 +2130,17 @@ static int xennet_remove(struct xenbus_device > *dev) > > dev_dbg(&dev->dev, "%s\n", dev->nodename); > > + xenbus_switch_state(dev, XenbusStateClosing); > + while (xenbus_read_driver_state(dev->otherend) != > XenbusStateClosing){ > + cpu_relax(); > + schedule(); > + } > + xenbus_switch_state(dev, XenbusStateClosed); > + while (dev->xenbus_state != XenbusStateClosed){ > + cpu_relax(); > + schedule(); > + } > + Waitiing for closing should be ok but waiting for closed is risky. As soon as a backend is in the closed state then a toolstack can completely remove the backend xenstore area, resulting a state of XenbusStateUnknown, which would cause your second loop to spin forever. Paul > xennet_disconnect_backend(info); > > unregister_netdev(info->netdev); > -- > 2.13.6
WARNING: multiple messages have this Message-ID (diff)
From: Paul Durrant <Paul.Durrant@citrix.com> To: 'Eduardo Otubo' <otubo@redhat.com>, "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org> Cc: Wei Liu <wei.liu2@citrix.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "cheshi@redhat.com" <cheshi@redhat.com>, "vkuznets@redhat.com" <vkuznets@redhat.com>, "mgamal@redhat.com" <mgamal@redhat.com>, "cavery@redhat.com" <cavery@redhat.com> Subject: Re: [PATCH] xen-netfront: remove warning when unloading module Date: Mon, 20 Nov 2017 10:55:55 +0000 [thread overview] Message-ID: <593f1c5a3bf24a2dbce56287391e776d@AMSPEX02CL03.citrite.net> (raw) In-Reply-To: <20171120104109.11585-1-otubo@redhat.com> > -----Original Message----- > From: Eduardo Otubo [mailto:otubo@redhat.com] > Sent: 20 November 2017 10:41 > To: xen-devel@lists.xenproject.org > Cc: netdev@vger.kernel.org; Paul Durrant <Paul.Durrant@citrix.com>; Wei > Liu <wei.liu2@citrix.com>; linux-kernel@vger.kernel.org; > vkuznets@redhat.com; cavery@redhat.com; cheshi@redhat.com; > mgamal@redhat.com; Eduardo Otubo <otubo@redhat.com> > Subject: [PATCH] xen-netfront: remove warning when unloading module > > 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 <otubo@redhat.com> > --- > drivers/net/xen-netfront.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c > index 8b8689c6d887..b948e2a1ce40 100644 > --- a/drivers/net/xen-netfront.c > +++ b/drivers/net/xen-netfront.c > @@ -2130,6 +2130,17 @@ static int xennet_remove(struct xenbus_device > *dev) > > dev_dbg(&dev->dev, "%s\n", dev->nodename); > > + xenbus_switch_state(dev, XenbusStateClosing); > + while (xenbus_read_driver_state(dev->otherend) != > XenbusStateClosing){ > + cpu_relax(); > + schedule(); > + } > + xenbus_switch_state(dev, XenbusStateClosed); > + while (dev->xenbus_state != XenbusStateClosed){ > + cpu_relax(); > + schedule(); > + } > + Waitiing for closing should be ok but waiting for closed is risky. As soon as a backend is in the closed state then a toolstack can completely remove the backend xenstore area, resulting a state of XenbusStateUnknown, which would cause your second loop to spin forever. Paul > xennet_disconnect_backend(info); > > unregister_netdev(info->netdev); > -- > 2.13.6 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-11-20 11:05 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-11-20 10:41 [PATCH] xen-netfront: remove warning when unloading module Eduardo Otubo 2017-11-20 10:49 ` Wei Liu 2017-11-20 11:17 ` Juergen Gross 2017-11-20 11:17 ` Juergen Gross 2017-11-20 12:59 ` Eduardo Otubo 2017-11-20 12:59 ` Eduardo Otubo 2017-11-20 10:49 ` Wei Liu 2017-11-20 10:55 ` Paul Durrant [this message] 2017-11-20 10:55 ` Paul Durrant 2017-11-20 12:56 ` 'Eduardo Otubo' 2017-11-20 12:56 ` 'Eduardo Otubo' 2017-11-22 11:44 ` kbuild test robot 2017-11-22 11:44 ` kbuild test robot -- strict thread matches above, loose matches on Subject: below -- 2017-11-20 10:41 Eduardo Otubo
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=593f1c5a3bf24a2dbce56287391e776d@AMSPEX02CL03.citrite.net \ --to=paul.durrant@citrix.com \ --cc=cavery@redhat.com \ --cc=cheshi@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mgamal@redhat.com \ --cc=netdev@vger.kernel.org \ --cc=otubo@redhat.com \ --cc=vkuznets@redhat.com \ --cc=wei.liu2@citrix.com \ --cc=xen-devel@lists.xenproject.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.