From: Ingo Molnar Subject: Re: [PATCH 1/3] kvm tools: Make virtio-net kvm__irq_line thread safe Date: Fri, 29 Apr 2011 09:30:06 +0200 Message-ID: <20110429073006.GB16371@elte.hu> References: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Pekka Enberg , Cyrill Gorcunov , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org To: Asias He Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:58136 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755945Ab1D2HaL (ORCPT ); Fri, 29 Apr 2011 03:30:11 -0400 Content-Disposition: inline In-Reply-To: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: * 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). Could you please check whether the addition of the mutex really is necessary to solve the hang/stall? Thanks, Ingo