WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [xen-unstable test] 1959: FAIL [and 1 more messages]

To: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [xen-unstable test] 1959: FAIL [and 1 more messages]
From: "Xu, Dongxiao" <dongxiao.xu@xxxxxxxxx>
Date: Thu, 12 Aug 2010 08:37:44 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "Xen-devel@xxxxxxxxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Wed, 11 Aug 2010 17:44:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1281538860.3170.158.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1OeOpE-0008C1-Jl@xxxxxxxxxxxxxxxxxxx> <E1OcaPH-0005MQ-Ay@xxxxxxxxxxxxxxxxxxx> <4C4B1B8A.6070403@xxxxxxxx> <19533.23953.645991.205290@xxxxxxxxxxxxxxxxxxxxxxxx> <4C4DC4AF.2090901@xxxxxxxx> <19535.145.995122.44883@xxxxxxxxxxxxxxxxxxxxxxxx> <4C4F063C.9030301@xxxxxxxx> <19535.2235.492925.965460@xxxxxxxxxxxxxxxxxxxxxxxx> <4C4F0B18.5080800@xxxxxxxx> <19535.3062.112242.870153@xxxxxxxxxxxxxxxxxxxxxxxx> <4C4F0FDB.2010607@xxxxxxxx> <19537.40568.143464.400709@xxxxxxxxxxxxxxxxxxxxxxxx> <4C51A084.5010903@xxxxxxxx> <19537.44367.380875.758088@xxxxxxxxxxxxxxxxxxxxxxxx> <4C51AE8C.4000206@xxxxxxxx> <D5AB6E638E5A3E4B8F4406B113A5A19A28CCF46E@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <1280481518.24292.1882.camel@xxxxxxxxxxxxxxxxxxxxxx> ,<4C618EA9.7090901@xxxxxxxx> <D5AB6E638E5A3E4B8F4406B113A5A19A28E6E2BB@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, <1281538860.3170.158.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acs5ZgWkyl+2GwH0TKyr3XK8EIMa+gAUI7FC
Thread-topic: [Xen-devel] [xen-unstable test] 1959: FAIL [and 1 more messages]
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.

Thanks,
Dongxiao 

________________________________________
From: Ian Campbell [Ian.Campbell@xxxxxxxxxxxxx]
Sent: Wednesday, August 11, 2010 8:01 AM
To: Xu, Dongxiao
Cc: Jeremy Fitzhardinge; Ian Jackson; Xen-devel@xxxxxxxxxxxxxxxxxxx
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 <dongxiao.xu@xxxxxxxxx>
> 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 <dongxiao.xu@xxxxxxxxx>
> ---
>  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,
>  };
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel