* Asias He <[email protected]> wrote:

> This patch fixes virtio-net randmom stall
> 
> host $ scp guest:/root/big.guest .
> big.guest 42%  440MB  67.7KB/s - stalled -
> 
> Signed-off-by: Asias He <[email protected]>
> ---
>  tools/kvm/virtio-net.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/kvm/virtio-net.c b/tools/kvm/virtio-net.c
> index 58b3de4..efe06cb 100644
> --- a/tools/kvm/virtio-net.c
> +++ b/tools/kvm/virtio-net.c
> @@ -77,9 +77,12 @@ static void virtio_net_rx_callback(struct kvm *self, void 
> *param)
>               head = virt_queue__get_iov(vq, iov, &out, &in, self);
>               len = readv(net_device.tap_fd, iov, in);
>               virt_queue__set_used_elem(vq, head, len);
> -     }
>  
> -     kvm__irq_line(self, VIRTIO_NET_IRQ, 1);
> +             /* We should interrupt guest right now, otherwise latency is 
> huge. */
> +             mutex_lock(&net_device.mutex);
> +             kvm__irq_line(self, VIRTIO_NET_IRQ, 1);
> +             mutex_unlock(&net_device.mutex);
> +     }
>  }
>  
>  static void virtio_net_tx_callback(struct kvm *self, void *param)
> @@ -98,7 +101,9 @@ static void virtio_net_tx_callback(struct kvm *self, void 
> *param)
>               virt_queue__set_used_elem(vq, head, len);
>       }
>  
> +     mutex_lock(&net_device.mutex);
>       kvm__irq_line(self, VIRTIO_NET_IRQ, 1);
> +     mutex_unlock(&net_device.mutex);

I do not find this explanation adequate either. This file too could use some 
comments about how the SMP behavior looks like.

Thanks,

        Ingo
--
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

Reply via email to