From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [Qemu-devel] Re: [PATCH 26/35] kvm: Eliminate KVMState arguments Date: Tue, 11 Jan 2011 15:24:05 +0100 Message-ID: <579B48DC-7298-4991-9D63-336FF258FF98@suse.de> References: <4D2616D6.4080309@linux.vnet.ibm.com> <4D26D6CF.5070405@web.de> <4D27A16F.9030809@linux.vnet.ibm.com> <4D282489.90506@web.de> <4D2B6506.6070907@linux.vnet.ibm.com> <4D2B6845.7050809@web.de> <4D2B6ADD.4090505@codemonkey.ws> <4D2C1C5D.2050504@redhat.com> <4D2C6290.1060607@linux.vnet.ibm.com> <1EA102F5-B6C2-43BC-9493-0271B287FC18@suse.de> <4D2C649F.6080508@linux.vnet.ibm.com> Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Cc: Avi Kivity , Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from cantor.suse.de ([195.135.220.2]:38548 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753799Ab1AKOYI convert rfc822-to-8bit (ORCPT ); Tue, 11 Jan 2011 09:24:08 -0500 In-Reply-To: <4D2C649F.6080508@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11.01.2011, at 15:09, Anthony Liguori wrote: > On 01/11/2011 08:06 AM, Alexander Graf wrote: >> On 11.01.2011, at 15:00, Anthony Liguori wrote: >> >> >>> On 01/11/2011 03:01 AM, Avi Kivity wrote: >>> >>>> On 01/10/2011 10:23 PM, Anthony Liguori wrote: >>>> >>>>>>> I don't see how ioapic, pit, or pic have a system scope. >>>>>>> >>>>>> They are not bound to any CPU like the APIC which you may have in mind. >>>>>> >>>>> And none of the above interact with KVM. >>>>> >>>> They're implemented by kvm. What deeper interaction do you have in mind? >>>> >>> The emulated ioapic/pit/pic do not interact with KVM at all. >>> >>> The KVM versions should be completely separate devices. >>> >>> >>>> >>>>> They may be replaced by KVM but if you look at the PIT, this is done by having two distinct devices. The KVM specific device can (and should) be instantiated with kvm_state. >>>>> >>>>> The way the IOAPIC/APIC/PIC is handled in qemu-kvm is nasty. The kernel devices are separate devices and that should be reflected in the device tree. >>>>> >>>> I don't see why. Those are just two different implementations for the same guest visible device. >>>> >>> Right, they should appear the same to the guest but the fact that they're two different implementations should be reflected in the device tree. >>> >>> >>>> It's like saying IDE should be seen differently if it's backed by qcow2 or qed. >>>> >>> No, it's not at all. >>> >>> Advantages of separating KVM devices: >>> >>> 1) it becomes very clear what functionality is handled in the kernel verses in userspace (you can actually look at the code and tell) >>> >>> 2) a user can explicitly create either the emulated version of the device or the in-kernel version of the device (no need for -no-kvm-irqchip) >>> >>> 3) a user can pass parameters directly to the in-kernel version of the device that are different from the userspace version (like selecting different interrupt catch-up methods) >>> >> Disadvantages: >> >> 1) you lose migration / savevm between KVM and non-KVM VMs >> > > This doesn't work today and it's never worked. KVM exposes things that TCG cannot emulate (like pvclock). Those cases simply shouldn't exist and hurt us (or at least me). I had exactly the pvclock issue with xenner. Xenner can't do proper timekeeping in emulation mode. So implementing an emulated pvclock implementation is (pretty low) on my todo list. > Even as two devices, nothing prevents it from working. Both devices just have to support each other's savevm format. If they use the same code, it makes it very easy. Take a look at how the KVM PIT is implemented for an example of this. If that's all it takes, fine. It makes it pretty hard to enforce, but I guess we can get away with that :). Making devices separate basically hurts abstraction. I don't see any use case where we should have a KVM device without emulation equivalent. For the CPU we also think of KVM as an accelerator instead of a separate device, no? :) Alex From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58536 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pcf8v-0005Lx-61 for qemu-devel@nongnu.org; Tue, 11 Jan 2011 09:24:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pcf8u-0005sN-0w for qemu-devel@nongnu.org; Tue, 11 Jan 2011 09:24:13 -0500 Received: from cantor.suse.de ([195.135.220.2]:38545 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pcf8t-0005qp-OA for qemu-devel@nongnu.org; Tue, 11 Jan 2011 09:24:11 -0500 Subject: Re: [Qemu-devel] Re: [PATCH 26/35] kvm: Eliminate KVMState arguments Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <4D2C649F.6080508@linux.vnet.ibm.com> Date: Tue, 11 Jan 2011 15:24:05 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <579B48DC-7298-4991-9D63-336FF258FF98@suse.de> References: <4D2616D6.4080309@linux.vnet.ibm.com> <4D26D6CF.5070405@web.de> <4D27A16F.9030809@linux.vnet.ibm.com> <4D282489.90506@web.de> <4D2B6506.6070907@linux.vnet.ibm.com> <4D2B6845.7050809@web.de> <4D2B6ADD.4090505@codemonkey.ws> <4D2C1C5D.2050504@redhat.com> <4D2C6290.1060607@linux.vnet.ibm.com> <1EA102F5-B6C2-43BC-9493-0271B287FC18@suse.de> <4D2C649F.6080508@linux.vnet.ibm.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Marcelo Tosatti , Jan Kiszka , Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org On 11.01.2011, at 15:09, Anthony Liguori wrote: > On 01/11/2011 08:06 AM, Alexander Graf wrote: >> On 11.01.2011, at 15:00, Anthony Liguori wrote: >>=20 >> =20 >>> On 01/11/2011 03:01 AM, Avi Kivity wrote: >>> =20 >>>> On 01/10/2011 10:23 PM, Anthony Liguori wrote: >>>> =20 >>>>>>> I don't see how ioapic, pit, or pic have a system scope. >>>>>>> =20 >>>>>> They are not bound to any CPU like the APIC which you may have in = mind. >>>>>> =20 >>>>> And none of the above interact with KVM. >>>>> =20 >>>> They're implemented by kvm. What deeper interaction do you have in = mind? >>>> =20 >>> The emulated ioapic/pit/pic do not interact with KVM at all. >>>=20 >>> The KVM versions should be completely separate devices. >>>=20 >>> =20 >>>> =20 >>>>> They may be replaced by KVM but if you look at the PIT, this is = done by having two distinct devices. The KVM specific device can (and = should) be instantiated with kvm_state. >>>>>=20 >>>>> The way the IOAPIC/APIC/PIC is handled in qemu-kvm is nasty. The = kernel devices are separate devices and that should be reflected in the = device tree. >>>>> =20 >>>> I don't see why. Those are just two different implementations for = the same guest visible device. >>>> =20 >>> Right, they should appear the same to the guest but the fact that = they're two different implementations should be reflected in the device = tree. >>>=20 >>> =20 >>>> It's like saying IDE should be seen differently if it's backed by = qcow2 or qed. >>>> =20 >>> No, it's not at all. >>>=20 >>> Advantages of separating KVM devices: >>>=20 >>> 1) it becomes very clear what functionality is handled in the kernel = verses in userspace (you can actually look at the code and tell) >>>=20 >>> 2) a user can explicitly create either the emulated version of the = device or the in-kernel version of the device (no need for = -no-kvm-irqchip) >>>=20 >>> 3) a user can pass parameters directly to the in-kernel version of = the device that are different from the userspace version (like selecting = different interrupt catch-up methods) >>> =20 >> Disadvantages: >>=20 >> 1) you lose migration / savevm between KVM and non-KVM VMs >> =20 >=20 > This doesn't work today and it's never worked. KVM exposes things = that TCG cannot emulate (like pvclock). Those cases simply shouldn't exist and hurt us (or at least me). I had = exactly the pvclock issue with xenner. Xenner can't do proper = timekeeping in emulation mode. So implementing an emulated pvclock = implementation is (pretty low) on my todo list. > Even as two devices, nothing prevents it from working. Both devices = just have to support each other's savevm format. If they use the same = code, it makes it very easy. Take a look at how the KVM PIT is = implemented for an example of this. If that's all it takes, fine. It makes it pretty hard to enforce, but I = guess we can get away with that :). Making devices separate basically hurts abstraction. I don't see any use = case where we should have a KVM device without emulation equivalent. For = the CPU we also think of KVM as an accelerator instead of a separate = device, no? :) Alex