From nobody Tue Feb 10 06:45:25 2026 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=1663153928; cv=none; d=zohomail.com; s=zohoarc; b=aZ0ILD+vxuv7LvTfDWFTDCPg3aqM8Y6G/TMILHHCkYeVWFm1Q2YkDX5QrAZVA5oqMSgMKi+Fw2uUmdn5L/xVbf+cliz2W+vMKsKUaFiHVn77N/00QEGGtyOwQFF2eWvcgci1mDBo5LF5vZvyhgugNhZ9/0Jw0e8FCo6+NRZxOuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663153928; 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=iCA3TvzOpzGSwYUA21kDCPvpG/UnlIYQVfMFoKVgdOw=; b=Xtq9XbVTJ93dAOUPaTcjWXbA5k5zrln/nX1fe86Bh7IgZMNInpquezKhmET2ISv2Gh4rbJEqO21WVxda2L/1fm+xefVwgikhDUS5SwsLWBWBGbaNtf17ameYgZ7rW2iNWDXJlO5xoGk2I9+ZlecjhJfAGSUFSYXWzaMmQKOGPkI= 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 1663153928829187.57880320379252; Wed, 14 Sep 2022 04:12:08 -0700 (PDT) Received: from localhost ([::1]:40820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYQJK-00065g-OE for importer@patchew.org; Wed, 14 Sep 2022 07:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3v-0004Ol-PY for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:11 -0400 Received: from forwardcorp1j.mail.yandex.net ([2a02:6b8:0:1619::183]:45704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3q-0005VI-OP for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:10 -0400 Received: from vla5-b2806cb321eb.qloud-c.yandex.net (vla5-b2806cb321eb.qloud-c.yandex.net [IPv6:2a02:6b8:c18:3e0d:0:640:b280:6cb3]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id D5E552E0945; Wed, 14 Sep 2022 13:55:57 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by vla5-b2806cb321eb.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id BUZ4sh4mWm-tvOqTToo; Wed, 14 Sep 2022 13:55:57 +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=1663152957; bh=iCA3TvzOpzGSwYUA21kDCPvpG/UnlIYQVfMFoKVgdOw=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=qypMOMZ8+GU+lJtpmMEzgn70mojBGG5lURlKPV6HZrYX78Ry0/WxU7MJKE4rBNj7f 5zz2Q9/YQ77Y32sAYQ3rj44yUmP2K+GYjsd6jIyZj2G3Q2nE/yJb2dOURdsBDr1bK6 7ckVk8GCNdZJezwnvHB6WYv3/wytEB7HvDWVERpw= Authentication-Results: vla5-b2806cb321eb.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 v2 1/4] qom: add devault value Date: Wed, 14 Sep 2022 13:55:36 +0300 Message-Id: <20220914105539.18461-2-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220914105539.18461-1-davydov-max@yandex-team.ru> References: <20220914105539.18461-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=2a02:6b8:0:1619::183; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1j.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: 1663153931023100001 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 Tue Feb 10 06:45:25 2026 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=1663153233; cv=none; d=zohomail.com; s=zohoarc; b=L4/7BWTVe/awg5XkvA4O31a7ucArv5TFjJ1aIR/CwF7Xv0db6Hc/yo5RfXeAzCsQAe1qSxthKvzEyZdjxvtWELa07eEoA6hPXuSMLOQb7mKGX36dvMskcHlI+w4aaoQYA3uKz4D8ZdB6nFPqgVSsQS2wdDjAgZsWekMcxNDwf3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663153233; 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=OYeiWRd2PeTtBWfHgsi6/ymkA79L1SXo5pYvkeFy1nw=; b=gwH0JSbzox9dWCzkupeqJcXl1TP8wQOLvBd4Q+ytJvBKFHy7zOHHR0VTXgMkL3bLV6MzxY8Iz/wQemE7wmhi23BhC9l6zf0Bexy63lMdVrQtzxfS//+ExnS+l1Nr4T2YWgBvhkX7hIqFFThnLMwrurOi1z9ckmxhrF/L71zSv6s= 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 1663153233692590.0160655281521; Wed, 14 Sep 2022 04:00:33 -0700 (PDT) Received: from localhost ([::1]:50356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYQ86-0007DD-94 for importer@patchew.org; Wed, 14 Sep 2022 07:00:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3u-0004OB-VV for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:10 -0400 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]:41656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3q-0005VL-OP for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:09 -0400 Received: from vla5-b2806cb321eb.qloud-c.yandex.net (vla5-b2806cb321eb.qloud-c.yandex.net [IPv6:2a02:6b8:c18:3e0d:0:640:b280:6cb3]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 995D02E12EE; Wed, 14 Sep 2022 13:55:58 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by vla5-b2806cb321eb.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id BUZ4sh4mWm-tvOqLUjD; Wed, 14 Sep 2022 13:55:58 +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=1663152958; bh=OYeiWRd2PeTtBWfHgsi6/ymkA79L1SXo5pYvkeFy1nw=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=LdFwJ6TQDCbgi15uAbvErHj9B1EqDdIm2G9sfS/Ej1LHdK4KyDCvARkJw9haU+SY/ 34P+5X9YRohHNirik7wmYUHl4ni5fAYPq3QlJxtSSdeIbgSlYOl6QcTeOCBgzF8brV Xw7jgV+lOEqx3KXT509P2kc/zMreWDsDgTCnfDJU= Authentication-Results: vla5-b2806cb321eb.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 v2 2/4] python/qmp: increase read buffer size Date: Wed, 14 Sep 2022 13:55:37 +0300 Message-Id: <20220914105539.18461-3-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220914105539.18461-1-davydov-max@yandex-team.ru> References: <20220914105539.18461-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=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: 1663153235297100003 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 Tue Feb 10 06:45:25 2026 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=1663153893; cv=none; d=zohomail.com; s=zohoarc; b=i9VPx0ghUg/2rzJve/DO7we1HrFoE0E5OjVqHnHIHr1rJCq5BOQDpgxaX3r7bWIaWedB/7P/Ih8HJRphLeqHzcM5fz0dTWXJ+mM2Ef+Ru+sy9hrEVoRvcHqo/DjL8b25oU/aDZuErH1tEP9tOublnlZZL2PI+n6lWommjI61Jfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663153893; 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=oFprw3uUFoLytr9Lv+ETp67t74TaC5z5c04J7UUz0yM=; b=ErzBJbT+dxnWs7GlhdO1Q9Lee+776ULNNWwQD5UrSAHzLfWqXYSW6zHbMJn+ApiZFj0R8e2hcXevS0Dy5Bp+CAyeKEyYnNn7Nn9lGioaHFY/RCH4GC8guRlsFkWTLUOjG/M+V/OdQa2uW4+rhlH1VqB0SkyZKkvDY52UM3bFB0Y= 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 1663153893094612.2869628721885; Wed, 14 Sep 2022 04:11:33 -0700 (PDT) Received: from localhost ([::1]:34948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYQIk-0005Jx-AT for importer@patchew.org; Wed, 14 Sep 2022 07:11:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3x-0004Tn-R7 for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:13 -0400 Received: from forwardcorp1j.mail.yandex.net ([2a02:6b8:0:1619::183]:45868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3v-0005W5-PK for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:13 -0400 Received: from vla5-b2806cb321eb.qloud-c.yandex.net (vla5-b2806cb321eb.qloud-c.yandex.net [IPv6:2a02:6b8:c18:3e0d:0:640:b280:6cb3]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 69C582E0D5D; Wed, 14 Sep 2022 13:55:59 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by vla5-b2806cb321eb.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id BUZ4sh4mWm-twOqfr8i; Wed, 14 Sep 2022 13:55:58 +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=1663152958; bh=oFprw3uUFoLytr9Lv+ETp67t74TaC5z5c04J7UUz0yM=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=vAoi++6qjKJ8Zp3i1EC+t4CNl/KgcXtw2wemTa821KxR20k0LzT9bvnmiEKEh2J2u xQcqdKuXKaSAlnUwRVkY4uxQI8akLQwG8cmcb292mr1WHdXgxBCqRu/s5qrga3l8vl DgaT2Z5SUnGPXhtto/fYqC0GY12Mnh1ueDS7/MVA= Authentication-Results: vla5-b2806cb321eb.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 v2 3/4] qmp: add dump machine type compatible properties Date: Wed, 14 Sep 2022 13:55:38 +0300 Message-Id: <20220914105539.18461-4-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220914105539.18461-1-davydov-max@yandex-team.ru> References: <20220914105539.18461-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=2a02:6b8:0:1619::183; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1j.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: 1663153895187100001 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 Tue Feb 10 06:45:25 2026 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=1663153260; cv=none; d=zohomail.com; s=zohoarc; b=D9bN73sD3eey5cDKnX1jtGm3KqxW6kzSXvWo/v37/C4rbhnXOqXuYdhHJkCe8cvU3soEI2LhJb3AD9sRj5e3BK7TnhdofrwvquxRMqiLUeGRY104c6WLUZuOg0hswpcg/6hWceyKwoWsUV6wAOrhJPFCUM9H8xquoVKN1vJ6CBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663153260; 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=Y0JG+8a82D/bZd6zYE1qlIw5/vMhDkge+cRpSH4M5Dw=; b=c2WRcvyacSrr43+Or+/ujD+yXV3n953wTWpF4y75P3vIOayr6K1hKjB8Vs5KlSJWCGE5xvWtQb5HwjBeCjZbF5eCWRZ60B0hmsHQS9yZ2vNBzSlAwre8UeS//JU3S8x4bw1t04d4G2QvUwoCDp2YDTw9ivDwPXwEwSMN+emiL9o= 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 166315326003765.50445309064037; Wed, 14 Sep 2022 04:01:00 -0700 (PDT) Received: from localhost ([::1]:60490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYQ8Y-0007JX-Jm for importer@patchew.org; Wed, 14 Sep 2022 07:00:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3w-0004Rd-JY for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:12 -0400 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]:41700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYQ3t-0005VY-9Q for qemu-devel@nongnu.org; Wed, 14 Sep 2022 06:56:12 -0400 Received: from vla5-b2806cb321eb.qloud-c.yandex.net (vla5-b2806cb321eb.qloud-c.yandex.net [IPv6:2a02:6b8:c18:3e0d:0:640:b280:6cb3]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 978DB2E12EB; Wed, 14 Sep 2022 13:56:00 +0300 (MSK) Received: from davydov-max-nux.yandex.net (unknown [2a02:6b8:0:107:fa75:a4ff:fe7d:8480]) by vla5-b2806cb321eb.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id BUZ4sh4mWm-txOqWJ3x; Wed, 14 Sep 2022 13:55:59 +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=1663152959; bh=Y0JG+8a82D/bZd6zYE1qlIw5/vMhDkge+cRpSH4M5Dw=; h=Cc:Message-Id:References:Date:In-Reply-To:Subject:To:From; b=Pw9253O69BxZ9hUnZiMw4/0RfZe30MW9lsl+VIsz2lLC8UkkPvQbIU/2w4fzUqcP4 WooMjY4zZrOzxCq/lMB17lMQKBIrduP16svMQyWJ9dUwh2EYafQ/BLQmLJ6ovJWRWq rMflxgiVSXMWEGxK5frxMb6H4JjpfPuS/320dJDU= Authentication-Results: vla5-b2806cb321eb.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 v2 4/4] scripts: add script to compare compatible properties Date: Wed, 14 Sep 2022 13:55:39 +0300 Message-Id: <20220914105539.18461-5-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220914105539.18461-1-davydov-max@yandex-team.ru> References: <20220914105539.18461-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: 1663153261848100001 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 | 374 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 374 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..1df5e6c4f4 --- /dev/null +++ b/scripts/compare_mt.py @@ -0,0 +1,374 @@ +#!/usr/bin/env python3 +# +# Script to compare machine type compatible properties (include/hw/boards.= h). +# compat_props are applied to the driver during initialization to change +# default values, for instance, to maintain compatibility. +# This script constructs table with machines and values of their compat_pr= ops +# to compare and to find places for improvements or places with bugs. If +# during the comparision, some machine type doesn't have a property (it is= in +# the comparision table because another machine type has it), then the +# appropriate method will be used to obtain the default value of this driv= er +# property via qmp command (e.g. query-cpu-model-expansion for x86_64-cpu). +# These methods are defined below in propery_methods. +# +# Copyright (c) Yandex Technologies LLC, 2022 +# +# 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 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 +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) + + +default_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 to be stable and predictable 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 - rule #3, 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 + + +script_desc=3D"""Script to compare machine types (their compat_props). + +If a property applies to an abstract class this script collects default \ +values of all child classes and prints them as a set. + +"Unavailable method" - means that this script doesn\'t know how to get \ +default values of the driver. To add method use the construction described= \ +at the top of the script. +"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 error. +"No default value" - means that the appropriate method can\'t get the defa= ult \ +value and most likely that this property doesn\'t have it. +"Unknown property" - means that the appropriate method can\'t find propert= y \ +with this name.""" + + +def parse_args(): + parser =3D ArgumentParser(formatter_class=3DRawTextHelpFormatter, + description=3Dscript_desc) + 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). Execution wi= th ' + '--all may take several minutes!') + 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 valu= e ' + 'transformation. By default, only properties ' + 'with different values will be printed and wi= th ' + 'value transformation(e.g. "on" -> True)') + parser.add_argument('--cmd-line', default=3Ddefault_cmd_line, + help=3D'command line to start qemu. ' + 'Default: "{}"'.format(default_cmd_line)) + return parser.parse_args() + + +# return tuple (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 prop['driver'] not in compat_props: + 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 driver in compat_props: + if prop in compat_props[driver]: + table[name].append(compat_props[driver][prop]) + continue + + # properties from QEMU (not from machine type compat_props) + # properties from another architecture or config + if driver not in driver_defs: + 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 None not 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