]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
virtio_net: invoke softirqs after __napi_schedule
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 16 May 2012 07:57:12 +0000 (10:57 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 17 May 2012 09:16:38 +0000 (12:16 +0300)
__napi_schedule might raise softirq but nothing
causes do_softirq to trigger, so it does not in fact
run. As a result,
the error message "NOHZ: local_softirq_pending 08"
sometimes occurs during boot of a KVM guest when the network service is
started and we are oom:

  ...
  Bringing up loopback interface:  [  OK  ]
  Bringing up interface eth0:
  Determining IP information for eth0...NOHZ: local_softirq_pending 08
   done.
  [  OK  ]
  ...

Further, receive queue processing might get delayed
indefinitely until some interrupt triggers:
virtio_net expected napi to be run immediately.

One way to cause do_softirq to be executed is by
invoking local_bh_enable(). As __napi_schedule is
normally called from bh or irq context, this
seems to make sense: disable bh before __napi_schedule
and enable afterwards.

In fact it's a very complicated way of calling do_softirq(),
and works since this function is only used when we are not
in interrupt context.  It's not hot at all, in any ideal scenario.

Reported-by: Ulrich Obergfell <uobergfe@redhat.com>
Tested-by: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/net/virtio_net.c

index af8acc85f4bbd15bf01e939db20932845d7b8312..cbefe671bcc6926111b0735fca734031e8b11268 100644 (file)
@@ -492,7 +492,9 @@ static void virtnet_napi_enable(struct virtnet_info *vi)
         * We synchronize against interrupts via NAPI_STATE_SCHED */
        if (napi_schedule_prep(&vi->napi)) {
                virtqueue_disable_cb(vi->rvq);
+               local_bh_disable();
                __napi_schedule(&vi->napi);
+               local_bh_enable();
        }
 }