From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7PgI-0000gy-Hk for qemu-devel@nongnu.org; Thu, 17 Nov 2016 11:36:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7PgF-00035b-Du for qemu-devel@nongnu.org; Thu, 17 Nov 2016 11:36:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26585) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c7PgF-00035P-6T for qemu-devel@nongnu.org; Thu, 17 Nov 2016 11:36:55 -0500 Date: Thu, 17 Nov 2016 14:36:51 -0200 From: Eduardo Habkost Message-ID: <20161117163651.GX5057@thinpad.lan.raisama.net> References: <1479151563-13473-1-git-send-email-walling@linux.vnet.ibm.com> <1479151563-13473-2-git-send-email-walling@linux.vnet.ibm.com> <20161114200229.GG5057@thinpad.lan.raisama.net> <20161115074212.GB4015667@orkuz.home> <20161115134400.GH5057@thinpad.lan.raisama.net> <87y40icflq.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y40icflq.fsf@dusky.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH v1] qemu: command: rework cpu feature argument support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: "Collin L. Walling" , jjherne@linux.vnet.ibm.com, borntraeger@de.ibm.com, libvir-list@redhat.com, qemu-devel@nongnu.org On Thu, Nov 17, 2016 at 04:04:33PM +0100, Markus Armbruster wrote: > Eduardo Habkost writes: > > > CCing qemu-devel. > > > > CCing Markus, in case he has any insights about the interface > > introspection. > > > > On Tue, Nov 15, 2016 at 08:42:12AM +0100, Jiri Denemark wrote: > >> On Mon, Nov 14, 2016 at 18:02:29 -0200, Eduardo Habkost wrote: > >> > On Mon, Nov 14, 2016 at 02:26:03PM -0500, Collin L. Walling wrote: > >> > > cpu features are passed to the qemu command with feature=on/off > >> > > instead of +/-feature. > >> > > > >> > > Signed-off-by: Collin L. Walling > >> > > >> > If I'm not mistaken, the "feature=on|off" syntax was added on > >> > QEMU 2.0.0. Does current libvirt support older QEMU versions? > >> > >> Of course it does. I'd love to switch to feature=on|off, but how can we > >> check if QEMU supports it? We can't really start using this syntax > >> without it. > > > > Actually, I was wrong, this was added in v2.4.0. "feat=on|off" > > needs two things to work (in x86): > > > > * Translation of all "foo=bar" options to QOM property setting. > > This was added in v2.0.0-rc0~162^2 > > * The actual QOM properties for feature names to be present. They > > were added in v2.4.0-rc0~101^2~1 > > > > So you can be sure "feat=on" is supported by checking if the > > feature flags are present in device-list-properties output for > > the CPU model. But device-list-properties is also messy[1]. > > > > Maybe we can use the availability of query-cpu-model-expansion to > > check if we can safely use the new "feat=on|off" system? It's > > easier than taking all the variables above into account. > > > > --- > > > > [1] * device-list-properties support for x86 CPU QOM classes > > will be in QEMU 2.8. > > * device-list-properties on x86 CPU QOM classes returns > > an error on QEMU 2.5-2.7. > > * device-list-properties on x86 CPU classes may crash QEMU in > > QEMU older than 2.5 (see commit 4c315c27). > > But: > > * query-cpu-definitions will probably return the CPU QOM > > typename in QEMU 2.9+ only. > > In other words: > > * feature=on|off works since 2.4, but what's the best way to probe for > it? > > * device-list-properties can act as a witness, but there are two > problems: you need to map between CPU model and QOM typename to use > it, and it can fail or even crash before 2.8. > > * 2.9 will take provide the information to map between CPU model and QOM > typename. > > I guess the sane choice is to probe for the CPU model - QOM typename > mapping information, and if it's there, assume device-list-properties > and feature=on|off work. Eduardo, what do you think? That would work for x86, but not for s390x on QEMU <= 2.8 (where only feat=on|off is supported). Using query-cpu-model-expansion as a witness would work for both s390x and i386, even with QEMU <= 2.8. -- Eduardo