From mboxrd@z Thu Jan 1 00:00:00 1970 From: Asias He Subject: Re: [PATCH 3/3] kvm tools: Make virtio-blk kvm__irq_line thread safe Date: Fri, 29 Apr 2011 15:26:20 +0800 Message-ID: <4DBA681C.4090707@gmail.com> References: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> <1304058985-13833-3-git-send-email-asias.hejun@gmail.com> <20110429064433.GB13893@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Ingo Molnar , Cyrill Gorcunov , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org To: Pekka Enberg Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:63888 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754475Ab1D2H1c (ORCPT ); Fri, 29 Apr 2011 03:27:32 -0400 Received: by pzk9 with SMTP id 9so2040088pzk.19 for ; Fri, 29 Apr 2011 00:27:32 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 04/29/2011 02:55 PM, Pekka Enberg wrote: > On Fri, Apr 29, 2011 at 9:44 AM, Ingo Molnar wrote: >> Hm, this looks a bit strange (the mutex here protects only a kernel call - that >> cannot be right) and there's no explanation why it's needed. Why do >> VIRTIO_BLK_IRQ (== KVM_IRQ_LINE ioctl()) calls have to be covered by the mutex? >> >> A short blurb about expected behavior on SMP and locking rules at the top of >> virtio-blk.c would be nice. > > Yes, looks strange. Asias, did you see some bad behavior that this > fixes? Yes. I see random virtio net hangs with scp test. This commit 847838c573f4c04be7547f508a99be2dfdefb4fd triggers this problem as we are using separte irq lines for each virtio devices instead of sharing one irq line for all virtio devices. > The per-device mutexes are there to protect device state. The > assumption here is that KVM handles KVM_IRQ_LINE ioctl() serialization > by titself. -- Best Regards, Asias He