Skip to contentSkip to conversation

KVM: add schedule check to napi_enable call

PATCH In review Bruce Rogers 4 participants 8 messages Jun 3, 2010 – Dec 6, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 KVM: add schedule check to napi_enable call

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.

drivers/net/virtio_net.c +16 -11
@@ -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;
 }
 
#1 lore raw
Quoted 10 lines · Bruce Rogers

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.

I need a git commit id for this one as well.

thanks,

greg k-h

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 6 lines · Bruce Rogers

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.

Quoted 7 lines
Quoted 4 lines

Make sure napi is scheduled subsequent to each napi_enable.

I need a git commit id for this one as well.

This one is not upstream.

Bruce

#3 lore raw
Quoted 10 lines · Bruce Rogers
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 8 lines · Bruce Rogers

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.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I need a git commit id for this one as well.

This one is not upstream.

Then I can't include it in the -stable tree, so why are you sending it to me? :)

thanks,

greg k-h

#4 lore raw
Quoted 19 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 6 lines · Bruce Rogers
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 4 lines · Bruce Rogers

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

Quoted 10 lines
Quoted 9 lines
Quoted 6 lines

of time.

Make sure napi is scheduled subsequent to each napi_enable.

I need a git commit id for this one as well.

Quoted 8 lines
Quoted 1 line

This one is not upstream.

Then I can't include it in the -stable tree, so why are you sending it to me? :)

thanks,

greg k-h

Good point!
Sorry about the confusion.
Bruce

#5 lore raw
In reply to Greg KH
Quoted 19 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 6 lines · Bruce Rogers
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 4 lines · Bruce Rogers

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

Quoted 10 lines
Quoted 9 lines
Quoted 6 lines

of time.

Make sure napi is scheduled subsequent to each napi_enable.

I need a git commit id for this one as well.

Quoted 8 lines
Quoted 1 line

This one is not upstream.

Then I can't include it in the -stable tree, so why are you sending it to me? :)

thanks,

greg k-h

Good point!
Sorry about the confusion.
Bruce

#6 lore raw

Am 04.06.2010 um 02:02 schrieb Bruce Rogers:

Quoted 24 lines
Quoted 24 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 6 lines · Bruce Rogers
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Greg KH
Quoted 4 lines · Bruce Rogers

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

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

of time.

Make sure napi is scheduled subsequent to each napi_enable.

I need a git commit id for this one as well.

This one is not upstream.

Then I can't include it in the -stable tree, so why are you sending it to me? :)

Quoted 7 lines
Quoted 3 lines

thanks,

greg k-h

Good point!
Sorry about the confusion.
Bruce

Is there any reason why this patch is not yet in the stable kernel? virtio_net is still crashing under heavy load in current vanilla kernel. This patch *might be* the solution.

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 3 lines · Peter Lieven

Is there any reason why this patch is not yet in the stable kernel? virtio_net is still crashing under heavy load in current vanilla kernel. This patch *might be* the solution.

Perhaps some confusion. I've asked Greg to take kvm patches from Marcelo and myself (after they've been autotested), however virtio is not kvm, so the normal stable@ free-for-all applies.

Signature · 1 line
error compiling committee.c: too many arguments to function