* [PATCH] KVM: add schedule check to napi_enable call
@ 2010-06-04 0:48 Bruce Rogers
2010-06-06 9:40 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Rogers @ 2010-06-04 0:48 UTC (permalink / raw)
To: netdev; +Cc: rusty
Please consider this patch for the 2.6.32, 2.6.33, and 2.6.34 stable trees as well as current development trees. (I've only tested on 2.6.32 however)
virtio_net: Add schedule check to napi_enable call
Under harsh testing conditions, including low memory, the guest would
stop receiving packets. With this patch applied we no longer see any
problems in the driver while performing these tests for extended periods
of time.
Make sure napi is scheduled subsequent to each napi_enable.
Signed-off-by: Bruce Rogers <brogers@novell.com>
Signed-off-by: Olaf Kirch <okir@suse.de>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -388,6 +388,20 @@ static void skb_recv_done(struct virtque
}
}
+static void virtnet_napi_enable(struct virtnet_info *vi)
+{
+ napi_enable(&vi->napi);
+
+ /* If all buffers were filled by other side before we napi_enabled, we
+ * won't get another interrupt, so process any outstanding packets
+ * now. virtnet_poll wants re-enable the queue, so we disable here.
+ * We synchronize against interrupts via NAPI_STATE_SCHED */
+ if (napi_schedule_prep(&vi->napi)) {
+ vi->rvq->vq_ops->disable_cb(vi->rvq);
+ __napi_schedule(&vi->napi);
+ }
+}
+
static void refill_work(struct work_struct *work)
{
struct virtnet_info *vi;
@@ -397,7 +411,7 @@ static void refill_work(struct work_stru
napi_disable(&vi->napi);
try_fill_recv(vi, GFP_KERNEL);
still_empty = (vi->num == 0);
- napi_enable(&vi->napi);
+ virtnet_napi_enable(vi);
/* In theory, this can happen: if we don't get any buffers in
* we will *never* try to fill again. */
@@ -589,16 +603,7 @@ static int virtnet_open(struct net_devic
{
struct virtnet_info *vi = netdev_priv(dev);
- napi_enable(&vi->napi);
-
- /* If all buffers were filled by other side before we napi_enabled, we
- * won't get another interrupt, so process any outstanding packets
- * now. virtnet_poll wants re-enable the queue, so we disable here.
- * We synchronize against interrupts via NAPI_STATE_SCHED */
- if (napi_schedule_prep(&vi->napi)) {
- vi->rvq->vq_ops->disable_cb(vi->rvq);
- __napi_schedule(&vi->napi);
- }
+ virtnet_napi_enable(vi);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] KVM: add schedule check to napi_enable call
2010-06-04 0:48 [PATCH] KVM: add schedule check to napi_enable call Bruce Rogers
@ 2010-06-06 9:40 ` Herbert Xu
2010-06-14 20:44 ` Bruce Rogers
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2010-06-06 9:40 UTC (permalink / raw)
To: Bruce Rogers; +Cc: netdev, rusty
Bruce Rogers <brogers@novell.com> wrote:
> Please consider this patch for the 2.6.32, 2.6.33, and 2.6.34 stable trees as well as current development trees. (I've only tested on 2.6.32 however)
>
> virtio_net: Add schedule check to napi_enable call
> Under harsh testing conditions, including low memory, the guest would
> stop receiving packets. With this patch applied we no longer see any
> problems in the driver while performing these tests for extended periods
> of time.
>
> Make sure napi is scheduled subsequent to each napi_enable.
>
> Signed-off-by: Bruce Rogers <brogers@novell.com>
> Signed-off-by: Olaf Kirch <okir@suse.de>
> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
> Cc: stable@kernel.org
Looks good to me.
Thanks!
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] KVM: add schedule check to napi_enable call
2010-06-06 9:40 ` Herbert Xu
@ 2010-06-14 20:44 ` Bruce Rogers
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Rogers @ 2010-06-14 20:44 UTC (permalink / raw)
To: Herbert Xu; +Cc: rusty, netdev
>>> On 6/6/2010 at 03:40 AM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Bruce Rogers <brogers@novell.com> wrote:
>> Please consider this patch for the 2.6.32, 2.6.33, and 2.6.34 stable trees
> as well as current development trees. (I've only tested on 2.6.32 however)
>>
>> virtio_net: Add schedule check to napi_enable call
>> Under harsh testing conditions, including low memory, the guest would
>> stop receiving packets. With this patch applied we no longer see any
>> problems in the driver while performing these tests for extended periods
>> of time.
>>
>> Make sure napi is scheduled subsequent to each napi_enable.
>>
>> Signed-off-by: Bruce Rogers <brogers@novell.com>
>> Signed-off-by: Olaf Kirch <okir@suse.de>
>> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: stable@kernel.org
>
> Looks good to me.
>
> Thanks!
Thanks for the review.
We are hoping to get this into our 2.6.32 based sle11 sp1 maintenance update. Are there any concerns with this patch?
Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-14 20:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-04 0:48 [PATCH] KVM: add schedule check to napi_enable call Bruce Rogers
2010-06-06 9:40 ` Herbert Xu
2010-06-14 20:44 ` Bruce Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox