From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YT5AQ-0000jf-7d for qemu-devel@nongnu.org; Wed, 04 Mar 2015 04:00:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YT5AN-0002NG-GN for qemu-devel@nongnu.org; Wed, 04 Mar 2015 04:00:34 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:54975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YT5AN-0002N4-76 for qemu-devel@nongnu.org; Wed, 04 Mar 2015 04:00:31 -0500 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Mar 2015 09:00:27 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id CCC8A17D8063 for ; Wed, 4 Mar 2015 09:00:43 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2490OKJ11862318 for ; Wed, 4 Mar 2015 09:00:24 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2490L4s016329 for ; Wed, 4 Mar 2015 02:00:23 -0700 Date: Wed, 4 Mar 2015 10:00:16 +0100 From: Michael Mueller Message-ID: <20150304100016.1a011075@bee> In-Reply-To: <20150302191100.GJ3513@thinpad.lan.raisama.net> References: <1425300248-40277-1-git-send-email-mimu@linux.vnet.ibm.com> <1425300248-40277-15-git-send-email-mimu@linux.vnet.ibm.com> <20150302191100.GJ3513@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 14/16] target-s390x: Extend QMP command query-cpu-definitions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org, Gleb Natapov , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Christian Borntraeger , Alexander Graf , "Jason J. Herne" , Cornelia Huck , Paolo Bonzini , Andreas Faerber , Richard Henderson On Mon, 2 Mar 2015 16:11:00 -0300 Eduardo Habkost wrote: > On Mon, Mar 02, 2015 at 01:44:06PM +0100, Michael Mueller wrote: > > This patch implements the QMP command 'query-cpu-definitions' in the S390 > > context. The command returns a list of cpu model names in the current host > > context. A consumer may successfully request each listed cpu model as long > > for a given accelerator this model is runnable. > > > > The QMP type AccelCpuModelInfo is introduced and the type CpuDefinitionInfo > > is extended by the optional field 'accelerators'. It contains a list of named > > accelerators and some indication whether the associated cpu model is runnable > > or the default cpu model. The default cpu model is used if either no specific > > cpu model is requested during QEMU startup or if the cpu model with name > > 'host' is requested. > > > > request: > > {"execute": "query-cpu-definitions"} > > > > answer: > > {"return": > > [{"name":"2964-ga1","accelerators":[{"name":"kvm","runnable":false,"default":false}]}, > > {"name":"2828-ga1","accelerators":[{"name":"kvm","runnable":false,"default":false}]}, > > {"name":"2827-ga2","accelerators":[{"name":"kvm","runnable":true,"default":true}]}, > > {"name":"2827-ga1","accelerators":[{"name":"kvm","runnable":true,"default":false}]}, > > {"name":"2818-ga1","accelerators":[{"name":"kvm","runnable":true,"default":false}]}, > > ... > > {"name":"2064-ga1","accelerators":[{"runnable":true,"name":"kvm","default":false}]} > > ] > > } > > On x86, being runnable or not is something that depends on the > machine-type. I expect that to happen in other machines as soon as they > start implementing backwards compatiblity. > > I see two options to implement that: 1) adding a "machine-type" argument > to query-cpu-definitions; 2) returning a machine-type-based dictionary > on the "runnable" property. The former sounds better to me as it won't > require enumerating all machine-types every time. > > In that case, why we do need to enumerate all accelerators on every > query, either? We could have both "machine-type" and "accel" arguments > to query-cpu-definitions, so callers will just ask for the > acceleratores/machine-types they are interested into. > > e.g.: > > request: > {"execute": "query-cpu-definitions", > "arguments": {"machine":"s390-virtio", "accel":"kvm"}} > > answer: > {"return": > [{"name":"2964-ga1","runnable":true}, > {"name":"2828-ga1","runnable":false} > ... > ] > } I had some discussion with out libvirt people on that. I will compile a patch implementing this to see how it fits.. > > We can also extend this to other variables, such as extra CPU flags that > could make the CPU runnable or not. e.g.: want to know if "-machine > foo,accel=bar -cpu xxx,+yyy,-zzz" is runnable? Send this request: > {"execute": "query-cpu-definitions", > "arguments": {"machine":"s390-virtio", "accel":"kvm", "cpu":"xxx,+yyy,-zzz"}} > and get this response: > {"return": [{"name":"xxx","runnable":false}]} > or maybe being more explicit in the response about the extra CPU flags: > {"return": [{"name":"xxx,+yyy,-zzz","runnable":false}]} > > > > {"execute": "query-cpu-definitions"} > > > > answer: > > {"return": > > [{"name":"2964-ga1","accelerators":[{"name":"kvm","runnable":false,"default":false}]}, > > {"name":"2828-ga1","accelerators":[{"name":"kvm","runnable":false,"default":false}]}, > > {"name":"2827-ga2","accelerators":[{"name":"kvm","runnable":true,"default":true}]}, > > {"name":"2827-ga1","accelerators":[{"name":"kvm","runnable":true,"default":false}]}, > > {"name":"2818-ga1","accelerators":[{"name":"kvm","runnable":true,"default":false}]}, > > > > Signed-off-by: Michael Mueller > > [...] >