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: Thu, 20 Jan 2011 13:37:12 -0600 Message-ID: <4D388EE8.3000004@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> <4D35B6DD.1020005@linux.vnet.ibm.com> <4D3717E7.3010105@linux.vnet.ibm.com> <4D38017D.2020401@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Blue Swirl , Markus Armbruster , "kvm@vger.kernel.org" , Glauber Costa , Marcelo Tosatti , "qemu-devel@nongnu.org" , Avi Kivity To: Jan Kiszka Return-path: Received: from e31.co.us.ibm.com ([32.97.110.149]:34182 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521Ab1ATThP (ORCPT ); Thu, 20 Jan 2011 14:37:15 -0500 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e31.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0KJMuUH028577 for ; Thu, 20 Jan 2011 12:22:56 -0700 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0KJbEjJ069056 for ; Thu, 20 Jan 2011 12:37:14 -0700 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0KJfhPL020833 for ; Thu, 20 Jan 2011 12:41:44 -0700 In-Reply-To: <4D38017D.2020401@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/20/2011 03:33 AM, Jan Kiszka wrote: > On 2011-01-19 20:32, Blue Swirl wrote: > >> On Wed, Jan 19, 2011 at 4:57 PM, Anthony Liguori >> wrote: >> >>> On 01/19/2011 07:15 AM, Markus Armbruster wrote: >>> >>>> So they interact with KVM (need kvm_state), and they interact with the >>>> emulated PCI bus. Could you elaborate on the fundamental difference >>>> between the two interactions that makes you choose the (hypothetical) >>>> KVM bus over the PCI bus as device parent? >>>> >>>> >>> It's almost arbitrary, but I would say it's the direction that I/Os flow. >>> >>> But if the underlying observation is that the device tree is not really a >>> tree, you're 100% correct. This is part of why a factory interface that >>> just takes a parent bus is too simplistic. >>> >>> I think we ought to introduce a -pci-device option that is specifically for >>> creating PCI devices that doesn't require a parent bus argument but provides >>> a way to specify stable addressing (for instancing, using a linear index). >>> >> I think kvm_state should not be a property of any device or bus. It >> should be split to more logical pieces. >> >> Some parts of it could remain in CPUState, because they are associated >> with a VCPU. >> >> Also, for example irqfd could be considered to be similar object to >> char or block devices provided by QEMU to devices. Would it make sense >> to introduce new host types for passing parts of kvm_state to devices? >> >> I'd also make coalesced MMIO stuff part of memory object. We are not >> passing any state references when using cpu_physical_memory_rw(), but >> that could be changed. >> > There are currently no VCPU-specific bits remaining in kvm_state. It may > be a good idea to introduce an arch-specific kvm_state and move related > bits over. It may also once be feasible to carve out memory management > related fields if we have proper abstractions for that, but I'm not > completely sure here. > > Anyway, all these things are secondary. The primary topic here is how to > deal with kvm_state and its fields that have VM-global scope. > The debate is really: 1) should we remove all passing of kvm_state and just assume it's static 2) deal with a couple places in the code where we need to figure out how to get at kvm_state I think we've only identified 1 real instance of (2) and it's resulted in some good discussions about how to model KVM devices vs. emulated devices. Honestly, (1) just stinks. I see absolutely no advantage to it at all. In the very worst case scenario, the thing we need to do is just reference an extern variable in a few places. That completely avoids all of the modelling discussions for now (while leaving for placeholder FIXMEs so the problem can be tackled later). I don't understand the resistance here. Regards, Anthony Liguori > Jan > > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33024 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pg0Jr-0007rZ-Ld for qemu-devel@nongnu.org; Thu, 20 Jan 2011 14:37:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pg0Jq-0001e3-L7 for qemu-devel@nongnu.org; Thu, 20 Jan 2011 14:37:19 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:46113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pg0Jq-0001dt-Du for qemu-devel@nongnu.org; Thu, 20 Jan 2011 14:37:18 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e38.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0KJN7Vb025904 for ; Thu, 20 Jan 2011 12:23:07 -0700 Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0KJbDLS160588 for ; Thu, 20 Jan 2011 12:37:13 -0700 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0KJfhPF020833 for ; Thu, 20 Jan 2011 12:41:43 -0700 Message-ID: <4D388EE8.3000004@linux.vnet.ibm.com> Date: Thu, 20 Jan 2011 13:37:12 -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> <4D35B6DD.1020005@linux.vnet.ibm.com> <4D3717E7.3010105@linux.vnet.ibm.com> <4D38017D.2020401@siemens.com> In-Reply-To: <4D38017D.2020401@siemens.com> Content-Type: text/plain; charset=UTF-8; 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 , Markus Armbruster , "qemu-devel@nongnu.org" , Blue Swirl , Avi Kivity On 01/20/2011 03:33 AM, Jan Kiszka wrote: > On 2011-01-19 20:32, Blue Swirl wrote: > >> On Wed, Jan 19, 2011 at 4:57 PM, Anthony Liguori >> wrote: >> >>> On 01/19/2011 07:15 AM, Markus Armbruster wrote: >>> >>>> So they interact with KVM (need kvm_state), and they interact with the >>>> emulated PCI bus. Could you elaborate on the fundamental difference >>>> between the two interactions that makes you choose the (hypothetical) >>>> KVM bus over the PCI bus as device parent? >>>> >>>> >>> It's almost arbitrary, but I would say it's the direction that I/Os flow. >>> >>> But if the underlying observation is that the device tree is not really a >>> tree, you're 100% correct. This is part of why a factory interface that >>> just takes a parent bus is too simplistic. >>> >>> I think we ought to introduce a -pci-device option that is specifically for >>> creating PCI devices that doesn't require a parent bus argument but provides >>> a way to specify stable addressing (for instancing, using a linear index). >>> >> I think kvm_state should not be a property of any device or bus. It >> should be split to more logical pieces. >> >> Some parts of it could remain in CPUState, because they are associated >> with a VCPU. >> >> Also, for example irqfd could be considered to be similar object to >> char or block devices provided by QEMU to devices. Would it make sense >> to introduce new host types for passing parts of kvm_state to devices? >> >> I'd also make coalesced MMIO stuff part of memory object. We are not >> passing any state references when using cpu_physical_memory_rw(), but >> that could be changed. >> > There are currently no VCPU-specific bits remaining in kvm_state. It may > be a good idea to introduce an arch-specific kvm_state and move related > bits over. It may also once be feasible to carve out memory management > related fields if we have proper abstractions for that, but I'm not > completely sure here. > > Anyway, all these things are secondary. The primary topic here is how to > deal with kvm_state and its fields that have VM-global scope. > The debate is really: 1) should we remove all passing of kvm_state and just assume it's static 2) deal with a couple places in the code where we need to figure out how to get at kvm_state I think we've only identified 1 real instance of (2) and it's resulted in some good discussions about how to model KVM devices vs. emulated devices. Honestly, (1) just stinks. I see absolutely no advantage to it at all. In the very worst case scenario, the thing we need to do is just reference an extern variable in a few places. That completely avoids all of the modelling discussions for now (while leaving for placeholder FIXMEs so the problem can be tackled later). I don't understand the resistance here. Regards, Anthony Liguori > Jan > >