From: Ian Campbell Subject: RE: [xen-unstable test] 1959: FAIL [and 1 more messages] Date: Fri, 13 Aug 2010 08:16:08 +0100 Message-ID: <1281683768.3170.210.camel@zakaz.uk.xensource.com> References: <4C4B1B8A.6070403@goop.org> <19533.23953.645991.205290@mariner.uk.xensource.com> <4C4DC4AF.2090901@goop.org> <19535.145.995122.44883@mariner.uk.xensource.com> <4C4F063C.9030301@goop.org> <19535.2235.492925.965460@mariner.uk.xensource.com> <4C4F0B18.5080800@goop.org> <19535.3062.112242.870153@mariner.uk.xensource.com> <4C4F0FDB.2010607@goop.org> <19537.40568.143464.400709@mariner.uk.xensource.com> <4C51A084.5010903@goop.org> <19537.44367.380875.758088@mariner.uk.xensource.com> <4C51AE8C.4000206@goop.org> <1280481518.24292.1882.camel@zakaz.uk.xensource.com> ,<4C618EA9.7090901@goop.org> ,<1281538860.3170.158.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Xu, Dongxiao" Cc: Jeremy Fitzhardinge , "Xen-devel@lists.xensource.com" , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Thu, 2010-08-12 at 01:37 +0100, Xu, Dongxiao wrote: > Hi Ian, > > Currently logic (2) is not needed to make s/r work, since sring is set > to NULL after resume. However I think this check could avoid error if > later any code sets sring to NULL in other places. So I still place it > there. OK, that's fair enough. Ian. > > Thanks, > Dongxiao > > ________________________________________ > From: Ian Campbell [Ian.Campbell@eu.citrix.com] > Sent: Wednesday, August 11, 2010 8:01 AM > To: Xu, Dongxiao > Cc: Jeremy Fitzhardinge; Ian Jackson; Xen-devel@lists.xensource.com > Subject: RE: [Xen-devel] [xen-unstable test] 1959: FAIL [and 1 more messages] > > On Wed, 2010-08-11 at 04:19 +0100, Xu, Dongxiao wrote: > > From 791fc8ed6e2888af3bd398f22562776c757cc4ac Mon Sep 17 00:00:00 2001 > > From: Dongxiao Xu > > Date: Wed, 11 Aug 2010 11:06:06 +0800 > > Subject: [PATCH] Netfront: Fix save/restore after enabled smart poll > > feature > > > > When s/r the guest, the shared ring will be set to NULL, and > > in this case the polling timer interrupt should stop. > > > > This fix includes the two parts: > > 1) Stop hrtimer when guest suspends. > > 2) Add check to avoid NULL pointer dereference. > > Looks good to me but do you really need 2) given 1)? > > Ian. > > > > > > Thanks Ian J for reporting the problem. > > > > Signed-off-by: Dongxiao Xu > > --- > > drivers/net/xen-netfront.c | 13 +++++++++++++ > > 1 files changed, 13 insertions(+), 0 deletions(-) > > > > diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c > > index 328fe40..eaea132 100644 > > --- a/drivers/net/xen-netfront.c > > +++ b/drivers/net/xen-netfront.c > > @@ -1289,6 +1289,14 @@ static void xennet_disconnect_backend(struct > > netfront_info *info) > > info->rx.sring = NULL; > > } > > > > +static int netfront_suspend(struct xenbus_device *dev, pm_message_t > > state) > > +{ > > + struct netfront_info *info = dev_get_drvdata(&dev->dev); > > + struct hrtimer *timer = &info->smart_poll.timer; > > + hrtimer_cancel(timer); > > + return 0; > > +} > > + > > /** > > * We are reconnecting to the backend, due to a suspend/resume, or a > > backend > > * driver restart. We tear down our netif structure and recreate it, > > but > > @@ -1340,6 +1348,10 @@ static enum hrtimer_restart > > smart_poll_function(struct hrtimer *timer) > > np = netdev_priv(dev); > > > > spin_lock_irqsave(&np->tx_lock, flags); > > + > > + if (!np->rx.sring) > > + goto end; > > + > > np->smart_poll.counter++; > > > > if (likely(netif_carrier_ok(dev))) { > > @@ -1910,6 +1922,7 @@ static struct xenbus_driver netfront_driver = { > > .ids = netfront_ids, > > .probe = netfront_probe, > > .remove = __devexit_p(xennet_remove), > > + .suspend = netfront_suspend, > > .resume = netfront_resume, > > .otherend_changed = netback_changed, > > };