Received: from eggs.gnu.org ([208.118.235.92]:48495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKE7j-0004Gj-DU for qemu-devel@nongnu.org; Mon, 25 Mar 2013 16:36:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKE7c-0003eJ-I6 for qemu-devel@nongnu.org; Mon, 25 Mar 2013 16:36:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKE7c-0003e5-AL for qemu-devel@nongnu.org; Mon, 25 Mar 2013 16:36:00 -0400 Date: Mon, 25 Mar 2013 17:37:46 -0300 From: Eduardo Habkost Message-ID: <20130325203746.GJ8494@otherpad.lan.raisama.net> References: <20130221145818.GK16618@otherpad.lan.raisama.net> <20130301131238.GE3375700@orkuz.home> <20130301150207.GV8494@otherpad.lan.raisama.net> <20130301225600.GA3461802@orkuz.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130301225600.GA3461802@orkuz.home> Subject: Re: [Qemu-devel] libvirt<->QEMU interfaces for CPU models List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, libvir-list@redhat.com, Andreas =?iso-8859-1?Q?F=E4rber?= , Igor Mammedov On Fri, Mar 01, 2013 at 11:56:00PM +0100, Jiri Denemark wrote: [...] > > > > = Getting information about CPU models = > > > > > > > > Requirement: libvirt uses the predefined CPU models from QEMU, but it needs to > > > > be able to query for CPU model details, to find out how it can create a VM that > > > > matches what was requested by the user. > > > > > > > > Current problem: libvirt has a copy of the CPU model definitions on its > > > > cpu_map.xml file, and the copy can be out of sync in case CPU models in QEMU > > > > change. libvirt also assumes that the set of features on each model is always > > > > the same on all machine-types, which is not true. > > > > > > > > Challenge: the resulting CPU features depend on lots of factors, including > > > > the machine-type. > > > > > > > > Workaround: start a paused VM and query for the CPU device information > > > > after the CPU was created. > > > > I just noticed another problem here, but this gave me an idea that would > > help solve the "enforce" error reporting problem: > > > > Problem: "qemu -machine -cpu " will create CPU objects > > where the CPU features are _already_ filtered based on host > > capabilities. > > Ah, it seems logical now that you mention it :-) > > > * Using "enforce" wouldn't solve it, because then QEMU would abort, and > > QMP would be unavailable. > > > > Solution: we could have a CPU object property like > > "removed-features" that would have the list of features that were > > disabled because they are not supported by the host (and would make > > "enforce" fail). > > > > * This would solve the problem above and also be a machine-friendly > > way to check for possible "enforce" errors. > > > > * In other words: instead of "enforce", libvirt could use "check" > > instead of "enforce", and before unpausing the VM (or even starting > > migration), it should first check if the "removed-features" property is > > empty. > > > > Would that work for you? > > Yes, that seems like it could work. In fact, it seems much better than > using enforce and trying to deal with aborted QEMU. To make the libvirt logic simpler, we could do this: have a "force" mode (in addition to check/enforce), that wouldn't filter any CPU feature based on host capabilities. This way libvirt wouldn't need any non-trivial logic to combine the "f-*" flags and "removed-features" to find out the CPU model details. Then libvirt would need to look only at "f-*" to find out the CPU model details at probing time (as long as "force" is used at probing time), and just make sure "removed-features" is empty before starting the VM (optionally parsing its value or checking the "f-*" property values, to find out which features are missing exactly). -- Eduardo