From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [RFC PATCH] kvm: Extend irqfd to support level interrupts Date: Mon, 18 Jun 2012 13:11:56 +0300 Message-ID: <20120618101156.GB23134@redhat.com> References: <20120616163230.15204.61075.stgit@bling.home> <4FDEE0A3.80900@redhat.com> <4FDEEC52.8080806@siemens.com> <4FDEF5CD.8090806@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kiszka , Alex Williamson , "mtosatti@redhat.com" , "kvm@vger.kernel.org" To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1564 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552Ab2FRKMC (ORCPT ); Mon, 18 Jun 2012 06:12:02 -0400 Content-Disposition: inline In-Reply-To: <4FDEF5CD.8090806@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jun 18, 2012 at 12:33:01PM +0300, Avi Kivity wrote: > On 06/18/2012 11:52 AM, Jan Kiszka wrote: > >> > >> I don't understand how this works. A level IRQ isn't de-asserted by the > >> EOI, it's de-asserted by its source. > >> > >> Consider the following sequence: > >> > >> device guest > >> > >> event > >> assert > >> interrupt > >> interrupt handler > >> handle event > >> clear ISR bit > >> deassert > >> event > >> assert > >> EOI > >> > >> What should happen is that the interrupt will be redelivered > >> immmediately after the EOI, but that won't happen with your API since > >> the EOI ack notifier will deassert the interrupt and nothing will > >> re-assert it. > > > > As it's level triggered and we unmask the physical source, another > > host-side interrupt will be triggered and then reported to the guest. > > That works for real devices. What about emulated devices It's broken for userspace too. I guess it should track the logical state of the device per source id. On ack, it should clear it for assigned devices only, do the logical OR over all source IDs and set level to that. > (vhost, > msi-less ivshmem clone)? I guess vhost can poll eventfd and reinject an interrupt. Of course to bypass qemu completely we also need to support reads over ioeventfd somehow. > -- > error compiling committee.c: too many arguments to function >