From nobody Sun May 19 05:00:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1662633734; cv=none; d=zohomail.com; s=zohoarc; b=famat+LxwFgePogsY0vSuALde1r9pgFUfo+JGAKLWa+iBfi/oS89qXotwpYjIDAkh6AASIsNVP8gxeAMeZyWxQVgchnV0fV96RJulL2BDCk/u/5TlTy2qbUQKTV2g92FD6Gp6pfDTVE+1xerkE5wchhfRuXuU0x2cWtu6qQM5+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662633734; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4rKmXz6j1gueI6IV7cJLrTPo/xqBsha99cjqUz/yiq8=; b=Dva0fTeNqIROLDg6IzVjD3AdPW2rxghkyFqfuxCdhnqpFpLlNDfZdHrUdOwDrH9Fa4mnTwSpRE/E8p9tpQzJJ1O4ygDsoZLQeb4ejFk5vJnz+82Zw6m+Qy1D0cgfXmR2Uz5Dnk6mMbnqOKhKrXYfFNo/lATN1YLxIleIpedGj+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662633734724834.9759599166075; Thu, 8 Sep 2022 03:42:14 -0700 (PDT) Received: from localhost ([::1]:49492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWEz6-0004CE-OO for importer@patchew.org; Thu, 08 Sep 2022 06:42:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWEuZ-0006pP-Oq for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:37:31 -0400 Received: from forwardcorp1o.mail.yandex.net ([95.108.205.193]:48050) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWEuY-0004Un-7Q for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:37:31 -0400 Received: from myt6-81d8ab6a9f9d.qloud-c.yandex.net (myt6-81d8ab6a9f9d.qloud-c.yandex.net [IPv6:2a02:6b8:c12:520a:0:640:81d8:ab6a]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 796DC2E11B4; Thu, 8 Sep 2022 13:37:13 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by myt6-81d8ab6a9f9d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id U3HXU6koyH-bCPS5l6f; Thu, 08 Sep 2022 13:37:12 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1662633432; bh=4rKmXz6j1gueI6IV7cJLrTPo/xqBsha99cjqUz/yiq8=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=gr99usYumA5MQTulHFSvzIhBCj4Dz7gNwRhlZ3e1aCVpoas2wvj7wQgLx+bU9G7p4 BGJYe+/LvgsPx20X2OBdntIAKdUbMLQxexc4VuCAKBVlUUR6HHv9IdQP3bXyBZTySy oIIhdvujog6DG3/ksXn/j5ReK36OnaixloqUHAYg= Authentication-Results: myt6-81d8ab6a9f9d.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: davydov-max@yandex-team.ru, yc-core@yandex-team.ru, pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net, marcel.apfelbaum@gmail.com, f4bug@amsat.org, wangyanan55@huawei.com, armbru@redhat.com, alxndr@bu.edu, bsd@redhat.com, stefanha@redhat.com, thuth@redhat.com, darren.kenny@oracle.com, Qiuhao.Li@outlook.com, lvivier@redhat.com, jsnow@redhat.com, crosa@redhat.com, bleal@redhat.com Subject: [PATCH 1/4] qom: add devault value Date: Thu, 8 Sep 2022 13:36:47 +0300 Message-Id: <20220908103650.9518-2-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908103650.9518-1-davydov-max@yandex-team.ru> References: <20220908103650.9518-1-davydov-max@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=95.108.205.193; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1o.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1662633735380100001 Content-Type: text/plain; charset="utf-8" qmp_qom_list_properties can print default values if they are available as qmp_device_list_properties does, because both of them use the ObjectPropertyInfo structure with default_value field. This can be useful when working with "not device" types. Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy --- qom/qom-qmp-cmds.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 2e63a4c184..1d7867dc19 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -217,6 +217,8 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const c= har *typename, info->type =3D g_strdup(prop->type); info->has_description =3D !!prop->description; info->description =3D g_strdup(prop->description); + info->default_value =3D qobject_ref(prop->defval); + info->has_default_value =3D !!info->default_value; =20 QAPI_LIST_PREPEND(prop_list, info); } --=20 2.25.1 From nobody Sun May 19 05:00:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1662633574; cv=none; d=zohomail.com; s=zohoarc; b=eWMvv/so71P0yiJyHMfH9VjzwJHG5ukrXnmTqNGWRxvtFsO5wlaNgbair347zE9yBhCvYd6a5IM9vd3eYcmG7oeEvOnNlvgrAic8pur42yjsB46e7/qGxOlgE8JzbWWQz66hGC4hfZqcaBppxRg2Sq1ZCy/lHmbNeN6pm+flMCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662633574; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=f2okGAqQCW1qC7TQT9B7Qg4x+QTTw5I4m3oCeOSXkd4=; b=S0HsbiT8zyIbk+RqbWxiN4rapHq57PXV4FJdChVjMm7OtXea9YLw/P2uyHDqK0TFraHoVrn2ouByVwuMnMT92ak7U33/fZScpYsN5+zSYbLeh4SDO/qhgqM02BTrwMiJRn4QxNzl/AmfNENbIlJl3kQoiOhVjPjPQebVepehpx4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662633574068816.5076937816438; Thu, 8 Sep 2022 03:39:34 -0700 (PDT) Received: from localhost ([::1]:41380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWEwX-0000Xj-13 for importer@patchew.org; Thu, 08 Sep 2022 06:39:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWEuX-0006ll-Ot for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:37:29 -0400 Received: from forwardcorp1o.mail.yandex.net ([95.108.205.193]:47738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWEuT-0004Tt-Fx for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:37:27 -0400 Received: from myt6-81d8ab6a9f9d.qloud-c.yandex.net (myt6-81d8ab6a9f9d.qloud-c.yandex.net [IPv6:2a02:6b8:c12:520a:0:640:81d8:ab6a]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 6CF432E0F43; Thu, 8 Sep 2022 13:37:14 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by myt6-81d8ab6a9f9d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id U3HXU6koyH-bDPSVbY5; Thu, 08 Sep 2022 13:37:13 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1662633433; bh=f2okGAqQCW1qC7TQT9B7Qg4x+QTTw5I4m3oCeOSXkd4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=RGy/qMdkKDPETH2AxyDc4v9v7ciFUBkI9P4ERj4dW7/u7aeIaBxjX40yajwE7K5YW WTLJnhpEZXOX7AhiwLlnstLZOxJwvnCkA10CXYkhijoMQWwETFKSBXi4l77KIXRkOQ U1AIRAvujqyxs/6l+Eyh1jM47PLmkexIxabnV9Ig= Authentication-Results: myt6-81d8ab6a9f9d.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: davydov-max@yandex-team.ru, yc-core@yandex-team.ru, pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net, marcel.apfelbaum@gmail.com, f4bug@amsat.org, wangyanan55@huawei.com, armbru@redhat.com, alxndr@bu.edu, bsd@redhat.com, stefanha@redhat.com, thuth@redhat.com, darren.kenny@oracle.com, Qiuhao.Li@outlook.com, lvivier@redhat.com, jsnow@redhat.com, crosa@redhat.com, bleal@redhat.com Subject: [PATCH 2/4] qmp: add dump machine type compatible properties Date: Thu, 8 Sep 2022 13:36:48 +0300 Message-Id: <20220908103650.9518-3-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908103650.9518-1-davydov-max@yandex-team.ru> References: <20220908103650.9518-1-davydov-max@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=95.108.205.193; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1o.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1662633575356100001 Content-Type: text/plain; charset="utf-8" To control that creating new machine type doesn't affect the previous types (their compat_props) and to check complex compat_props inheritance we need qmp command to print machine type compatible properties. This patch adds the ability to get list of all the compat_props of the corresponding supported machines for their comparison via new optional argument of "query-machines" command. Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy --- hw/core/machine-qmp-cmds.c | 22 ++++++++++++++- qapi/machine.json | 54 +++++++++++++++++++++++++++++++++++-- tests/qtest/fuzz/qos_fuzz.c | 2 +- 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 4f4ab30f8c..a6fc387439 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -74,7 +74,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) return head; } =20 -MachineInfoList *qmp_query_machines(Error **errp) +MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_pro= ps, + Error **errp) { GSList *el, *machines =3D object_class_get_list(TYPE_MACHINE, false); MachineInfoList *mach_list =3D NULL; @@ -107,6 +108,25 @@ MachineInfoList *qmp_query_machines(Error **errp) info->default_ram_id =3D g_strdup(mc->default_ram_id); info->has_default_ram_id =3D true; } + if (compat_props && mc->compat_props) { + int i; + info->compat_props =3D NULL; + CompatPropertyList **tail =3D &(info->compat_props); + info->has_compat_props =3D true; + + for (i =3D 0; i < mc->compat_props->len; i++) { + GlobalProperty *mt_prop =3D g_ptr_array_index(mc->compat_p= rops, + i); + CompatProperty *prop; + + prop =3D g_malloc0(sizeof(*prop)); + prop->driver =3D g_strdup(mt_prop->driver); + prop->property =3D g_strdup(mt_prop->property); + prop->value =3D g_strdup(mt_prop->value); + + QAPI_LIST_APPEND(tail, prop); + } + } =20 QAPI_LIST_PREPEND(mach_list, info); } diff --git a/qapi/machine.json b/qapi/machine.json index 6afd1936b0..b5477224a8 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -127,6 +127,25 @@ ## { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } =20 +## +# @CompatProperty: +# +# Machine type compatible property. It's based on GlobalProperty and creat= ed +# for machine type compat properties (see scripts) +# +# @driver: name of the driver that has GlobalProperty +# +# @property: global property name +# +# @value: global property value +# +# Since: 7.2 +## +{ 'struct': 'CompatProperty', + 'data': { 'driver': 'str', + 'property': 'str', + 'value': 'str' } } + ## # @MachineInfo: # @@ -155,6 +174,9 @@ # # @default-ram-id: the default ID of initial RAM memory backend (since 5.2) # +# @compat-props: List of compatible properties that defines machine type +# (since 7.2) +# # Since: 1.2 ## { 'struct': 'MachineInfo', @@ -162,18 +184,46 @@ '*is-default': 'bool', 'cpu-max': 'int', 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', 'deprecated': 'bool', '*default-cpu-type': 'str', - '*default-ram-id': 'str' } } + '*default-ram-id': 'str', '*compat-props': ['CompatProperty'] = } } =20 ## # @query-machines: # # Return a list of supported machines # +# @compat-props: if true return will contain information about machine type +# compatible properties (since 7.2) +# # Returns: a list of MachineInfo # # Since: 1.2 +# +# Example: +# +# -> { "execute": "query-machines", "arguments": { "compat-props": true } } +# <- { "return": [ +# { +# "hotpluggable-cpus": true, +# "name": "pc-q35-6.2", +# "compat-props": [ +# { +# "driver": "virtio-mem", +# "property": "unplugged-inaccessible", +# "value": "off" +# } +# ], +# "numa-mem-supported": false, +# "default-cpu-type": "qemu64-x86_64-cpu", +# "cpu-max": 288, +# "deprecated": false, +# "default-ram-id": "pc.ram" +# }, +# ... +# } ## -{ 'command': 'query-machines', 'returns': ['MachineInfo'] } +{ 'command': 'query-machines', + 'data': { '*compat-props': 'bool' }, + 'returns': ['MachineInfo'] } =20 ## # @CurrentMachineParams: diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index c856d3d500..f0c9ed4c4b 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -46,7 +46,7 @@ static void qos_set_machines_devices_available(void) MachineInfoList *mach_info; ObjectTypeInfoList *type_info; =20 - mach_info =3D qmp_query_machines(&error_abort); + mach_info =3D qmp_query_machines(false, false, &error_abort); machines_apply_to_node(mach_info); qapi_free_MachineInfoList(mach_info); =20 --=20 2.25.1 From nobody Sun May 19 05:00:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1662633867; cv=none; d=zohomail.com; s=zohoarc; b=YM0e8CAWAyrqMJQbTuxekK/B4TJKDf3xyJGAKLejlimlarqatcEoZnkwHzwl4FqZETT8Jwem9UKcM4jOsn7W/A4Pit68R+HzDfnF7qL1YMa1xiLKxQdQGLWtS95X5fFXdolGtutCvrqsaBo4wc1GOiaV9CjQREB8qstZLrjKmxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662633867; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GdMsJtIzt+0VbBtNUJqQ2vN8hKG8VHlgw1oSRZEMmLM=; b=R+swbV2dfCA2hC4bjxmzk07if6ZxOt9yT1IYs6eUnufgAZyUfZBcXbEo+HwCXrKMXe+IfqfemlneWt/Js3MTVv1XU5r003wzlZJBiEb2dKfle5R9EU7Vi7MxPzn1dKqJ36p223XaOmG4p2diPQ28unZMRzeXXLsBJQXTPsHvnro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662633867083665.0795667620672; Thu, 8 Sep 2022 03:44:27 -0700 (PDT) Received: from localhost ([::1]:41888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWF1G-00080a-2Q for importer@patchew.org; Thu, 08 Sep 2022 06:44:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWEuZ-0006pR-PB for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:37:31 -0400 Received: from forwardcorp1o.mail.yandex.net ([95.108.205.193]:48052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWEuY-0004Up-8V for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:37:31 -0400 Received: from myt6-81d8ab6a9f9d.qloud-c.yandex.net (myt6-81d8ab6a9f9d.qloud-c.yandex.net [IPv6:2a02:6b8:c12:520a:0:640:81d8:ab6a]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 43DCE2E11B6; Thu, 8 Sep 2022 13:37:15 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by myt6-81d8ab6a9f9d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id U3HXU6koyH-bEPS7FAL; Thu, 08 Sep 2022 13:37:14 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1662633434; bh=GdMsJtIzt+0VbBtNUJqQ2vN8hKG8VHlgw1oSRZEMmLM=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=K/7ZtlSiYsKOFkRilcYgkbH3J3GanrYU06BpKbN17Q8wDDEJr1q0fTby+TADEK/OI 2JXNRyHw+JHsFhN10zJZmsuATuaGGXTz8YkkbYTlE5cEhryiE/5vY4DpzyJBfN+C5+ wnZ1HRpZcQrvsPZxsiUNihAbGi6pDfITgSwiA/S0= Authentication-Results: myt6-81d8ab6a9f9d.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: davydov-max@yandex-team.ru, yc-core@yandex-team.ru, pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net, marcel.apfelbaum@gmail.com, f4bug@amsat.org, wangyanan55@huawei.com, armbru@redhat.com, alxndr@bu.edu, bsd@redhat.com, stefanha@redhat.com, thuth@redhat.com, darren.kenny@oracle.com, Qiuhao.Li@outlook.com, lvivier@redhat.com, jsnow@redhat.com, crosa@redhat.com, bleal@redhat.com Subject: [PATCH 3/4] python/qmp: increase read buffer size Date: Thu, 8 Sep 2022 13:36:49 +0300 Message-Id: <20220908103650.9518-4-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908103650.9518-1-davydov-max@yandex-team.ru> References: <20220908103650.9518-1-davydov-max@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=95.108.205.193; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1o.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1662633868192100003 Content-Type: text/plain; charset="utf-8" After modification of "query-machines" command the buffer size should be more than 452kB to contain output with compat-props. Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy --- python/qemu/qmp/qmp_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/qemu/qmp/qmp_client.py b/python/qemu/qmp/qmp_client.py index 5dcda04a75..659fe4d98c 100644 --- a/python/qemu/qmp/qmp_client.py +++ b/python/qemu/qmp/qmp_client.py @@ -197,8 +197,8 @@ async def run(self, address=3D'/tmp/qemu.socket'): #: Logger object used for debugging messages. logger =3D logging.getLogger(__name__) =20 - # Read buffer limit; large enough to accept query-qmp-schema - _limit =3D (256 * 1024) + # Read buffer limit; large enough to accept query-machines + _limit =3D (512 * 1024) =20 # Type alias for pending execute() result items _PendingT =3D Union[Message, ExecInterruptedError] --=20 2.25.1 From nobody Sun May 19 05:00:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1662634219; cv=none; d=zohomail.com; s=zohoarc; b=nX7vzmgXLFfe2gmQN2eFUcBw7+X2QfgsjAiNShnu/NxEzLh89ejZGCsQ8F8JnHDkxKaLBVtl2dDHNB9fOR4h4b+jRubSE56XCABbHgks4wUpnLzF+VdL/yQIJAGAcZGi89kCbTsyvMdbHQmIKLW+4/QZhG6dlWcPjifaNdL+N/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662634219; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0A4lEd+tEWh2uysPgOlrVNKVmHZm1zBEVqOXJvBC0rQ=; b=B3RnFgOf+qDnfCclqbrAfzWo5RPEcqhgYQrJYiVP5ZwHm09c46xzNQFGs6sMPRLx5Yoakc/m0Ulp20wuWiq8shEaZ5x5aeS+1haER3FWYlXcZM3nsZUsWhPScIFy1lZO9th668srBT3XGc5+fyyhpms4lm7fEL4pSNTJWqCLTX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662634219602823.0221115851699; Thu, 8 Sep 2022 03:50:19 -0700 (PDT) Received: from localhost ([::1]:55682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWF6w-0006QU-7D for importer@patchew.org; Thu, 08 Sep 2022 06:50:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWF5A-00053q-Ny for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:48:29 -0400 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]:59514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWF55-0006B2-W2 for qemu-devel@nongnu.org; Thu, 08 Sep 2022 06:48:26 -0400 Received: from myt6-81d8ab6a9f9d.qloud-c.yandex.net (myt6-81d8ab6a9f9d.qloud-c.yandex.net [IPv6:2a02:6b8:c12:520a:0:640:81d8:ab6a]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 819292E0DB3; Thu, 8 Sep 2022 13:37:18 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by myt6-81d8ab6a9f9d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id U3HXU6koyH-bFPSDgIR; Thu, 08 Sep 2022 13:37:17 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1662633437; bh=0A4lEd+tEWh2uysPgOlrVNKVmHZm1zBEVqOXJvBC0rQ=; h=Cc:Message-Id:References:Date:In-Reply-To:Subject:To:From; b=cFp3zCQcnuG/OEIKDkUhA2ySF3Q2Q61lHo6tXmkvJcVGkBsPMy6vxTl973Q0T4SEk mCwqIbYPuncPy6tE9CqwyHNOb/Z+nAwKJV537UOtkebxnIDM8vwDIzaOJEe+5U6gb4 O7m9tfcWZvHjdWrdWTsLF0A5B0uWAlkrSB1oeXFM= Authentication-Results: myt6-81d8ab6a9f9d.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: davydov-max@yandex-team.ru, yc-core@yandex-team.ru, pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net, marcel.apfelbaum@gmail.com, f4bug@amsat.org, wangyanan55@huawei.com, armbru@redhat.com, alxndr@bu.edu, bsd@redhat.com, stefanha@redhat.com, thuth@redhat.com, darren.kenny@oracle.com, Qiuhao.Li@outlook.com, lvivier@redhat.com, jsnow@redhat.com, crosa@redhat.com, bleal@redhat.com Subject: [PATCH 4/4] scripts: add script to compare compatible properties Date: Thu, 8 Sep 2022 13:36:50 +0300 Message-Id: <20220908103650.9518-5-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908103650.9518-1-davydov-max@yandex-team.ru> References: <20220908103650.9518-1-davydov-max@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:0:1472:2741:0:8b6:217; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1p.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1662634220252100001 This script run QEMU to obtain compat_props of machines and default values of different types and produce appropriate table. This table can be used to compare machine types to choose the most suitable machine. Also table in json or csv format should be used to check that new machine doesn't affect previous ones via comparisin tables with and without new machine. Default values of properties are needed to fill "holes" in the table (one machine has these properties and another not). Notes: * some init values from the devices can't be available like properties from virtio-9p when configure has --disable-virtfs. This situations will be seen in the table as "unavailable driver". * Default values can be get can be obtained in an unobvious way, like x86 features. If the script doesn't know how to get property default value to compare one machine with another it fills "holes" with "unavailable method". This is done because script uses whitelist model to get default values of different types. It means that the method that can't be applied to a new type that can crash this script. It is better to get an "unavailable driver" when creating a new machine with new compatible properties than to break this script. So it turns out a more stable and generic script. * If the default value can't be obtained because this property doesn't exist or because this property can't have default value, appropriate "hole" will be filled by "unknown property" or "no default value" * If the property is applied to the abstract class, the script collects default values from all child classes (set of default values) Example: scripts/compare_mt.py --MT pc-q35-3.1 pc-q35-2.12 =E2=95=92=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=A4=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=A4=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=95 =E2=94=82 =E2=94=82 pc-q35-2.12 =E2=94= =82 pc-q35-3.1 =E2=94=82 =E2=95=9E=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=A1 =E2=94=82 EPYC-IBPB-x86_64-cpu-xlevel =E2=94=82 0x8000000a =E2=94= =82 2147483678 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 EPYC-x86_64-cpu-xlevel =E2=94=82 0x8000000a =E2=94= =82 2147483678 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 Skylake-Server-IBRS-x86_64-cpu-pku =E2=94=82 False =E2=94= =82 True =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 Skylake-Server-x86_64-cpu-pku =E2=94=82 False =E2=94= =82 True =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 VGA-global-vmstate =E2=94=82 True =E2=94= =82 False =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 cirrus-vga-global-vmstate =E2=94=82 True =E2=94= =82 False =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 hda-audio-use-timer =E2=94=82 False =E2=94= =82 True =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 migration-decompress-error-check =E2=94=82 False =E2=94= =82 True =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 qxl-vga-global-vmstate =E2=94=82 True =E2=94= =82 False =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 vmware-svga-global-vmstate =E2=94=82 True =E2=94= =82 False =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 x86_64-cpu-legacy-cache =E2=94=82 True =E2=94= =82 [True, False] =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 x86_64-cpu-topoext =E2=94=82 False =E2=94= =82 [True, False] =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 x86_64-cpu-x-hv-synic-kvm-only =E2=94=82 True =E2=94= =82 False =E2=94=82 =E2=95=98=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=A7=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=A7=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=9B Signed-off-by: Maksim Davydov --- scripts/compare_mt.py | 370 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 370 insertions(+) create mode 100755 scripts/compare_mt.py diff --git a/scripts/compare_mt.py b/scripts/compare_mt.py new file mode 100755 index 0000000000..a063c79682 --- /dev/null +++ b/scripts/compare_mt.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python3 +# +# Copyright (c) Yandex Technologies LLC, 2022 +# +# Script to compare machine type compatible properties +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . + +from tabulate import tabulate +import json +import sys +from os import path +from argparse import ArgumentParser, RawTextHelpFormatter +import pandas as pd + +try: + qemu_dir =3D path.abspath(path.dirname(path.dirname(__file__))) + sys.path.append(path.join(qemu_dir, 'python')) + from qemu.machine import QEMUMachine + from qemu.qmp import ConnectError +except ModuleNotFoundError as exc: + print(f"Module '{exc.name}' not found.") + print("Try export PYTHONPATH=3Dtop-qemu-dir/python or run from top-qem= u-dir") + sys.exit(1) + + +DEF_CMD_LINE =3D 'build/qemu-system-x86_64 -enable-kvm -machine none' + + +# Methods to get right values of drivers props +# +# Use these methods as a 'whitelist' and add entries only if necessary. It= 's +# important in analysis and tests. +# Names should be in qom-list-types format (486-x86_64-cpu, not 486) +# The latest definition wins: +# 1) device +# 2) cpu +# 3) 486-x86_64-cpu +# For 486 will be used - 3) rule, for virtio device - 1), for Haswell - 2) +def get_device_prop(vm, device, prop_name): + args =3D {'typename': device} + device_props =3D vm.command('device-list-properties', **args) + for prop in device_props: + if prop['name'] =3D=3D prop_name: + return str(prop.get('default-value', 'No default value')) + + return 'Unknown property' + + +def get_x86_64_cpu_prop(vm, device, prop_name): + # crop last 11 chars '-x86_64-cpu' + args =3D {'type': 'full', 'model': {'name': device[:-11]}} + props =3D vm.command('query-cpu-model-expansion', **args)['model']['pr= ops'] + return str(props.get(prop_name, 'Unknown property')) + + +# Now it's stub, because all memory_backend types don't have default values +# but this behaviour can be changed +def get_memory_backend_prop(vm, driver, prop_name): + args =3D {'typename': driver} + memory_backend_props =3D vm.command('qom-list-properties', **args) + for prop in memory_backend_props: + if prop['name'] =3D=3D prop_name: + return str(prop.get('default-value', 'No default value')) + + return 'Unknown property' + + +property_methods =3D [ + {'name': 'device', 'method': get_device_prop}, + {'name': 'x86_64-cpu', 'method': get_x86_64_cpu_prop}, + {'name': 'memory-backend', 'method': get_memory_backend_prop} + ] +# End of methods definition + + +def parse_args(): + parser =3D ArgumentParser(formatter_class=3DRawTextHelpFormatter, + description=3D'Script to compare machine types= ' + '(their compat_props).\n\n' + 'The script execution with --all option may ta= ke ' + 'several minutes!\n\n' + 'If a property applies to an abstract class th= is ' + 'script collects default values of all child ' + 'classes and prints them as a set.\n\n' + '"Unavailable method" - means that this script= ' + 'doesn\'t know how to get default values of th= e ' + 'driver. To add method use the construction ' + 'described at the top of the script.\n' + '"Unavailable driver" - means that this script= ' + 'doesn\'t know this driver. For instance, this= ' + 'can happen if you configure QEMU without this= ' + 'device or if machine type definition has erro= r.\n' + '"No default value" - means that the appropria= te ' + 'method can\'t get the default value and most ' + 'likely that this property doesn\'t have it.\n' + '"Unknown property" - means that the appropria= te ' + 'method can\'t find property with this name.') + + parser.add_argument('--json', action=3D'store_true', + help=3D'returns table in json format') + parser.add_argument('--csv', action=3D'store_true', + help=3D'returns table in csv format') + parser.add_argument('--all', action=3D'store_true', + help=3D'prints all available machine types (list o= f ' + 'machine types will be ignored)') + parser.add_argument('--MT', nargs=3D"*", type=3Dstr, + help=3D'list of Machine Types that will be compare= d') + parser.add_argument('--raw', action=3D'store_true', + help=3D'prints ALL defined properties without ' + 'value transformation. By default, ' + 'only properties with different values ' + 'printed and with value transformation(like ' + '"on" -> True)') + parser.add_argument('--cmd-line', default=3DDEF_CMD_LINE, + help=3D'command line to start qemu.' + 'Default: {}'.format(DEF_CMD_LINE)) + return parser.parse_args() + + +# return touple (name, major, minor, revision) +def MT_comp(MT): + splited_name =3D MT['name'].rsplit('-', 1) + if len(splited_name) =3D=3D 2: + version =3D splited_name[1].split('.') + if len(version) =3D=3D 2: + return (splited_name[0], int(version[0]), int(version[1]), 0) + if len(version) =3D=3D 3: + return (splited_name[0], + int(version[0]), int(version[1]), int(version[2])) + + return (splited_name[0], 0, 0, 0) + + +def get_MT_definitions(vm): + args =3D {'compat-props': True} + raw_MT_defs =3D vm.command('query-machines', **args) + MT_defs =3D [] # MT: {driver_1: set_of_props, ...} + for raw_MT in raw_MT_defs: + compat_props =3D {} + for prop in raw_MT['compat-props']: + if not compat_props.get(prop['driver'], None): + compat_props[prop['driver']] =3D {} + compat_props[prop['driver']][prop['property']] =3D prop['value= '] + MT_defs.append({'name': raw_MT['name'], 'compat-props': compat_pro= ps}) + + MT_defs.sort(key=3DMT_comp) + return MT_defs + + +def get_req_props(MT_defs): + driver_props =3D {} + for MT in MT_defs: + compat_props =3D MT['compat-props'] + for driver, prop in compat_props.items(): + if driver not in driver_props: + driver_props[driver] =3D set() + driver_props[driver].update(prop.keys()) + + return driver_props + + +def get_driver_definitions(vm): + args =3D {'abstract': True} + qom_all_types =3D vm.command('qom-list-types', **args) + + driver_to_def =3D {} + for obj_type in qom_all_types: + # parent of Object is None + parent =3D obj_type.get('parent', None) + abstr =3D obj_type.get('abstract', False) + driver_to_def[obj_type['name']] =3D { + 'parent': parent, + 'abstract': abstr, + 'method': None} + if abstr: + type_args =3D {'implements': obj_type['name'], 'abstract': Tru= e} + list_child_objs =3D vm.command('qom-list-types', **type_args) + child_list =3D [child['name'] for child in list_child_objs] + driver_to_def[obj_type['name']]['child_list'] =3D child_list + + for driver in property_methods: + if not driver_to_def[driver['name']]['abstract']: + driver_to_def[driver['name']]['method'] =3D driver['method'] + continue + + for child in driver_to_def[driver['name']]['child_list']: + driver_to_def[child]['method'] =3D driver['method'] + + return driver_to_def + + +def fill_prop_table(vm, MT_list, driver_props, driver_defs): + table =3D {} + for driver, props in sorted(driver_props.items()): + for prop in sorted(props): + name =3D '{}-{}'.format(driver, prop) + table[name] =3D [] + for MT in MT_list: + compat_props =3D MT['compat-props'] + if compat_props.get(driver, None): + if compat_props[driver].get(prop, None): + table[name].append(compat_props[driver][prop]) + continue + + # properties from QEMU (not from machine type compat_props) + # properties from another architecture or config + if not driver_defs.get(driver, None): + table[name].append('Unavailable driver') + continue + + if not driver_defs[driver]['abstract']: + if driver_defs[driver]['method'] is None: + table[name].append('Unavailable method') + else: + table[name].append( + driver_defs[driver]['method'](vm, driver, prop= )) + else: + children =3D driver_defs[driver]['child_list'] + values =3D set() + for child in children: + if driver_defs[child]['abstract']: + continue + + if driver_defs[child]['method'] is None: + values.add('Unavailable method') + else: + values.add( + driver_defs[child]['method'](vm, child, pr= op)) + + table[name].append(list(values)) + + headers =3D [MT['name'] for MT in MT_list] + return pd.DataFrame.from_dict(table, orient=3D'index', columns=3Dheade= rs) + + +def transform_value(value): + true_list =3D ['true', 'on'] + false_list =3D ['false', 'off'] + + out =3D value.lower() + + if out in true_list: + return True + + if out in false_list: + return False + + return out + + +# Only hex, dec and oct formats +def transform_number(value): + try: + # C doesn't work with underscore ('2_5' !=3D 25) + if '_' in value: + raise ValueError + + if 'x' in value or 'X' in value: + return int(value, 16) + + if 'o' in value or 'O' in value: + return int(value, 8) + + return int(value) + + except ValueError: + return None + + +def transformed_table(table): + new_table =3D {} + for index, row in table.iterrows(): + new_row =3D [] + all_values =3D set() + # We want to save original hex/decimal format if not all values + # are the same in the row. So, transformed and not transformed wil= l be + # stored + numeric_values =3D set() + for MT_prop_val in row: + if type(MT_prop_val) is list: + transformed =3D [transform_value(val) for val in MT_prop_v= al] + if len(transformed) =3D=3D 1: + new_row.append(transformed[0]) + else: + new_row.append(transformed) + + numeric_values.update(set([transform_number(val) + for val in MT_prop_val])) + all_values.update(set(transformed)) + else: + transformed =3D transform_value(MT_prop_val) + new_row.append(transformed) + numeric_values.add(transform_number(MT_prop_val)) + all_values.add(transformed) + + if len(table.columns) > 1: + if len(all_values) =3D=3D 1: + continue + + if not None in numeric_values and len(numeric_values) =3D=3D 1: + continue + + new_table[index] =3D new_row + + return pd.DataFrame.from_dict(new_table, orient=3D'index', + columns=3Dtable.columns.values) + + +if __name__ =3D=3D '__main__': + args =3D parse_args() + qemu_arg_list =3D args.cmd_line.split(' ') + with QEMUMachine(binary=3Dqemu_arg_list[0], + qmp_timer=3D15, args=3Dqemu_arg_list[1:]) as vm: + vm.launch() + MT_defs =3D get_MT_definitions(vm) + list_MT =3D [MT['name'] for MT in MT_defs] + + if not args.all: + if args.MT is None: + print('Enter machine types for comparision or use --help') + print('List of available machine types:') + print(*list_MT, sep=3D'\n') + sys.exit(1) + + for MT in args.MT: + if MT not in list_MT: + print('Wrong machine type name') + print('List of available machine types:') + print(*list_MT, sep=3D'\n') + sys.exit(1) + + req_MT =3D [] + if args.all: + req_MT =3D MT_defs + else: + for MT in MT_defs: + if MT['name'] in args.MT: + req_MT.append(MT) + + if len(req_MT) =3D=3D 1: + args.full =3D True + + req_driver_props =3D get_req_props(req_MT) + driver_defs =3D get_driver_definitions(vm) + comp_table =3D fill_prop_table(vm, req_MT, req_driver_props, drive= r_defs) + if not args.raw: + comp_table =3D transformed_table(comp_table) + + if args.json: + print(comp_table.to_json()) + elif args.csv: + print(comp_table.to_csv()) + else: + print(tabulate(comp_table, showindex=3DTrue, stralign=3D'cente= r', + tablefmt=3D'fancy_grid', headers=3D'keys', + disable_numparse=3DTrue)) + + vm.shutdown() --=20 2.25.1