Skip to contentSkip to conversation

Check device status in tx timer

PATCH In review Dor Laor 1 participant 2 messages Mar 4, 2008 1 message not in the archive KVM

lore
Share & tools
lore

Dor Laor

author
#0 lore raw

PATCH 1/1 Check device status in tx timer

repository: /home/dor/src/merge/kvm
branch: trunk
commit acdb6d2aa7332179eead306ead17494ae23edbd6

Author: Dor Laor <[email protected]>
Date:   Tue Mar 4 08:16:06 2008 -0500

Check device status in tx timer.

The device can be down when the timer pops.
If it is down it will cause segfault.
It might happen on migration but also on regular operation when the device sends packets and quickly goes down before the host timer pops.

qemu/hw/virtio-net.c +4 -0
index 612cf6b..a05eafb 100644
@@ -280,6 +280,10 @@ static void virtio_net_tx_timer(void *opaque)
 {
     VirtIONet *n = opaque;
 
+    /* Just in case the driver is not ready on more */
+    if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))
+        return;
+
     n->tx_vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
     n->tx_timer_active = 0;
     virtio_net_flush_tx(n, n->tx_vq);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 8 lines
qemu/hw/virtio-net.c +0 -0
index 612cf6b..a05eafb 100644
@@ -280,6 +280,10 @@ static void virtio_net_tx_timer(void *opaque)
 {
     VirtIONet *n = opaque;
 
Quoted 8 lines

qemu/hw/virtio-net.c static void virtio_net_tx_timer(void *opaque)

Quoted 5 lines
qemu/hw/virtio-net.c +4 -0
+    /* Just in case the driver is not ready on more */
+    if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))
+        return;
+
 

You probably want to set tx_timer_active = 0 here too.

yap, thanks.

Quoted 10 lines

Regards,

Anthony Liguori

Quoted 5 lines
qemu/hw/virtio-net.c +0 -0
     n->tx_vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
     n->tx_timer_active = 0;
     virtio_net_flush_tx(n, n->tx_vq);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/