From patchwork Fri Dec 2 21:18:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 9459269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5832860585 for ; Fri, 2 Dec 2016 21:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45A551FE6A for ; Fri, 2 Dec 2016 21:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 394E42842E; Fri, 2 Dec 2016 21:32:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8D381FE6A for ; Fri, 2 Dec 2016 21:32:15 +0000 (UTC) Received: from localhost ([::1]:36549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCvRG-0007Ry-Ul for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Dec 2016 16:32:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cCvEO-0004yd-2j for qemu-devel@nongnu.org; Fri, 02 Dec 2016 16:18:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cCvEM-0003Qc-Vg for qemu-devel@nongnu.org; Fri, 02 Dec 2016 16:18:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36966) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cCvEM-0003QG-Mp for qemu-devel@nongnu.org; Fri, 02 Dec 2016 16:18:54 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB2331FB0B; Fri, 2 Dec 2016 21:18:53 +0000 (UTC) Received: from localhost (ovpn-116-204.phx2.redhat.com [10.3.116.204]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB2LIqYQ006816; Fri, 2 Dec 2016 16:18:53 -0500 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 2 Dec 2016 19:18:13 -0200 Message-Id: <1480713496-11213-15-git-send-email-ehabkost@redhat.com> In-Reply-To: <1480713496-11213-1-git-send-email-ehabkost@redhat.com> References: <1480713496-11213-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 02 Dec 2016 21:18:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.9 14/17] qapi: add static/migration-safe info to query-cpu-model-expansion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , libvir-list@redhat.com, Markus Armbruster , Christian Borntraeger , "Jason J. Herne" , Cornelia Huck , Jiri Denemark Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On x86, "-cpu host" enables some features that can't be represented by a static CPU model definition: cache info passthrough ("host-cache-info") and PMU passthrough ("pmu"). This means a type=static expansion of "host" can't include those features. A type=full expansion of "host", on the other hand, can include those features, but then the returned data won't be a static CPU model representation. Add a note to the documentation explaining that when using CPU models that include non-migration-safe features, users need to choose being precision and safety: a precise expansion of the CPU model (full) won't be safe (static), (because they would include pmu=on and host-cache-info=on), and a safe (static) expansion of the CPU model won't be precise. Architectures where CPU model expansion is always migration-safe (e.g. s390x) can simply do what they already do, and set 'migration-safe' and 'static' to true. Cc: Cornelia Huck Cc: Christian Borntraeger Cc: David Hildenbrand Cc: libvir-list@redhat.com Cc: Jiri Denemark Cc: "Jason J. Herne" Cc: Markus Armbruster Cc: Eric Blake Signed-off-by: Eduardo Habkost --- qapi-schema.json | 25 ++++++++++++++++++++++++- target-s390x/cpu_models.c | 4 ++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/qapi-schema.json b/qapi-schema.json index 8d113f8..a102534 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3291,6 +3291,15 @@ # migration-safe, but allows tooling to get an insight and work with # model details. # +# Note: When a non-migration-safe CPU model is expanded in static mode, some +# features enabled by the CPU model may be omitted, because they can't be +# implemented by a static CPU model definition (e.g. cache info passthrough and +# PMU passthrough in x86). If you need an accurate representation of the +# features enabled by a non-migration-safe CPU model, use @full. If you need a +# static representation that will keep ABI compatibility even when changing QEMU +# version or machine-type, use @static (but keep in mind that some features may +# be omitted). +# # Since: 2.8.0 ## { 'enum': 'CpuModelExpansionType', @@ -3304,10 +3313,24 @@ # # @model: the expanded CpuModelInfo. # +# @migration-safe: the expanded CPU model in @model is a migration-safe +# CPU model. See @CpuDefinitionInfo.migration-safe. +# If expansion type was @static, this is always true. +# (since 2.9) +# +# @static: the expanded CPU model in @model is a static CPU model. +# See @CpuDefinitionInfo.static. If expansion type was @static, +# this is always true. +# (since 2.9) +# +# query-cpu-model-expansion with static expansion type should always +# return a static and migration-safe expansion. +# # Since: 2.8.0 ## { 'struct': 'CpuModelExpansionInfo', - 'data': { 'model': 'CpuModelInfo' } } + 'data': { 'model': 'CpuModelInfo', 'static': 'bool', + 'migration-safe': 'bool' } } ## diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c index 5b66d33..f934add 100644 --- a/target-s390x/cpu_models.c +++ b/target-s390x/cpu_models.c @@ -448,6 +448,10 @@ CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type /* convert it back to a static representation */ expansion_info = g_malloc0(sizeof(*expansion_info)); expansion_info->model = g_malloc0(sizeof(*expansion_info->model)); + + /* We always expand to a static and migration-safe CpuModelInfo */ + expansion_info->q_static = true; + expansion_info->migration_safe = true; cpu_info_from_model(expansion_info->model, &s390_model, delta_changes); return expansion_info; }