From mboxrd@z Thu Jan 1 00:00:00 1970 From: Asias He Subject: Re: [PATCH 1/3] kvm tools: Make virtio-net kvm__irq_line thread safe Date: Fri, 29 Apr 2011 15:47:10 +0800 Message-ID: <4DBA6CFE.5090400@gmail.com> References: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> <20110429073006.GB16371@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Pekka Enberg , Cyrill Gorcunov , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org To: Ingo Molnar Return-path: Received: from mail-pw0-f46.google.com ([209.85.160.46]:49216 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754537Ab1D2HsX (ORCPT ); Fri, 29 Apr 2011 03:48:23 -0400 Received: by pwi15 with SMTP id 15so1675114pwi.19 for ; Fri, 29 Apr 2011 00:48:22 -0700 (PDT) In-Reply-To: <20110429073006.GB16371@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On 04/29/2011 03:30 PM, Ingo Molnar wrote: > > * Asias He wrote: > >> This patch fixes virtio-net randmom stall >> >> host $ scp guest:/root/big.guest . >> big.guest 42% 440MB 67.7KB/s - stalled - > >> @@ -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); > > The movement of the irq-line assertion call (which fixes the hangs) should be > separated from the mutex_lock() additions (which look unnecessary). I've sent out another patch to move this irq assertion. > > Could you please check whether the addition of the mutex really is necessary to > solve the hang/stall? Without the mutex around the kvm__irq_line, I am still seeing the hangs(with the irq assertion movement patch). I can reproduce this by: host$ scp guest:/root/big.guest . guest$ ping host Not sure if the mutex thing is necessary. > > Thanks, > > Ingo > -- Best Regards, Asias He