From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: in-kernel interrupt controller steering Date: Wed, 6 Mar 2013 13:26:29 +0200 Message-ID: <20130306112629.GO11223@redhat.com> References: <20130306095835.GL11223@redhat.com> <2032322197.3144778.1362566313469.JavaMail.root@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Alexander Graf , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Stuart Yoder , Scott Wood , Paul Mackerras , Peter Maydell To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <2032322197.3144778.1362566313469.JavaMail.root@redhat.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, Mar 06, 2013 at 05:38:33AM -0500, Paolo Bonzini wrote: >=20 >=20 > ----- Messaggio originale ----- > > Da: "Gleb Natapov" > > A: "Paolo Bonzini" > > Cc: "Alexander Graf" , kvm@vger.kernel.org, kvm-ppc@= vger.kernel.org, "Stuart Yoder" > > , "Scott Wood" , "Paul Mackerras" , "Peter > > Maydell" > > Inviato: Mercoled=C3=AC, 6 marzo 2013 10:58:35 > > Oggetto: Re: in-kernel interrupt controller steering > >=20 > > On Wed, Mar 06, 2013 at 10:40:18AM +0100, Paolo Bonzini wrote: > > > Il 05/03/2013 16:25, Gleb Natapov ha scritto: > > > >> 1) We need to set the generic interrupt type of the system > > > >> before we create vcpus. > > > >> > > > >> This is a new ioctl that sets the overall system interrupt > > > >> controller type to a specific model. This used so that when we > > > >> create vcpus, we can create the appended "local interrupt > > > >> controller" state without the actual interrupt controller > > > >> device available yet. It is also used later to switch between > > > >> interrupt controller implementations. > > > >> > > > >> This interrupt type is write once and frozen after the first > > > >> vcpu got created. > > > > > > > > Why explicit ioctl is needed? Why not require specific irqchip = to > > > > be > > > > created before first vcpu. The device created determines system > > > > interrupt > > > > controller type. > > >=20 > > > QEMU creates CPUs before devices, and CPUs need to know what kind= of > > > local interrupt controller to create. Similar to how in-kernel L= APIC > > > state is created long before the userspace device that proxies th= e > > > LAPIC. > > > > So what is the difference between calling this special ioctl before > > creating vcpus and calling create device ioctl instead and create > > QEMU proxy device at whatever point in time QEMU wants to create it= ? >=20 > Because you'd have to stash the handle that KVM_CREATE_DEVICE returns > somewhere, waiting for the QEMU device to be created. >=20 OK, we try not to add interfaces for one userspace convenience though. Is this such insurmountable problem for QEMU? > Perhaps it's just a problem of naming, and KVM_CREATE_DEVICE is simpl= y > not the right name for the interface. Once both KVM_CREATE_IRQCHIP_A= RGS > and KVM_CREATE_DEVICE are added, it really will not create the device= anymore. > Devices will be created by KVM_CREATE_IRQCHIP_ARGS, and possibly by > KVM_CREATE_VCPU. KVM_CREATE_DEVICE is really only returning an id. >=20 > So we can have this instead: > - KVM_CREATE_IRQCHIP_ARGS becomes KVM_SET_IRQCHIP_TYPE (and "none" > can be a valid irqchip type). >=20 > - KVM_CREATE_DEVICE becomes KVM_GET_IRQCHIP_DEVICE, and you pass it a > device type and possibly a VCPU number. >=20 > It's mostly about names, but one important property is that > KVM_GET_IRQCHIP_DEVICE can be called at any time and, in fact, > multiple times. Gleb, do you like this more? >=20 If you put it like this it sounds better (well you've just stashed the handle in kernel for QEMU convenience :)), but you've made the interfac= e irqchips specific again and this is what we are trying to avoid. -- Gleb.