From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Qemu-devel] [PATCH 28/35] kvm: x86: Introduce kvmclock device to save/restore its state Date: Tue, 18 Jan 2011 09:48:24 -0600 Message-ID: <4D35B648.1070208@linux.vnet.ibm.com> References: <4D2B6CB5.9050602@codemonkey.ws> <4D2B74D8.4080309@web.de> <4D2B8662.9060909@web.de> <4D2C60FB.7030009@linux.vnet.ibm.com> <4D2D80ED.8030405@redhat.com> <4D2D82EE.20002@siemens.com> <4D35A39A.8000801@siemens.com> <4D35ABF8.9050700@linux.vnet.ibm.com> <4D35B521.3090601@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Markus Armbruster , Marcelo Tosatti , Glauber Costa , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" To: Jan Kiszka Return-path: Received: from e34.co.us.ibm.com ([32.97.110.152]:35201 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752063Ab1ARPsd (ORCPT ); Tue, 18 Jan 2011 10:48:33 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0IFbUCX016556 for ; Tue, 18 Jan 2011 08:37:30 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id p0IFmVbW209376 for ; Tue, 18 Jan 2011 08:48:31 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0IFmUEo029862 for ; Tue, 18 Jan 2011 08:48:30 -0700 In-Reply-To: <4D35B521.3090601@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/18/2011 09:43 AM, Jan Kiszka wrote: > On 2011-01-18 16:04, Anthony Liguori wrote: > >> On 01/18/2011 08:28 AM, Jan Kiszka wrote: >> >>> On 2011-01-12 11:31, Jan Kiszka wrote: >>> >>> >>>> Am 12.01.2011 11:22, Avi Kivity wrote: >>>> >>>> >>>>> On 01/11/2011 03:54 PM, Anthony Liguori wrote: >>>>> >>>>> >>>>>> Right, we should introduce a KVMBus that KVM devices are created on. >>>>>> The devices can get at KVMState through the BusState. >>>>>> >>>>>> >>>>> There is no kvm bus in a PC (I looked). We're bending the device model >>>>> here because a device is implemented in the kernel and not in >>>>> userspace. An implementation detail is magnified beyond all proportions. >>>>> >>>>> An ioapic that is implemented by kvm lives in exactly the same place >>>>> that the qemu ioapic lives in. An assigned pci device lives on the PCI >>>>> bus, not a KVMBus. If we need a pointer to KVMState, then we must find >>>>> it elsewhere, not through creating imaginary buses that don't exist. >>>>> >>>>> >>>>> >>>> Exactly. >>>> >>>> So we can either "infect" the whole device tree with kvm (or maybe a >>>> more generic accelerator structure that also deals with Xen) or we need >>>> to pull the reference inside the device's init function from some global >>>> service (kvm_get_state). >>>> >>>> >>> Note that this topic is still waiting for good suggestions, specifically >>> from those who believe in kvm_state references :). This is not only >>> blocking kvmstate merge but will affect KVM irqchips as well. >>> >>> It boils down to how we reasonably pass a kvm_state reference from >>> machine init code to a sysbus device. I'm probably biased, but I don't >>> see any way that does not work against the idea of confining access to >>> kvm_state or breaks device instantiation from the command line or a >>> config file. >>> >>> >> A KVM device should sit on a KVM specific bus that hangs off of sysbus. >> It can get to kvm_state through that bus. >> >> That bus doesn't get instantiated through qdev so requiring a pointer >> argument should not be an issue. >> >> > This design is in conflict with the requirement to attach KVM-assisted > devices also to their home bus, e.g. an assigned PCI device to the PCI > bus. We don't support multi-homed qdev devices. > With vfio, would an assigned PCI device even need kvm_state? Regards, Anthony Liguori > Jan > > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37469 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfDnl-0007eA-DL for qemu-devel@nongnu.org; Tue, 18 Jan 2011 10:48:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfDnN-0001nt-2v for qemu-devel@nongnu.org; Tue, 18 Jan 2011 10:48:35 -0500 Received: from e34.co.us.ibm.com ([32.97.110.152]:35191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfDnM-0001nS-TQ for qemu-devel@nongnu.org; Tue, 18 Jan 2011 10:48:33 -0500 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0IFbU4C016545 for ; Tue, 18 Jan 2011 08:37:30 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0IFmUZ9095548 for ; Tue, 18 Jan 2011 08:48:30 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0IFmUEi029862 for ; Tue, 18 Jan 2011 08:48:30 -0700 Message-ID: <4D35B648.1070208@linux.vnet.ibm.com> Date: Tue, 18 Jan 2011 09:48:24 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 28/35] kvm: x86: Introduce kvmclock device to save/restore its state References: <4D2B6CB5.9050602@codemonkey.ws> <4D2B74D8.4080309@web.de> <4D2B8662.9060909@web.de> <4D2C60FB.7030009@linux.vnet.ibm.com> <4D2D80ED.8030405@redhat.com> <4D2D82EE.20002@siemens.com> <4D35A39A.8000801@siemens.com> <4D35ABF8.9050700@linux.vnet.ibm.com> <4D35B521.3090601@siemens.com> In-Reply-To: <4D35B521.3090601@siemens.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: "kvm@vger.kernel.org" , Glauber Costa , Marcelo Tosatti , "qemu-devel@nongnu.org" , Markus Armbruster , Avi Kivity On 01/18/2011 09:43 AM, Jan Kiszka wrote: > On 2011-01-18 16:04, Anthony Liguori wrote: > >> On 01/18/2011 08:28 AM, Jan Kiszka wrote: >> >>> On 2011-01-12 11:31, Jan Kiszka wrote: >>> >>> >>>> Am 12.01.2011 11:22, Avi Kivity wrote: >>>> >>>> >>>>> On 01/11/2011 03:54 PM, Anthony Liguori wrote: >>>>> >>>>> >>>>>> Right, we should introduce a KVMBus that KVM devices are created on. >>>>>> The devices can get at KVMState through the BusState. >>>>>> >>>>>> >>>>> There is no kvm bus in a PC (I looked). We're bending the device model >>>>> here because a device is implemented in the kernel and not in >>>>> userspace. An implementation detail is magnified beyond all proportions. >>>>> >>>>> An ioapic that is implemented by kvm lives in exactly the same place >>>>> that the qemu ioapic lives in. An assigned pci device lives on the PCI >>>>> bus, not a KVMBus. If we need a pointer to KVMState, then we must find >>>>> it elsewhere, not through creating imaginary buses that don't exist. >>>>> >>>>> >>>>> >>>> Exactly. >>>> >>>> So we can either "infect" the whole device tree with kvm (or maybe a >>>> more generic accelerator structure that also deals with Xen) or we need >>>> to pull the reference inside the device's init function from some global >>>> service (kvm_get_state). >>>> >>>> >>> Note that this topic is still waiting for good suggestions, specifically >>> from those who believe in kvm_state references :). This is not only >>> blocking kvmstate merge but will affect KVM irqchips as well. >>> >>> It boils down to how we reasonably pass a kvm_state reference from >>> machine init code to a sysbus device. I'm probably biased, but I don't >>> see any way that does not work against the idea of confining access to >>> kvm_state or breaks device instantiation from the command line or a >>> config file. >>> >>> >> A KVM device should sit on a KVM specific bus that hangs off of sysbus. >> It can get to kvm_state through that bus. >> >> That bus doesn't get instantiated through qdev so requiring a pointer >> argument should not be an issue. >> >> > This design is in conflict with the requirement to attach KVM-assisted > devices also to their home bus, e.g. an assigned PCI device to the PCI > bus. We don't support multi-homed qdev devices. > With vfio, would an assigned PCI device even need kvm_state? Regards, Anthony Liguori > Jan > >