From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.25.77.65 with SMTP id a62csp1804166lfb; Tue, 24 Jan 2017 07:14:57 -0800 (PST) X-Received: by 10.55.4.138 with SMTP id 132mr29689635qke.190.1485270897334; Tue, 24 Jan 2017 07:14:57 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z28si13338870qtb.248.2017.01.24.07.14.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Jan 2017 07:14:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Received: from localhost ([::1]:50634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW2oA-0007No-Ih for alex.bennee@linaro.org; Tue, 24 Jan 2017 10:14:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW2fM-0007iU-JG for qemu-arm@nongnu.org; Tue, 24 Jan 2017 10:05:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cW2fI-00019C-SG for qemu-arm@nongnu.org; Tue, 24 Jan 2017 10:05:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58372) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cW2fI-00018a-Ie; Tue, 24 Jan 2017 10:05:44 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B02766AAD3; Tue, 24 Jan 2017 15:05:44 +0000 (UTC) Received: from redhat.com (ovpn-117-58.rdu2.redhat.com [10.10.117.58]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id v0OF5hTP006416; Tue, 24 Jan 2017 10:05:43 -0500 Date: Tue, 24 Jan 2017 17:05:42 +0200 From: "Michael S. Tsirkin" To: Paolo Bonzini Message-ID: <20170124170514-mutt-send-email-mst@kernel.org> References: <1485132904-17632-1-git-send-email-zhaoshenglong@huawei.com> <20170123180247-mutt-send-email-mst@kernel.org> <49fcc1e0-f439-9212-25f1-9b8dce6462cc@redhat.com> <20170123190257-mutt-send-email-mst@kernel.org> <5760ee8c-f567-0dfd-456f-65f8957b22e2@redhat.com> <20170124164204-mutt-send-email-mst@kernel.org> <9a61e616-9bf8-b4ff-43b9-68f1c908b910@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a61e616-9bf8-b4ff-43b9-68f1c908b910@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 24 Jan 2017 15:05:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-arm] [PATCH V2] virtio: Fix no interrupt when not creating msi controller X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, christoffer.dall@linaro.org, Shannon Zhao Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: lxQ1QAufwU1H On Tue, Jan 24, 2017 at 04:00:55PM +0100, Paolo Bonzini wrote: > > > On 24/01/2017 15:44, Michael S. Tsirkin wrote: > > On Tue, Jan 24, 2017 at 10:25:00AM +0100, Paolo Bonzini wrote: > >> > >> > >> On 23/01/2017 18:04, Michael S. Tsirkin wrote: > >>>> For virtio-blk, my patch moved the setting of ISR from > >>>> virtio_queue_guest_notifier_read to virtio_notify_irqfd. This is > >>>> because the irqfd emulation only needs to trigger the interrupt. > >>>> Setting the ISR should have been done elsewhere. > >>>> > >>>> Can vhost set ISR (I thought it couldn't)? If so, it seems like ARM was > >>>> relying on QEMU's irqfd emulation, as a work around for vhost not > >>>> setting ISR. But this only works if irqfd is directed to QEMU and not > >>>> to KVM. So if vhost cannot set ISR, I think vhost should be disabled > >>>> unless MSI is active. > >>>> > >>>> Am I missing something? > >>> > >>> vhost doesn't set ISR ATM. Without MSI we are always bouncing > >>> interrupts through QEMU in particular in order to set ISR. > >> > >> Where is the code that disables KVM irqfd? > > > > This bit in virtio_pci_set_guest_notifiers does the trick I think: > > > > > > bool with_irqfd = msix_enabled(&proxy->pci_dev) && > > kvm_msi_via_irqfd_enabled(); > > > > I don't think we ever used irqfd for level interrupts. > > Ok, thanks! > > So we have four cases: > > - assign with emulated irqfd + ISR > - assign with emulated irqfd > - assign with irqfd > - deassign > > Currently we don't distinguish the first two, so (which I don't like) > Shannon's patch ends up setting ISR twice. I don't see this yet - where is it set twice? > The only (ugly) solution > that comes to mind is making with_irqfd an enum... > > Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW2fO-0007kQ-L8 for qemu-devel@nongnu.org; Tue, 24 Jan 2017 10:05:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cW2fN-0001CA-LJ for qemu-devel@nongnu.org; Tue, 24 Jan 2017 10:05:50 -0500 Date: Tue, 24 Jan 2017 17:05:42 +0200 From: "Michael S. Tsirkin" Message-ID: <20170124170514-mutt-send-email-mst@kernel.org> References: <1485132904-17632-1-git-send-email-zhaoshenglong@huawei.com> <20170123180247-mutt-send-email-mst@kernel.org> <49fcc1e0-f439-9212-25f1-9b8dce6462cc@redhat.com> <20170123190257-mutt-send-email-mst@kernel.org> <5760ee8c-f567-0dfd-456f-65f8957b22e2@redhat.com> <20170124164204-mutt-send-email-mst@kernel.org> <9a61e616-9bf8-b4ff-43b9-68f1c908b910@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a61e616-9bf8-b4ff-43b9-68f1c908b910@redhat.com> Subject: Re: [Qemu-devel] [PATCH V2] virtio: Fix no interrupt when not creating msi controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Shannon Zhao , qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org On Tue, Jan 24, 2017 at 04:00:55PM +0100, Paolo Bonzini wrote: > > > On 24/01/2017 15:44, Michael S. Tsirkin wrote: > > On Tue, Jan 24, 2017 at 10:25:00AM +0100, Paolo Bonzini wrote: > >> > >> > >> On 23/01/2017 18:04, Michael S. Tsirkin wrote: > >>>> For virtio-blk, my patch moved the setting of ISR from > >>>> virtio_queue_guest_notifier_read to virtio_notify_irqfd. This is > >>>> because the irqfd emulation only needs to trigger the interrupt. > >>>> Setting the ISR should have been done elsewhere. > >>>> > >>>> Can vhost set ISR (I thought it couldn't)? If so, it seems like ARM was > >>>> relying on QEMU's irqfd emulation, as a work around for vhost not > >>>> setting ISR. But this only works if irqfd is directed to QEMU and not > >>>> to KVM. So if vhost cannot set ISR, I think vhost should be disabled > >>>> unless MSI is active. > >>>> > >>>> Am I missing something? > >>> > >>> vhost doesn't set ISR ATM. Without MSI we are always bouncing > >>> interrupts through QEMU in particular in order to set ISR. > >> > >> Where is the code that disables KVM irqfd? > > > > This bit in virtio_pci_set_guest_notifiers does the trick I think: > > > > > > bool with_irqfd = msix_enabled(&proxy->pci_dev) && > > kvm_msi_via_irqfd_enabled(); > > > > I don't think we ever used irqfd for level interrupts. > > Ok, thanks! > > So we have four cases: > > - assign with emulated irqfd + ISR > - assign with emulated irqfd > - assign with irqfd > - deassign > > Currently we don't distinguish the first two, so (which I don't like) > Shannon's patch ends up setting ISR twice. I don't see this yet - where is it set twice? > The only (ugly) solution > that comes to mind is making with_irqfd an enum... > > Paolo