From patchwork Wed Jan 26 16:11:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E3ADC2BA4C for ; Wed, 26 Jan 2022 16:25:47 +0000 (UTC) Received: from localhost ([::1]:54332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCl7B-0001rG-T2 for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:25:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktr-0001wZ-OA for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:00 -0500 Received: from mail-eopbgr70122.outbound.protection.outlook.com ([40.107.7.122]:37041 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktp-0000NX-1s for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:11:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EFn1scNKdCPGTwofGgSRNr8VsWTvQ+Ov+0W/XUW5JjXUxdCtT44H52miNXLdYr687HRRKCi5i7NR9papn/B7M73DzqkqM0188yemCCYyfpqW8we8Xg4SpiK7Z0C5u5lNYdPSI9x75sSohhPm6Wy6sRTCgpJY0yFAGn12quW9kvABlGoLyIR4tqpmx7nSGPYoaqP6HAeeMJiOo7gUByZOHAimcwRN619O4XWx4FHF3TaPQDyRdW8awQBGL8JB6DT6n5bHGCkdyGLAvgNJKTJnqDDCOG+mILEqMBT49ABkDzJShWVZORvYCSCDN3OTMj29ahwvfW3AgK7EuGtPS+YPvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PeoOie/m0ifg/eNPZYb2qekMU5+M/owtwa07LsCt8VU=; b=Q2ZVEpb3QBSzBubO4Is+Z9SkrFec/PZpUWb/MljI63EZ08e++kGJ6urkASUqK0xZ7DVnqTyy6vM6IdNITads1WbVC2JBEsyzZwRSo9jr3zOUXgr1hq+Ne2o4/W7efUwoi0f25TMnn7bc2KQAHE252SG8Yrdv/mY7WvyAwlHho6j1CEonPsyp2pA826s+6OW/dW7qGF5M3MLaUnS+433sged7CMCqq5Kfl/nUpt1oe7TaFTnbHplviBHzw6rajhXQHPZ9CCdN346a68n0NCaFs+/vx/Bkbi53z5EWWbk/a4PwaH5sLi6rw2CLA1eC7npLuCR3BGkYlQMXUtgRja3+ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PeoOie/m0ifg/eNPZYb2qekMU5+M/owtwa07LsCt8VU=; b=QhWdGfPjiEguNlnUGv+qfgShz/kRrA9lPeFoco6GH06nX9a1UOqRsS60jaHu5Z1EvbJN62A8Mwnb2lXu5L0YgZ+Aey9Amq4vF9ymVn1dW/7QlUgqrm2NOTxbPn12bT7AgOBl0Xnzy1G6ReeEfeDr4PFGC3SBbM2DV5xAoJquM60= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PR3PR08MB5868.eurprd08.prod.outlook.com (2603:10a6:102:81::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 26 Jan 2022 16:11:40 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:40 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 1/7] qapi/gen: Add FOO.trace-events output module Date: Wed, 26 Jan 2022 17:11:24 +0100 Message-Id: <20220126161130.3240892-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7fb3fdab-2347-49af-3311-08d9e0e6893c X-MS-TrafficTypeDiagnostic: PR3PR08MB5868:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:148; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9+vTn3xpuyFOyBFdC0YjcG23V2/MqGZHdgC2SxWkmwpI3jCTzZQ+4WgfGPsL69/i16qCLXD+vgJDqQJJqPrR4sHD8bGwBnMKOHkIsQ3w2NDrbqToKtU99e8uTGgSss6a9iKWJdSAZYymsZ1I0ScjLG0+FWYKGQLAsZ9tItAV778IwthMnmwi9vLVwpLeKBnGHzvkZ8N1BqWllvhu8k2V1yFINq1XxBdELGPy8gduIURqtiYDOPXMwFXjZMMdvVqj9Oqr4jrkFTd3IxYdSPCEDePaVx3TBnhAdJJmg0yaU0xz7RrvCHvbc0iLIRtJQNym6XH34GYKoJpA4paeGYLOLsPUOjfbClpKLFmIJoWZFrMb6aXy/i+L22p9p3lcAD7rlVrO8F+5CUtaNBk4pqHEj1Cgu7HAjpz/E1zqjj4JoDoHz56Cce48Tbg/pzOOgX6OKa9bAsWSTwC6Vlr7w5yA/ZnyIRvu7IVr+an1uxRWbzCxFqHiAQo3bUCJ3oebjLR5L6G0Djapl3rhuo2kcDE4SACyi52AFCa2YstbyjeZQUdK8gKGIrb1orHvWLIQE5Z1fMbbjdGnypW3cjIgFL095U9kFYICct1gRSyklXoRq95132GIVPsc7p2/caY9LbbFvlMIUaqfVLJ0NakIT5lzC0ACfqS39T/IARlAxMfii8hITuKAKBreeLnpbJ588pBucAxTaa3gcdIjKll1tyITbg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(66476007)(83380400001)(8936002)(6916009)(4326008)(8676002)(26005)(38350700002)(86362001)(186003)(38100700002)(1076003)(36756003)(2616005)(6486002)(2906002)(66946007)(6512007)(66556008)(508600001)(6506007)(52116002)(6666004)(5660300002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam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+9H5PBAYLRu/O0rE5stQF5YwD032OjufAKxyJ3S0mleG+2nMNQrWwcYvxVclejzapYRUSfO6pfP8yHaoKSOMIQYC36Ex5Y5DwBwRuIl+Z38usCLcGUQmW128MA3mYyOD9BadXp2JPb3CdQSfkd9Nl/0xIDIUXVHFzzkjndot5KzcGrEX4GymuPgyWh5JygunRQTsBidKPXtbQfmP7yf85hMOUZCjj2evspQwmCBh/7f+X5Ou23d5h2tntc+nXc811xaNgxMSLR/8bhjbKtFCWNNEe3FivK/AuYATM/PTm3Y/CVC6+yLv9hf2iw8yQyRYchXu0gLyva9fkce6MSQQ14GYIjEVEoIsYZqZtM449Ls4NVIIc0m4bAZUwLQ9CY8VNzUotAPKEibyx+vkdfIbeyZ3Gc9+Nzw+bocJd6zlIjLvJS5s/A7RVWxyO8G50LhkTgicSqL6tgG/LLLjSWCpKtZK+x6WTjmpI0HtQJU+i0VVWrrxMzvBHJBoyXGz7XJiktBfiGJGO858O5BxrQGnNCl/yCZWi3077QkHn/3dcY4ZNjr/3/GnKD0NEV0LzWgNq3QH3lf3fdlZyDsr1R7YD9G0U/KssLbrPMNTFKeKLlBtfaipwPASsr9KhRIS+OkRuZDK8uupiYEf5Khg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fb3fdab-2347-49af-3311-08d9e0e6893c X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:40.2596 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3D4XcdR8SjFi6+VL6PdzQ0EzYg92vhFd7d8ypFZSJoMtZFalKVE2yl+4LfQ4CxLbCej0fgg/+FAsf751ag32sLzVWLZpRYFUbiREm/Vtvvk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5868 Received-SPF: pass client-ip=40.107.7.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to generate trace events for QMP commands. We should generate both trace_*() function calls and trace-events files listing events for trace generator. So, add an output module FOO.trace-events for each FOO schema module. Since we're going to add trace events only to command marshallers, make the trace-events output optional, so we don't generate so many useless empty files. Currently nobody set add_trace_events to True, so new functionality is disabled. It will be enabled for QAPISchemaGenCommandVisitor in a further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- scripts/qapi/gen.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 995a97d2b8..113b49134d 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -192,6 +192,11 @@ def _bottom(self) -> str: return guardend(self.fname) +class QAPIGenTrace(QAPIGen): + def _top(self) -> str: + return super()._top() + '# AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n' + + @contextmanager def ifcontext(ifcond: QAPISchemaIfCond, *args: QAPIGenCCode) -> Iterator[None]: """ @@ -244,15 +249,18 @@ def __init__(self, what: str, user_blurb: str, builtin_blurb: Optional[str], - pydoc: str): + pydoc: str, + gen_tracing: bool = False): self._prefix = prefix self._what = what self._user_blurb = user_blurb self._builtin_blurb = builtin_blurb self._pydoc = pydoc self._current_module: Optional[str] = None - self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH]] = {} + self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH, + Optional[QAPIGenTrace]]] = {} self._main_module: Optional[str] = None + self._gen_tracing = gen_tracing @property def _genc(self) -> QAPIGenC: @@ -264,6 +272,14 @@ def _genh(self) -> QAPIGenH: assert self._current_module is not None return self._module[self._current_module][1] + @property + def _gen_trace_events(self) -> QAPIGenTrace: + assert self._gen_tracing + assert self._current_module is not None + gent = self._module[self._current_module][2] + assert gent is not None + return gent + @staticmethod def _module_dirname(name: str) -> str: if QAPISchemaModule.is_user_module(name): @@ -293,7 +309,12 @@ def _add_module(self, name: str, blurb: str) -> None: basename = self._module_filename(self._what, name) genc = QAPIGenC(basename + '.c', blurb, self._pydoc) genh = QAPIGenH(basename + '.h', blurb, self._pydoc) - self._module[name] = (genc, genh) + + gent: Optional[QAPIGenTrace] = None + if self._gen_tracing: + gent = QAPIGenTrace(basename + '.trace-events') + + self._module[name] = (genc, genh, gent) self._current_module = name @contextmanager @@ -304,11 +325,13 @@ def _temp_module(self, name: str) -> Iterator[None]: self._current_module = old_module def write(self, output_dir: str, opt_builtins: bool = False) -> None: - for name, (genc, genh) in self._module.items(): + for name, (genc, genh, gent) in self._module.items(): if QAPISchemaModule.is_builtin_module(name) and not opt_builtins: continue genc.write(output_dir) genh.write(output_dir) + if gent is not None: + gent.write(output_dir) def _begin_builtin_module(self) -> None: pass From patchwork Wed Jan 26 16:11:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBC5AC2BA4C for ; Wed, 26 Jan 2022 16:15:52 +0000 (UTC) Received: from localhost ([::1]:35478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCkxb-0005Eg-U7 for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:15:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktt-0001zE-NV for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:01 -0500 Received: from mail-eopbgr70122.outbound.protection.outlook.com ([40.107.7.122]:37041 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCkts-0000NX-5j for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dVTFrf11jJ9fv1QMfJMXFqmoP2JrzGZ9Y0mOa+imfhU47JaGXlJK40Z1E8c8yBC9k1Ku7+F6g/H51WqfMBkgphTDce41j0Bl3xr2mQJoWprAJjgS1MLP8n3a2NJdh5RSjVQdZIvzJziCBXwsedmBw1gvM4ZCnGjvv9uOv2u58G5vdMpeEVLiQq2+rOQzHc7sinQaXzrnqJjvIXP/5fG7/5kgErEpmb1iY1fj716wu+2q67L/oEJjTt/WiVp3D8SSc23tChauvXADfwLRSpLxJpu/EX954mnf2bIYWgfZQc3D/Ea5R9wHl2UaJ9I5T32MXQ1Xr1sqLiIru4S7+0/Vuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RffDSRhsrAP1zhM3yMZgzCJdAz2EhK+upwySR9JvtmU=; b=HPsHkZmJVJgL1fIbjz4p5lq9jlCXutzf6wcr7sBhYkbWrlh+J5CGbV0oMcFQiiN+6q58BNTr19s/5xZ/dRUi5oLx5KvYdAnDiDHniHz7wgBfikzrqnxr/+xAl2p3JA08Uw/TapxAAJCo/NA9ocOBDiYDXiX90TmwnXWaGSdgaHZz/faIbkr2DHofZgGk9Xang8YvzRMlJrsiwXStRuk3p7a0taLsiYBxTI+eLcYYKiMy2pYytd2m8HaDdhdg/VKwSPKBcMP3eHAVK4ssTa8KfmdOtCx41lYNOlRVWQOt0zWj+IaXauvb4v/iw/cwhHfyEHd5IoAf1bPjp0Z7aWSo8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RffDSRhsrAP1zhM3yMZgzCJdAz2EhK+upwySR9JvtmU=; b=Ga2HiXxDuL8Zvicy2bNex4nhw/Eertqx8rVsvZEjGIPYt+yHu6H0m4A0y8H4Tmez/VFopUuJRi77sFHVrQkvIxidObZIGAf88JSQhRhNTk8QPN0Dg0et55TqORkTxZ2zNgMaoE8OFdtmIIoIZ6EYLxMqoGysorZ7JQzJYsVz8QA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PR3PR08MB5868.eurprd08.prod.outlook.com (2603:10a6:102:81::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 26 Jan 2022 16:11:40 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:40 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 2/7] qapi/commands: refactor error handling code Date: Wed, 26 Jan 2022 17:11:25 +0100 Message-Id: <20220126161130.3240892-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 201630ae-7965-45bf-d307-08d9e0e689ae X-MS-TrafficTypeDiagnostic: PR3PR08MB5868:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:29; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5MDRERvSjfsbEB+IQ27trqX2y+fjrUqSEqaEGlj21R5CAaS6U/XZtSo73rEyZ+3vXcGrxiw/stGT3foQR4iIE/UYs+uuVJPh0mSycHMXUo9ZaQlNamPKJy0CI2m0iVgf2mzVy8GZJfRqKH2IOLWk/pCbAWBQuCi+92fEl65jLTnHConH9oyPmBqmOpOIYHMJ4kQCs2lqgmcLNFVLlNH6Xvro2UsGq41S0H/Wgf+BMFqtmSd3xvTgYaYGnqlkgQniyl0b3Kmbe+x9ZPaZiN6C40FtPUO3st5vF8i8L12Elk0NIG2uZc7KvQjG0PskcbE/Ku6d6IXBZlCs3VRCjDRSeSK4h7w60uwNRWx6BkzzlNuuFiSLevmyakT8/RFT1qwQL955ZO3gxChx8qwnYhvePku3ZdB6y5abNwlccMZqMAuh2mmYWsSzT91Ij7xWnKePtG1b4T4StmHRZcNiFXr+Xtlvfk6NCtKXn6TkexTP7SuH4gdSBmeN00P+TVCfpNjeG0QiXAKxvZVrWPcWTCQsavaWJCL4YmavMboTKUGo12g4IGjRTxJUyiDQ4bP37hJfYPEqJhWnxYhWtiI+/isR6YhQuvGGj+bho4oR7LkhLcoIoG/oLC+aiicoru575sWYwxiWcouzVTi9f3O/L+7u5uJh2+lRZ/ASnXBMD0Dj/Dt/02fJwm0Sr1Exavq4wmzN8PRUTVif9q/eUg315h5wKw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(66476007)(83380400001)(8936002)(6916009)(4326008)(8676002)(26005)(38350700002)(86362001)(186003)(38100700002)(1076003)(36756003)(2616005)(6486002)(2906002)(66946007)(6512007)(66556008)(508600001)(6506007)(52116002)(6666004)(5660300002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6q1B4JauaVqb7Y3wO9NNOwIawZOAZw6xqssy1L7dFMPqk4B5l8DQimlR6A72n17OAOFqqOtOFgNvPNA0nAqNXa1TH7OySROeae/Iefwvl7EtYOeBegehkYVN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YfaLF9bgc3i7XEZ46nzo+onaja3vnxY+BC+IvFCd4bgKZT07Sdf3Ap5e00Vy/iRtbpSzEnhkto40lO91QmpDZ8v5iSRPS8LLZbwdy59lPSKbftt9vv6WMqCbeosu58mH1KPEtriwr9SAvnVX0gzpucyzl3Jxo/q2Rv9Awpb3vlO9/qNouUyFJiddDJXrgZONS+5W72paNSky8phypXuJHepTIfNu3hryEQTfl5lIRC5jPT9HILEGAV0wYmNDmUjZhEpLQZl6HACLpyRqnbLmhvIDN/dyQ5QfZTxqJ0CsMpGpaxVamt3ebcNij8p0ADlhwY/2mbqHeCZZo1EbPwTUTX+IGdDoKHOG7BcXdhUtCRah1j2eweEbxqAr9G8Ty9eRfjMaP/Sw0QYuLlleMyrkZKfrDWMHtV3bo84hxDbnjyMVet8nNi1o46nMJEB6PntNkU9PgFutoOA5lGCcIkifJEINTHYePEJVOxkebwrijDF+S9gCm70= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 201630ae-7965-45bf-d307-08d9e0e689ae X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:40.7644 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BXW7OOK+Ae09C3xP49NYbiM8B8wDO+PY8aOGznvu2bSYR2csYbAP/5MdUdkHcJ3ed12t/pCOpPAh4peIq7QreYbcuQwkNQy7pAwYk/dOnwQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5868 Received-SPF: pass client-ip=40.107.7.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move error_propagate() to if (err) and make "if (err)" block mandatory. This is to simplify further commit, which will bring trace events generation for QMP commands. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- docs/devel/qapi-code-gen.rst | 2 +- scripts/qapi/commands.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index a3b5473089..feafed79b5 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -1690,8 +1690,8 @@ Example:: } retval = qmp_my_command(arg.arg1, &err); - error_propagate(errp, err); if (err) { + error_propagate(errp, err); goto out; } diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 21001bbd6b..17e5ed2414 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -74,14 +74,18 @@ def gen_call(name: str, ret = mcgen(''' %(lhs)sqmp_%(c_name)s(%(args)s&err); - error_propagate(errp, err); ''', c_name=c_name(name), args=argstr, lhs=lhs) - if ret_type: - ret += mcgen(''' + + ret += mcgen(''' if (err) { + error_propagate(errp, err); goto out; } +''') + + if ret_type: + ret += mcgen(''' qmp_marshal_output_%(c_name)s(retval, ret, errp); ''', From patchwork Wed Jan 26 16:11:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5204FC28CF5 for ; Wed, 26 Jan 2022 16:31:17 +0000 (UTC) Received: from localhost ([::1]:34524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nClCW-0007cG-D4 for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:31:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCku7-00022I-1N for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:19 -0500 Received: from [2a01:111:f400:7d00::70c] (port=30528 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktt-0000NL-1G for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f+LyhL31dkZWKf/Vyso1dlSpjygH+CoCqNvD+SOBzHbBZ4cBUm5488C9QzoHCB5mjd+yZ7ddiaTu8YoQYNcBuvlFzEnLwBnGrTowp57wzLwRH7y3Cpz7xpnO8vr3sY75q8IoZ6wYWN/SSHOWge/woHrbAA2ZSCASXGApaz+bJKPiSGAC/9ZK2nRAP4oVHBZEvy7dySjEY6Hcz2wnuGeywH8yzo+3uDE2MDslAYyqpLuYElRgd5/fdmwSBsOKsbTWmr/UfylYKOkipLquFwr6tLoDkMfEXJWn3WODopUSv3nvNGKoZfHvRpY/RqGqk8FBnXjDXtLX01TmJPhkHVDg6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CXlFE9Oo4V/0BtkaOYTWKCdG9hpw4qkC60YbLHTzK4E=; b=MkPCr6ObKeMowC7rcY5d1lE3ERrxdap2w+RmteHXbjQEe2uED/+TxicPrikTL0gYZnzfdyKMB2RQgMAsRp7W+E+MUdYBWJenH7GlNLeKxjMj+3H1Wmc6SexUgRyvTblHrIIUCGO6QPp2SJjRswjs960n+XRH8qyd4GBcB+Thv6HrdZSku60Y0snlYcBk6FWYv7afkvDvc6Ki1540sHDDZn6NB0ZwBEbyLbe/ud2O0KoQ1IvpZbNMXX1bzzLXhpJqEjO5aRLAdoYrswsYHyinh8vw5XvKIb5QykDAa8pQQ6VGG//nq64T242KYANtCKBThWU94nKQQXn7we7KqvS7Hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CXlFE9Oo4V/0BtkaOYTWKCdG9hpw4qkC60YbLHTzK4E=; b=WlJvBtyZyleN7wNcHUFeugSyECc8iACiYrN+QZCXsiKGN4SofT2pzK1AHrQvZ38cvsRvhSESPjfqTKMm7y200hp7wzHO5XjL67VzGN466m9s+2bphbc2F/OCEp3h7QipN3ZgR5j/bcAMtfwiyh13f0KO7OTB8WOZYnlAQ+49I/w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PR3PR08MB5868.eurprd08.prod.outlook.com (2603:10a6:102:81::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 26 Jan 2022 16:11:41 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:41 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 3/7] qapi/commands: Optionally generate trace for QMP commands Date: Wed, 26 Jan 2022 17:11:26 +0100 Message-Id: <20220126161130.3240892-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a212f26e-65e9-40bb-01db-08d9e0e68a0e X-MS-TrafficTypeDiagnostic: PR3PR08MB5868:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qnyX0TxJh80qHbM8/IzYmC0pIqzzQSWbBFDJVoc/hzq1h6JdyHbBjo4gscSsZvkF8+/cETfG1JyOXCb2dQUVyfzDAfPjaX1BRUc8kBInk3hrPty7qYX36mV5fKJDDkz9TtaYrXX7y+DPbDxukY7JtAl7nDfHL+uXHn666Eq2/BCZ9aY45Ah8jn1SCUcH9R4A4qVQ1qC6V+cWuXzIzXCynex5lkJseVaQJA6qR1A8nY1O5hlN4kZ3UGKcI2yLAYO0kfS4E8YoF8qFCJJJcVLem8Im+/tTXTOBP6cLK/BDA+jfzKPSloHS8GtC4U7XhsuliDlo2ADDtll228Gx7YcyOS7dtYRPwBw1aJvACpefWrm6MQcPfvOX/rXqJW1awJdNLPNLVCnANzQUHudqPCTGpuzeD5e7DwFE3DoChsyaXra98Y6q7DKYyjR48jed+kihi6XLeGMj9Va8HZm/nGxqIiVSLZafxOrrg/3pEu2viEm3d3AamvdEKUKUnwu0NYzXV4+L+OMO4o0tlnu6+Qsyj6TvnsSRweaagsmEkejtH3KTb9vQSL6r5jBQjokJJgBIm99rRnjZAo7Flvgsu9QK5mgJojmDBdx+6nV8XwvFBBLnEfIxw9iI0WLOq3cFn3a6FMnBEhOQf44h0y6t8k5vYhahD6f8ed6CBiCpAN8oSa/k4gtjYvL70U4D9r76KaGddNte14mAWR1doXFKvBUpIg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(66476007)(83380400001)(8936002)(6916009)(4326008)(8676002)(26005)(38350700002)(86362001)(186003)(38100700002)(1076003)(36756003)(2616005)(6486002)(2906002)(66946007)(6512007)(66556008)(508600001)(6506007)(52116002)(6666004)(5660300002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HT0otSJehR96usXahGAsN4yb3dwdB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95OVaPMllHUehv/rHtGfcSm+Rq5fjCdlwmVacxzMJ24MBUDjslQAjUAcoKTYHGB5Cv9Fez4QcaN14w9N1rSMMlYMW3SgC3vff7eOMcUCTJTG9mYNdjYnnwaK0JLzH1ZeqC5kSgvLMpz3poYfGU2VA2kIn++aVKV7UxthAtG4SKM7XEalpO7cmuEibiD8aOQx4zcr2D+JWhjd5bwvzydYNsOIedMpKzDxb3R2JKF7Hb3Nas56uzMVvKw7cxwXpj190I2O6WrayLfwAtt3jY66Y4M9jnQEaAdn/CmOQYC9ASKcTqUXOblyD0oftEAPYXDHYhSzKXAB/dB6m9peQxHzoGAPE8fQab04GmAPaBxg6ziOmcnL78+GZdtWqR7m8EP5MFbIDJygYloiPLomF67NuFYcYI1cZ6KTYIvojg0wqAgFu3w9Ssi1j5fiV+h27o5D/HU/Pbfrl/SoG3EH0ggu8rqCT4h90P+p5NH9ovR5TYQUfaE+N2O7HMJ51oeygo0hAjKP9WPrtqAI1UcOFw798jeOxOZvZx6fLfKpzqfwRLgB1EbKDn1UMkGyEYk2q7POku/64d5HjwqBa5c= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a212f26e-65e9-40bb-01db-08d9e0e68a0e X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:41.4471 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dPJq5Oihzr2KR3WlyxrEyCGOsIJqHUcIBjFwLltrroG0TU3fAd4NPu6T0nxBUJLgTmBJvsQZdSU7f1p4PovbUpwSva8ris3AQwQOCf9FyiY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5868 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::70c (failed) Received-SPF: pass client-ip=2a01:111:f400:7d00::70c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add trace generation disabled by default and new option --gen-trace to enable it. The next commit will enable it for qapi/, but not for qga/ and tests/. Making it work for the latter two would involve some Meson hackery to ensure we generate the trace-events files before trace-tool uses them. Since we don't actually support tracing there, we'll bypass that problem. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- scripts/qapi/commands.py | 91 +++++++++++++++++++++++++++++++++++----- scripts/qapi/main.py | 14 +++++-- 2 files changed, 91 insertions(+), 14 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 17e5ed2414..fa90b6246b 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -53,7 +53,8 @@ def gen_command_decl(name: str, def gen_call(name: str, arg_type: Optional[QAPISchemaObjectType], boxed: bool, - ret_type: Optional[QAPISchemaType]) -> str: + ret_type: Optional[QAPISchemaType], + gen_tracing: bool) -> str: ret = '' argstr = '' @@ -71,14 +72,37 @@ def gen_call(name: str, if ret_type: lhs = 'retval = ' - ret = mcgen(''' + name = c_name(name) + upper = name.upper() - %(lhs)sqmp_%(c_name)s(%(args)s&err); + if gen_tracing: + ret += mcgen(''' + + if (trace_event_get_state_backends(TRACE_QMP_ENTER_%(upper)s)) { + g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); + + trace_qmp_enter_%(name)s(req_json->str); + } + ''', + upper=upper, name=name) + + ret += mcgen(''' + + %(lhs)sqmp_%(name)s(%(args)s&err); ''', - c_name=c_name(name), args=argstr, lhs=lhs) + name=name, args=argstr, lhs=lhs) ret += mcgen(''' if (err) { +''') + + if gen_tracing: + ret += mcgen(''' + trace_qmp_exit_%(name)s(error_get_pretty(err), false); +''', + name=name) + + ret += mcgen(''' error_propagate(errp, err); goto out; } @@ -90,6 +114,25 @@ def gen_call(name: str, qmp_marshal_output_%(c_name)s(retval, ret, errp); ''', c_name=ret_type.c_name()) + + if gen_tracing: + if ret_type: + ret += mcgen(''' + + if (trace_event_get_state_backends(TRACE_QMP_EXIT_%(upper)s)) { + g_autoptr(GString) ret_json = qobject_to_json(*ret); + + trace_qmp_exit_%(name)s(ret_json->str, true); + } + ''', + upper=upper, name=name) + else: + ret += mcgen(''' + + trace_qmp_exit_%(name)s("{}", true); + ''', + name=name) + return ret @@ -126,10 +169,19 @@ def gen_marshal_decl(name: str) -> str: proto=build_marshal_proto(name)) +def gen_trace(name: str) -> str: + return mcgen(''' +qmp_enter_%(name)s(const char *json) "%%s" +qmp_exit_%(name)s(const char *result, bool succeeded) "%%s %%d" +''', + name=c_name(name)) + + def gen_marshal(name: str, arg_type: Optional[QAPISchemaObjectType], boxed: bool, - ret_type: Optional[QAPISchemaType]) -> str: + ret_type: Optional[QAPISchemaType], + gen_tracing: bool) -> str: have_args = boxed or (arg_type and not arg_type.is_empty()) if have_args: assert arg_type is not None @@ -184,7 +236,7 @@ def gen_marshal(name: str, } ''') - ret += gen_call(name, arg_type, boxed, ret_type) + ret += gen_call(name, arg_type, boxed, ret_type, gen_tracing) ret += mcgen(''' @@ -242,11 +294,13 @@ def gen_register_command(name: str, class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): - def __init__(self, prefix: str): + def __init__(self, prefix: str, gen_tracing: bool): super().__init__( prefix, 'qapi-commands', - ' * Schema-defined QAPI/QMP commands', None, __doc__) + ' * Schema-defined QAPI/QMP commands', None, __doc__, + gen_tracing=gen_tracing) self._visited_ret_types: Dict[QAPIGenC, Set[QAPISchemaType]] = {} + self._gen_tracing = gen_tracing def _begin_user_module(self, name: str) -> None: self._visited_ret_types[self._genc] = set() @@ -265,6 +319,17 @@ def _begin_user_module(self, name: str) -> None: ''', commands=commands, visit=visit)) + + if self._gen_tracing and commands != 'qapi-commands': + self._genc.add(mcgen(''' +#include "trace/trace-qapi.h" +#include "qapi/qmp/qjson.h" +#include "trace/trace-%(nm)s_trace_events.h" +''', + nm=c_name(commands, protect=False))) + # We use c_name(commands, protect=False) to turn '-' into '_', to + # match .underscorify() in trace/meson.build + self._genh.add(mcgen(''' #include "%(types)s.h" @@ -326,7 +391,10 @@ def visit_command(self, with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_command_decl(name, arg_type, boxed, ret_type)) self._genh.add(gen_marshal_decl(name)) - self._genc.add(gen_marshal(name, arg_type, boxed, ret_type)) + self._genc.add(gen_marshal(name, arg_type, boxed, ret_type, + self._gen_tracing)) + if self._gen_tracing: + self._gen_trace_events.add(gen_trace(name)) with self._temp_module('./init'): with ifcontext(ifcond, self._genh, self._genc): self._genc.add(gen_register_command( @@ -336,7 +404,8 @@ def visit_command(self, def gen_commands(schema: QAPISchema, output_dir: str, - prefix: str) -> None: - vis = QAPISchemaGenCommandVisitor(prefix) + prefix: str, + gen_tracing: bool) -> None: + vis = QAPISchemaGenCommandVisitor(prefix, gen_tracing) schema.visit(vis) vis.write(output_dir) diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py index f2ea6e0ce4..687d408aba 100644 --- a/scripts/qapi/main.py +++ b/scripts/qapi/main.py @@ -32,7 +32,8 @@ def generate(schema_file: str, output_dir: str, prefix: str, unmask: bool = False, - builtins: bool = False) -> None: + builtins: bool = False, + gen_tracing: bool = False) -> None: """ Generate C code for the given schema into the target directory. @@ -49,7 +50,7 @@ def generate(schema_file: str, schema = QAPISchema(schema_file) gen_types(schema, output_dir, prefix, builtins) gen_visit(schema, output_dir, prefix, builtins) - gen_commands(schema, output_dir, prefix) + gen_commands(schema, output_dir, prefix, gen_tracing) gen_events(schema, output_dir, prefix) gen_introspect(schema, output_dir, prefix, unmask) @@ -74,6 +75,12 @@ def main() -> int: parser.add_argument('-u', '--unmask-non-abi-names', action='store_true', dest='unmask', help="expose non-ABI names in introspection") + + # Option --gen-trace exists so we can avoid solving build system + # problems. TODO Drop it when we no longer need it. + parser.add_argument('--gen-trace', action='store_true', + help="add trace events to qmp marshals") + parser.add_argument('schema', action='store') args = parser.parse_args() @@ -88,7 +95,8 @@ def main() -> int: output_dir=args.output_dir, prefix=args.prefix, unmask=args.unmask, - builtins=args.builtins) + builtins=args.builtins, + gen_tracing=args.gen_trace) except QAPIError as err: print(f"{sys.argv[0]}: {str(err)}", file=sys.stderr) return 1 From patchwork Wed Jan 26 16:11:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C9CFC28CF5 for ; Wed, 26 Jan 2022 16:21:23 +0000 (UTC) Received: from localhost ([::1]:44604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCl2w-0003nA-5j for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:21:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCkuB-00022j-AW for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:19 -0500 Received: from mail-eopbgr70122.outbound.protection.outlook.com ([40.107.7.122]:37041 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktu-0000NX-1f for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m8DOuLQ0jVJmymJZYPvTT1fWRb3LB3cLGUIBdABDcg9cHd/zs/D5uCDMiOK8pdMg3MzxE0hYlIHDTb1rtNGeG9ElNaqNmltNetTWyhoTuVcc5hSVBGy95ORZLCjiLYIMM1vVKmu9jEX9Z7+9cji5+VPkuG+dP9vy9UeqPb3sV1KzJ1r0g+Aj4/cEv+YoqeezWV4ruMUOm6KtDdxl4tpLBOhK/KyQr07HtmlOYBvPzI48Nq//y3oKzo93+jqJxJ6k3IZNTU6IZszn76EAi39djtl160iji6q0liWyPc4TCJHNYfujO9ntXgSyv6Mghftvd5ZamfJjdi2KB/Z1B4gP1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9bcr5Gd9r3NWBqGA9jnh0Ag1jKdsIxaXHxo6E8UDRRk=; b=nciRpHEiqjKfyuUzISjvNjQ8GlX//mzJb+gaOXfRxuHqj9W2V+7ievSI2S/YzZRjFvgL7d+pQXhofPGGZdfhNOGhdm8sWpx5v2fimtKwjQLYuvBFNPv3/PncD8+KCY1Nye/BSgvfImzQOwOwbO6MikK/2wnxjdtJhBr4QiDPy7unZWOGxi9ZewhTrVTPHk1hPHiobehVFqLxO9osHpT2MRP/qDPViwuouDOZfzIGE7r+SR9Fxkq3oFnEnoozDnp+FXXaw053EpuOIDYV4WReZx5Zla+k2klJlvEA6ZuW5bxVWIrX6+CqZwRYF8WfoZr97GgE9lpIXbTL3w4Do92rZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9bcr5Gd9r3NWBqGA9jnh0Ag1jKdsIxaXHxo6E8UDRRk=; b=BJh8PMzWGJpOhQD3sCx6FzQPiLcB87aN51awfCEYYFS3NrqQx16u8lUaLgNLghdvyd90o2cRxE9BJngeLXT6oqdmMqGOCHwFlFOd7dqWiG4GYW86CJTwokYwO80jil6BMn6Qn/vB8PdD6OAIQMhWdLXds48dPh5t+eDDZ7lkq98= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PR3PR08MB5868.eurprd08.prod.outlook.com (2603:10a6:102:81::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 26 Jan 2022 16:11:42 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:42 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 4/7] meson: generate trace events for qmp commands Date: Wed, 26 Jan 2022 17:11:27 +0100 Message-Id: <20220126161130.3240892-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad1772f3-f439-44ef-5b7f-08d9e0e68a6d X-MS-TrafficTypeDiagnostic: PR3PR08MB5868:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 52ylbriSlW3QedZmti78EdFEA3somT23rATcSRDIFgZBt+bJGuO6BCRnpGnkq09ivFKIQG31X9T7prAbMixtp0kMid+jQ9QQEzI6z22iJoZRXzr0uwxK0oTDf3cH2R7M2C03Wm6I1LFEOu9x8fhiD1M72VeMKmYfym79jcrwfOFz9pNGBPh+z97oWanP4aQQV0qukyE7lvZ522MupWxEnHCWExiXvy6Gjsc2fnuOf4XClgVR+1c5BRyborl4T1TQpxFa/N/NKtH5ZoO0gn74lWlWP7CxVhlIjAF0gnWjLk7hZBoTHdjdQ3uAB8WkMjhVSaBHpdFLGKIHbOmcteVfNKJC0rzFh04TXiZkCMPQmbszH6qWkd1Pq/IuTsupDS+psGTgR2RJESi5nblXxBQkHG/dtqE5CQ/pfbZKFB7HhH27HO5vqnwL6HRL6l5Qevo749vq0ywDfeq1kmj5KIB0bWFjo09GbeqL5B2+Z7bFLMVADzXi1do9cFnqqm8IPJUJCNuvHeJYvzH6ZM1tTwwBf5GOFMA6SYfRAKO/wXUEuT3fG+knc+4EN3n1bF71QQ0acMC2fxiJJJTww8t7jp/IVA8TpLOOOCRitEfmpNKV0W7kQrF8YvCB4YANu/1AWdmx2yRGvYs5vQ2qAn7T86Up1Gh76hA9HDEkdTH9IBvwBA6b3x7N6fq6/A/879WiSM936h7xK59/MLw11KypKXUtPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(66476007)(83380400001)(8936002)(6916009)(4326008)(8676002)(26005)(38350700002)(86362001)(186003)(38100700002)(1076003)(36756003)(2616005)(6486002)(2906002)(66946007)(6512007)(66556008)(508600001)(6506007)(52116002)(6666004)(5660300002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FO2TyQoNh6Lvi6Kbj6R6nMpj3yhmKByLJ/lJx/cSdZXwm3gi+YACVEnvn5G3Kn+bywwZ5RUwtR5BS7enVa2ezACZN8L164GtiY5zNUGofbze80VSJfhFvhDEIyNuwNlDB0+/B4/OYEvsEu7BkQKGaKEf2I7SJ7TOMjhSzFhJD02HDy6IWxhNWAvVxDAnfR3lHToQIZVcKzWa0TRYu7Vm1SY5CQoKSHaEJO7cVFHOiHdKA+JeAQenDgIT7AlgesYzcfJ+WjRIlqP/Y68Vjfc6koIelPz1aJYzuHtmo8ot0y1wQEzRXikEnyil4FyHppXTeImB1J5gKB8Vv1Ym8rXP9yeQ5G1YRbXxH6e8SMvt+HGxNJ1jxbINcv+yGsEx4LT6Bka+g5tdXThKNWuE36Y3/wddUCYZB2GgSCpOXecMN45clJUveKvHxGDW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6zu6YRfuV0eDMbAP/0eGgxXeFyc7fK7ihtemNooqdakH4S+8hA4Pw+L73t41fipnCztODhoxehsoQ+KJEShZY2WzGkIHCpQfaI4re+ZYvf0hFApSwlfRn38r9v6pWsHXGmG/tHGl56hEooq1BKdl3wQicQZgH3IqqSC7wuHvLk0t7GHRRFaTWLW78q5Yt5EK3P8KPn84oU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad1772f3-f439-44ef-5b7f-08d9e0e68a6d X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:42.4960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zkX0/YUFSksHYwlb1LUykpuh/yq0S0ozsj1xZooFaXIQViZIA3i+kYWZwOfHc97PKPdw8dZW8nDTX+Z9ZZpE3JOdYeWMktL5nrQkEoaP0u0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5868 Received-SPF: pass client-ip=40.107.7.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 1. Use --gen-trace when generate qmp commands 2. Add corresponding .trace-events files as outputs in qapi_files custom target 3. Define global qapi_trace_events list of .trace-events file targets, to fill in trace/qapi.build and to use in trace/meson.build 4. In trace/meson.build use the new array as an additional source of .trace_events files to be processed Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi --- meson.build | 3 +++ qapi/meson.build | 9 ++++++++- trace/meson.build | 11 ++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 833fd6bc4c..e0cfafe8d9 100644 --- a/meson.build +++ b/meson.build @@ -41,6 +41,7 @@ qemu_icondir = get_option('datadir') / 'icons' config_host_data = configuration_data() genh = [] +qapi_trace_events = [] target_dirs = config_host['TARGET_DIRS'].split() have_linux_user = false @@ -2557,6 +2558,8 @@ if 'CONFIG_VHOST_USER' in config_host vhost_user = libvhost_user.get_variable('vhost_user_dep') endif +# NOTE: the trace/ subdirectory needs the qapi_trace_events variable +# that is filled in by qapi/. subdir('qapi') subdir('qobject') subdir('stubs') diff --git a/qapi/meson.build b/qapi/meson.build index c0c49c15e4..b22558ca73 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -114,6 +114,7 @@ foreach module : qapi_all_modules 'qapi-events-@0@.h'.format(module), 'qapi-commands-@0@.c'.format(module), 'qapi-commands-@0@.h'.format(module), + 'qapi-commands-@0@.trace-events'.format(module), ] endif if module.endswith('-target') @@ -126,7 +127,7 @@ endforeach qapi_files = custom_target('shared QAPI source files', output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, input: [ files('qapi-schema.json') ], - command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], + command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@', '--gen-trace' ], depend_files: [ qapi_inputs, qapi_gen_depends ]) # Now go through all the outputs and add them to the right sourceset. @@ -137,6 +138,9 @@ foreach output : qapi_util_outputs if output.endswith('.h') genh += qapi_files[i] endif + if output.endswith('.trace-events') + qapi_trace_events += qapi_files[i] + endif util_ss.add(qapi_files[i]) i = i + 1 endforeach @@ -145,6 +149,9 @@ foreach output : qapi_specific_outputs + qapi_nonmodule_outputs if output.endswith('.h') genh += qapi_files[i] endif + if output.endswith('.trace-events') + qapi_trace_events += qapi_files[i] + endif specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i]) i = i + 1 endforeach diff --git a/trace/meson.build b/trace/meson.build index 573dd699c6..c4794a1f2a 100644 --- a/trace/meson.build +++ b/trace/meson.build @@ -2,10 +2,15 @@ specific_ss.add(files('control-target.c')) trace_events_files = [] -foreach dir : [ '.' ] + trace_events_subdirs - trace_events_file = meson.project_source_root() / dir / 'trace-events' +foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events + if item in qapi_trace_events + trace_events_file = item + group_name = item.full_path().split('/')[-1].underscorify() + else + trace_events_file = meson.project_source_root() / item / 'trace-events' + group_name = item == '.' ? 'root' : item.underscorify() + endif trace_events_files += [ trace_events_file ] - group_name = dir == '.' ? 'root' : dir.underscorify() group = '--group=' + group_name fmt = '@0@-' + group_name + '.@1@' From patchwork Wed Jan 26 16:11:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 180BEC3526D for ; Wed, 26 Jan 2022 16:21:19 +0000 (UTC) Received: from localhost ([::1]:44296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCl2s-0003b7-2k for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:21:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCkuE-0002DV-BP for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:22 -0500 Received: from [2a01:111:f400:7d00::70c] (port=30528 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCkuB-0000NL-9M for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e2JOkAbTvOv2pGK5BhkWkDNoZjIfXTMtxNt/JIpM8eO1mgsEAeRpnP1EHv8fSe8W/KHL5avNgu7ubbGonVL6HBbFups/SEvfCkwtfy03p2rQePklW3j3XS4PBMHJJxi5wj4apEfWZUhkbxeQFks+pW4He4gaqFvjUBMVsFLqIRF1iM778s5IX7dxcNrItyzhH08XSXWqyatKb8td/o9IYooT8YeeQTYbzk3lIsxVIWSDhovbxfTr8IkGyEWkqt1FQ1QnI9p1D3cIKws+imiyrD1ni3fovEQR1kIOdv5jTsbkGkWfmBxRN4BJiDzR3Lbz5nptgygL5tSeaSM8Ej+WHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mX2uQOMSzYmepCKxpD5s6E6piUwo4ekbiFXnsC2rgMk=; b=PcYQ2MuRydNx7fmg2kXpEB8fCO9mpHZq38Nb/nZEU1PJ0lxdNwg02zX5zFg0sBo51QWAJ5W2Mx5ZIGIfpFnTLsft+grNdiyk3uCWEF5PIzdC64t/z7bWa55U9Z33LpL6ZbtQWxXV3nlBFPDzOPPzOoh0x5CQmWRP2O30fXcqZUSVYKx1+Udtta+cWsVnlMXiuph1CxdwutAPCNHAZZIPzSpcWZlF9K7qw3ituBSk6WLUFJqhGn6zFAhXJx2JMHSTVi6SHVadrkrqcwFVo//neNv526tf8P6pwU01fmdvjCnVsm7vTbyagS0sxVSmRiIQqIlNEizmj0E+ZPvA0iKYzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mX2uQOMSzYmepCKxpD5s6E6piUwo4ekbiFXnsC2rgMk=; b=QY4sBxlGN1lAzXA7bdCajpnIYmfl9FUeKer2JL3M90E4D7IZYx8+W81wTrB57om25uBt+GV3vxBUPtzSdaD31YmQFltcNzN7lGYvV0GSw7Uk4VoUc63T2TBCNeuJnoDFWN2RDCjUijAKpo6sRuzsoM71Ne55IBd16juZn7+F1PY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PR3PR08MB5868.eurprd08.prod.outlook.com (2603:10a6:102:81::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 26 Jan 2022 16:11:43 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:43 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 5/7] docs/qapi-code-gen: update to cover trace events code generation Date: Wed, 26 Jan 2022 17:11:28 +0100 Message-Id: <20220126161130.3240892-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da6f765f-0635-494a-2dc1-08d9e0e68b12 X-MS-TrafficTypeDiagnostic: PR3PR08MB5868:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:348; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FdUc6ch9+D1IB3E2p478hhyyaDXtkNUcwp0Rps3Xgnh1jq3BAXyoMwHmjeORbi86kPEjSZw9mJAA44INokAgjUT9/ISY/jDLLtn/ZywqNvJD7zlkEDWBr9YJORxR4LXt9JKqFx+BkDr+6mx+mFUfmwfZk+buejLPqMuaEZOPs/u9h8oKVbGEODn9BUcQ8qw6rfuJVN6pCK358kKfSa5L8dqSjm+07J+8hzOyUJIX9OA7THsbuGDldy4EUeUo42vm6j/xHPYOUbD8SBiUVHmvMf62uczrvzV3cQd+gCcM0llZmAZp2T+xFIvJaOZy6P2v1ohqlZ3uevjZpbNjJw/+q5ppzWGVQKQ6G5RZYcTE47CkctvMZVhfRxlD7YoFjnPmnMNhR6khjHa1kLx95cLHBsShcnqD9ES9zR4xkQCGaUhfJFrsLkNY2oncQHAmZf9caF9Kf0bq6ywd+Veuz8ESLeGZk7x1Vq0Xpx76nWLDJ+VkOxTqkCJQFaKx74TnQJQlpOdwroQLAACJ1kgF/V/Dyf9nBRUuhPBX6en3ijGFltbORHNs0bUt36RQQ788VO50QAFS+UkJwsB+q07PJB7SR12OWWN3rLFa+bCN1w3pjKUbYpo3JdNnxy4tZmj0+74cEHbXDhB/MiR0X7mLG3+A04FHhlQa+TujOIjt8izMgmN1acadZ4+8M37u6qh6nHo4MrX4EpaiXr6bYDqV1Vco+A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(66476007)(83380400001)(8936002)(6916009)(4326008)(8676002)(26005)(38350700002)(86362001)(186003)(38100700002)(1076003)(36756003)(2616005)(6486002)(2906002)(66946007)(6512007)(66556008)(15650500001)(508600001)(6506007)(52116002)(6666004)(5660300002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qt5KCu8cJO2BXEIg2EhINvEFQuvOO7c+oQYvLmsfWPCzZp1ygyOuML67FteCzqFExaumEYtQvRHFXDu7hFe6AbysHEl9H4liseCinD52MsuOwqMKmmBOnMBC/Hxd/pTq6rZbMasD8U3piwWll7fcXysA0u4aiP86FBAqX/Nn2NJyRw2tNWR6ihHjQzypMVLRkByB8uGXS1wYMTHvtAp+JXh20Vc56oDdrQf3wMP1SSLDLbIS0zkFWKTb/oNNweNqX6MBhaQ/niSAJ2v3GaOhoJ77gOiDYTR/6j3hMLe3uJ7qaTf/Dg9pSACmgKeKxWBpp1lInWbf61xS/eT/T7NWaGI6eUh18v5i/CAlSi/mmCbBiJmHxeXP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lzVVd+eqNJclm6zyvUyZsYcu+6p7W2qmU4n4Fex0IJSrmpY4veWGxouXVYyzlczK72NvO39/b75X8/EHyLSRuvlgvYR40yqUp+OuQCLjlwrYunUKKT7jY5e/LlmFsmLsWNiE5hmRxgqMWSnxE8ockFdqTLWimf49WRrzt9cSbY2R854ChF8uz/Ocf6khTSEebN10uI4NhiHhxPBhMOkHS8lMFq13STKSB1YW7QIJfGMa5ugv7vP3eWoJqti3bhil84= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: da6f765f-0635-494a-2dc1-08d9e0e68b12 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:43.0740 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KO/Ioz4iIjfHOPzl7cFHUMVsh/ubXHbnhNAsLJxRMhSvTblB4K63LEfHS3g7GArDTJ/3LZPw93pgFIwZtBWmVDWpZFuGatUBjjokChGUP40= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5868 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::70c (failed) Received-SPF: pass client-ip=2a01:111:f400:7d00::70c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Previous commits enabled trace events generation for most of QAPI generated code (except for tests/ and qga/). Let's update documentation to illustrate it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- docs/devel/qapi-code-gen.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst index feafed79b5..246709ede8 100644 --- a/docs/devel/qapi-code-gen.rst +++ b/docs/devel/qapi-code-gen.rst @@ -1630,6 +1630,9 @@ The following files are generated: ``$(prefix)qapi-commands.h`` Function prototypes for the QMP commands specified in the schema + ``$(prefix)qapi-commands.trace-events`` + Trace event declarations, see :ref:`tracing`. + ``$(prefix)qapi-init-commands.h`` Command initialization prototype @@ -1650,6 +1653,13 @@ Example:: void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp); #endif /* EXAMPLE_QAPI_COMMANDS_H */ + + $ cat qapi-generated/example-qapi-commands.trace-events + # AUTOMATICALLY GENERATED, DO NOT MODIFY + + qmp_enter_my_command(const char *json) "%s" + qmp_exit_my_command(const char *result, bool succeeded) "%s %d" + $ cat qapi-generated/example-qapi-commands.c [Uninteresting stuff omitted...] @@ -1689,14 +1699,27 @@ Example:: goto out; } + if (trace_event_get_state_backends(TRACE_QMP_ENTER_MY_COMMAND)) { + g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); + + trace_qmp_enter_my_command(req_json->str); + } + retval = qmp_my_command(arg.arg1, &err); if (err) { + trace_qmp_exit_my_command(error_get_pretty(err), false); error_propagate(errp, err); goto out; } qmp_marshal_output_UserDefOne(retval, ret, errp); + if (trace_event_get_state_backends(TRACE_QMP_EXIT_MY_COMMAND)) { + g_autoptr(GString) ret_json = qobject_to_json(*ret); + + trace_qmp_exit_my_command(ret_json->str, true); + } + out: visit_free(v); v = qapi_dealloc_visitor_new(); From patchwork Wed Jan 26 16:11:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E83C2C2BA4C for ; Wed, 26 Jan 2022 16:21:17 +0000 (UTC) Received: from localhost ([::1]:44134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCl2q-0003UP-IF for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:21:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCkuF-0002Gq-Mj for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:23 -0500 Received: from mail-eopbgr70122.outbound.protection.outlook.com ([40.107.7.122]:37041 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCkuB-0000NX-O5 for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YuQHyKBuGpTGeUjIGAXzY9yNIEwTP2Rdut/KcqvZQRTfiXCDt+jg+TmF/3PlXfyOFeuc3ffJkLnkqj6vxcJMI4VuBWdb8gqrjvkGH7kV5SJ6QjwCbSa+MGhRCDpuwafg+H0X2Vc/f/z0V7XNVvQ5+EdkblT4lRtX2/vmJUKsrLoe73H2uS5ec0QpGh5Y5CZJ2dsRnhnR4CXixZjdd49r24BVAndK8oco1HEtGPa5xUp9fGoD4InRxWPWUYnh+YjeOYbvBaZyp/s/507SKhRir17S6O6BYPuwoH/6GJcQ7liRzUUQ8v+siQM17ThyOzNo6/NCAEdsIWbsdUodNo3zzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8nXw3Rg5xki/EYwjpTH1qSFZN/7iR+L1Br82XD5lJvU=; b=FMtUrUYmv+vk0cnTW2kN2/71HnwbhI/TYOjObRb+DY/hIzSilA8PKCEz2VM+fxbO2o8U7WqyyBxaQ/tzuprmeBeuOlMud6s01iaIa0QqFu045IA3Tpqv3oSJLFSpPThRerlZw3gDLl7NhjxvppUZK7bJ1DthljIyazLZNJmoOwDFv9EwLt2798rm+eHezGNQQS+z9X1XtA6PaBXoxq1ND86/csY79X7yAR6gbe4WLG1TEGSgV+MSObiO3JJWVPB2dOcGXL9ZAptfQSL2/OTzFPS72ViT54wFN3r40ToS0DTcW7v/dlYiyPYnqmla2T9W1Eyi46n92mpz/Vi2QnkBkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8nXw3Rg5xki/EYwjpTH1qSFZN/7iR+L1Br82XD5lJvU=; b=WjBij63F27gyNdWTzAQZvJfZq3NQjkW7CBd6bnU6n4pF0n8Wd7bY8yFu5pbSwIHAOH2a5WduaErELyxUeGAzcz5UUKBXZNwpmEspBOlsLAd5oedXfWAAtsmBVjfJ0l0Q2DLoS7iWjA+chRuYZH/IyD+O0QMXXB4FOt4dvo6tCmI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PR3PR08MB5868.eurprd08.prod.outlook.com (2603:10a6:102:81::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Wed, 26 Jan 2022 16:11:43 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:43 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 6/7] meson: document, why we don't generate trace events for tests/ and qga/ Date: Wed, 26 Jan 2022 17:11:29 +0100 Message-Id: <20220126161130.3240892-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b7d6953-2fb0-4b7d-e682-08d9e0e68b73 X-MS-TrafficTypeDiagnostic: PR3PR08MB5868:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gjJ3AbVtwddH0jaC4oaYwCzVIeA+A2slaVasjzynVonHKJb06/oNflipLzfE+DddpCfoNdHKNt9tToUBhrenHa3M2H2p/1psFhwQmLpyhKSAJByqxHuhfzgcAshMCYAY5sqAYBX6ITWkw+b6HNG4PQhexB2gEx+qYlClgj/QKQWX0vMbYsmBtPa5AwINyBxtUF8/OmMKJCDW7RC3KclITYob+qZLuY0y45ffdMXuoVZ4Ng9WFWXTnnJon+rHcQxeLBHXYmpYIN5wyT+03aX7Rp3JmpVKXAgP3zwk16Qm56PzIIFXNcv84GnvfXogObiXoJ+VKN8ZhUEfhsF8GMs2gLQOoqHoe1UF9WEKMiSzYU0Zbwv0gvdagXh9U5jd0qgdn6IIpNteFkg06ybfZbAjSTFj8EuqjsL4XlsDHFlE+MDHZ5loj6jSyWIhywji3GuSqrQpVq7AowqZ4wixfG8/VSczP/ZaN3j9l8vIMoIreGw6yg6i4FeeDmh2sX4QktG1YzLfmmdECae3NrFWE9XDMLejwYo0NwFcYZ1nIArQoNi8i8tRCmu9cQLeAOqGgvfiNw18LYEb5FpgKR1LAgIG9xu65b8a/JzQaos4cV6SDz+qLPD2s5mMNAeYkuV4eBnrgU/zsUU0iLze2mEQDXh6VJM2KJcFWVLr3Q4dNh86eKI7i3D5IyZX2HEp6xKuqjagVcyCCDGRxIuUS0yhzp4tKQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(66476007)(8936002)(6916009)(4326008)(8676002)(26005)(38350700002)(86362001)(186003)(38100700002)(1076003)(36756003)(2616005)(6486002)(2906002)(66946007)(6512007)(66556008)(508600001)(6506007)(52116002)(6666004)(5660300002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lxdTqzFhKId64NDsc2KKsVQL5GTsoATYMbYbvp7dA558SiTPfsF759upZqpYRGFeSva9xqR/PZkYAwY3xkbhY4OTsx1jjmGUXhhtCsDd3svUeLBDnO52wQOX0chzcbqOviRdbdpLs+wbucigdmrqQw4PqTba8Njv7KcY5g/MJ0r8DuyYwEfWAGTKTtRHrwQE0X+CQtcdOm4RoqSw/Bdt0bPAapav6bjVLde+dfNm9RFo/q16PBOYMbU3Rsnd9ud7t47B4XiklaT+vB//3ec82qT5CRG230871pl0XbMu4HVh/A1cLSOOL3JHfpXuTep9tdZquzTZD7Y1vKbsirl3bbUOfnUuRZyKFqP2WkfzYAEzLfnNDNSCtoNv0zxnxMDeMiukMQsTtsvBqTDR/PfbKOEcFq9ymbndWnYX8PjSRKw24KVKnHqqGEuwuGVlbfZKDR4wdKFptSE+wD1/mwMxump2Fr5cI2HY9NeLZtjYzk1YopjXgYXdItKAZMRBXtYJe1hxYUuqCQlU02RoYb0PZ2PXtCAyjixlKoGiNq0wVlWB2n2ZypvHLkwnd4nZFqC69EqrMd8gIGW3VEFRDLmx+4x0O/P9WSvNXMpTtpyIP6xtZs1WfNX/Okzt3QVa5Qnsx1BCTU460bQawfYDMZNFUMlQLXxW+tWbqPZxjKasteApK2rDLmXwx6qpIsDXCLS/gOwnLe/tRmNmc7tWnnK9uqjxlBpfRwBHlC/FSQ9muBuDpTASYCfj1JJklCKe6rz7Wlpd7ESm4HKcszXgUpvrk9T0BwS3fv2z1Xg6UnVqSVYLscU2Jp2W37nWHTc7Kl3+sPITFs109VSaXGnyQVO4Jyzl1g3Fc5gCmse0yOzEAF7y/DstulfmVJk+kq1cX76KsibE5VRU0qBwzMjmNTwcpApc9HpwbucQq/xXhQ3//jQTPfMG+epwYhjXWk3wFZ8r2sHTXnPM8kJTf5qE3wz2C6CJLmizPIWxhkrrgB/dSPMVwRzB9z/Ir1i6KxBzeHkLQ1nmcMHOJ5uCLttulgjXOztbyQUClKNO1kDCD8448hC+q9xeSR++CVurfu8Kf/Gqgdkt4HN8M++aao1XtNAnLgnEhver/Z/XNuXvIenLBQ8PK3+mcU2b37nYlge3nlVSOw3I/07LFTXGpS50Ap14cp5JcXH4G2rwzYMLcHHsda7zg3OvDO1MyiH3HVhNgpljeIkRXbMSeFn/5yLBDwxusujkJ4BYIF78W2gGBbE1or+Qd04yA/zpSboja49EuXTU//M/I0MHkciFLNsgFSjfxRl4laWjsyrvtYTBpT+fq2oBBEJPFTJdFnOZWdv2Cu1ctSrKVeR8MXBYPQlKlm0kUf6duyCgwrYF+fucuZUXcMfYr8I0dY/9Ny7m9eIUtmY2Ufs+xvljI6NJX/uqmpj04JhkViUsD/hURa+VywcjH72tAR/jd3s3PY2nzB8qaIJqMxgoT1p9aOKwmdKo1OI7bYftq2xMjzIP8yMeA3fnC0Au/WQsZlAZlUR5aJQ/6JadlyEJLX8AefqpD6Q6I6rL+6qoyaSef/CLN/Az3TctaOCJ2XOegLpjSr8+VUGNyaPhQSHLydM+TlW693c7ky1EzpyzlcQ6rZ4fe1mzoo1j3tj9WwQzYQhU8LszgLsbSUR71oCjTfBCeaAfEka1LhZBLF9cWnlcbwl1YTwNQcrOVnM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b7d6953-2fb0-4b7d-e682-08d9e0e68b73 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:43.7927 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BrnV2uhRVRegjxMU+ZljfRgGmBe7falW+YkynfyMaRQSuEEqXPAZ3/QvQFVCoBdoYDXtMhlGWuYa8KgsVRK1z3nWoGA/ZbXy7A6eIeXWY0I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5868 Received-SPF: pass client-ip=40.107.7.122; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Making trace generation work for tests/ and qga/ would involve some Meson hackery to ensure we generate the trace-events files before trace-tool uses them. Since we don't actually support tracing there anyway, we bypass that problem. Let's add corresponding comments. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- qga/meson.build | 7 +++++++ tests/meson.build | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/qga/meson.build b/qga/meson.build index cfb1fbc085..724d5a667b 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -15,6 +15,13 @@ qga_qapi_outputs = [ 'qga-qapi-visit.h', ] +# Problem: to generate trace events, we'd have to add the .trace-events +# file to qapi_trace_events like we do in qapi/meson.build. Since +# qapi_trace_events is used by trace/meson.build, we'd have to move +# subdir('qga') above subdir('trace') in the top-level meson.build. +# Can't, because it would break the dependency of qga on qemuutil (which +# depends on trace_ss). Not worth solving now; simply suppress trace +# event generation instead. qga_qapi_files = custom_target('QGA QAPI files', output: qga_qapi_outputs, input: 'qapi-schema.json', diff --git a/tests/meson.build b/tests/meson.build index 3f3882748a..af8f5b1746 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -31,6 +31,13 @@ test_qapi_outputs = [ 'test-qapi-visit.h', ] +# Problem: to generate trace events, we'd have to add the .trace-events +# file to qapi_trace_events like we do in qapi/meson.build. Since +# qapi_trace_events is used by trace/meson.build, we'd have to move +# subdir('qga') above subdir('trace') in the top-level meson.build. +# Can't, because it would break the dependency of qga on qemuutil (which +# depends on trace_ss). Not worth solving now; simply suppress trace +# event generation instead. test_qapi_files = custom_target('Test QAPI files', output: test_qapi_outputs, input: files('qapi-schema/qapi-schema-test.json', From patchwork Wed Jan 26 16:11:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12725399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D63D8C28CF5 for ; Wed, 26 Jan 2022 16:21:15 +0000 (UTC) Received: from localhost ([::1]:44016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCl2o-0003Po-LU for qemu-devel@archiver.kernel.org; Wed, 26 Jan 2022 11:21:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktr-0001wa-Qw for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:12:00 -0500 Received: from [2a01:111:f400:7d00::72c] (port=31064 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCktp-0000NT-1S for qemu-devel@nongnu.org; Wed, 26 Jan 2022 11:11:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tzwy6/jxxHTX+TXk6juIx8oDcPv4arIhiRvaCREYURZxsJNmfqOIxw0MopfStmqhMnWY4T3kgCdgDy1p74+lj/5ClTYD5DqPTaCE+cXRb+MWs/q9lSIihAzrhBUjq9kjzI45k4VunwOmYwZ2eyXCN+v/2Mm6HDfluKAm4/xEAjQAs6pWGWCGrb2xMGH7kjqQ85PkInghaF8G+Nmy6rrDXrFVHbg9Uda/cLQf5yp0YssHBEx2urLOIqRdnzQ3TMrFlRIu2Xtd5bk/qdS0jsXYXOR4XZ9mFX2uN+eoRTaXqzZhwAOhO3xV70lQIQoW6dUGy+GhMQWRe1Nve7L2U39AOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H1OF+ppfUJ6vJ0xZ1mqacMZbELYjIcho6rXeCpsPMH0=; b=MAysYXmz8WG4UiytRzKhXtE/+UFrYfNDUNvOrDPLqEaHMGRATwovF7uHCMiJUhtKDCQ7x2ITJK2hQXThIiXEW4bi5gV8s4ommCxXT1ejYxnnzbOsdr3nve/GccwmpVYNwnAkdstHLI1/71yjnNiVVrvooyn6ATiA1mZemyT+CN3PdDUtSeCbxlbLWHxndP4O5z0fKYYhH5nAqUhJpalvUWjpLXy50rty2tzWAaxEhI5BFHn47+nyZeBlF56+wEsKAOqiUT853Ea9+Gfjp6YMWyIATtT7Ub1wojwTcY86/tD0mvCJlzjkBWxPAyoSEdOOy7Bj9l3GVr//eBlA8gyZ4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H1OF+ppfUJ6vJ0xZ1mqacMZbELYjIcho6rXeCpsPMH0=; b=V4EYDqiBIqUUjVa01y7zhgUXonVrlqYvVfFnpLU4UnrKbOKLisSdT/U674y0LSo0hy+60omydjKAHrtCEcV3TnAHMeAeTxrXRRqUbnT1ur9lsVKhJAUR9ys4LnsTaimXL+wB49vk/PBOl2wtsOm1ySV6m0OsHbm5I+nGPCQKA7s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by PAXPR08MB7366.eurprd08.prod.outlook.com (2603:10a6:102:227::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.17; Wed, 26 Jan 2022 16:11:44 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::4def:4b08:dfe6:b4bd%3]) with mapi id 15.20.4909.017; Wed, 26 Jan 2022 16:11:44 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, michael.roth@amd.com, armbru@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, pbonzini@redhat.com Subject: [PATCH v6 7/7] qapi: generate trace events by default Date: Wed, 26 Jan 2022 17:11:30 +0100 Message-Id: <20220126161130.3240892-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126161130.3240892-1-vsementsov@virtuozzo.com> References: <20220126161130.3240892-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0049.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c927580b-aeca-4ea7-d744-08d9e0e68bd5 X-MS-TrafficTypeDiagnostic: PAXPR08MB7366:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s6cxXkoT60cWRoeOlbDosh/TptApWwdsrtSashuQzItSGwzrL1XYRbXws6lm5vHQs/Zc4MLPItclUBnUsBbMQGytkpAwpTOI+/MJjChxkyI84VJy6qTk5HDi4Av9VuSSMsNf5okielbATtaf2iIg1YDQAYj3XleC0ZuINvxWnI6gWtt/XMDh7eIhhrymPssvylqmd82MSKbjxnn5/u5cm4expQscLLWFvGod51p31nO+2I2E2vs4xsA9aUo9MocYYukTxgkB6+zI+45coMU17HsmYGRIPIZaDqjxW4ZCuYpp0qeXC7VbHBJss7p1DZEqgnEf6mBSn+CUuepY3/3y/lCxMEQ0JLfuHdOzw9QDw0SRr69MAeiULuL0XndEODksW9EY2NHsvaoT/vxS3llbACZY973/DBR5alFkuBtzOy8sX5/xDhx/65G7tJmuGii+PC1YecBti7deFDTN3WA4tCB2+q99ioalb4zhBz+pWj7rrhE2codq8QYYiUT1sstueRpSyVZtEUDAWGF2S7BJBIL9JziMKH8oOyBpEMMMdlCznCK6JySEWT51PvpMDKbOK+Hkl/GmOEfmwZ2gTUsNAdc819bpOTFFRa+YCMneHL0WnU6FzO2bWd02A1CNzXqy+2l3KmaNDtJQvfwy6URLdWgGMBXrCbsjDsSNtItxZNV1ndZuYWw3dzz81krLwG/YNQ/U1U0cY/2ek4deFIYfAg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(316002)(8936002)(66476007)(8676002)(4326008)(6512007)(5660300002)(26005)(6506007)(52116002)(1076003)(186003)(66946007)(83380400001)(86362001)(66556008)(6666004)(38350700002)(508600001)(38100700002)(2906002)(6916009)(36756003)(2616005)(6486002)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qcekY6AmrEAJ/ZHqIUMImDDkmT76AGpFhXvUSU8OXOHAfpB8lR1Z5d4025X76b19FZaQo1uUDD/cWGFQchGowJJM9pIgCProYh5eRCBXJNFlc3ir4hhwUZdejFxSm7ueZahq/hsl12tVlakJkAabPUV0XCvNL4uzg6KV0M5Eiby+X8Dl2107W3lgVUwKOUXidhliBzpK0FqWnQyhH8zn0/v/glw8Ox7pougIBHhNeW4dsPkZ5RDeVsaI6n5/8K9EZUYZhcTRmEC/F33mtyCB37VeWAGkKwlQzFCmmM9bngeWbXIIXS+whMCSAmM+Af6kfodAZD97QR+jjbzhQgTRwMbZ4PXdeYSo2UMIiQcNvH+p+6NStNTH/OrDYneqMC+KMJzrIOHAUZ4qay3SyRtzIpZWqvEDuEnwnSZgYhaqp0wrVmnpOJtDUrF0yDCM/syuxY99GpefL9Xhe3o6kUYaSIJ6gcFrwta2DrDpAVStD1Ra8K6J8JiM4aYblFOf/lRD/SZLt7BH/yOXA3SRhUCezBNpnnuoc7pqLg46rUNxpgx/XDKiEwikyg5w0CBUAArkH7oXs9pnw/+8KNrtmIQbTjEWWzfAOkMq0mrvgOsRPpEZ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+wzEfbwDUxkTFQZs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c927580b-aeca-4ea7-d744-08d9e0e68bd5 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 16:11:44.3733 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NoiaqXZ168G2HfJtGBHJxDTV47g88QyffGyhPrXzZLWLKU52N70MxXgyNFJqI1vQhBCgcHGwJiw9CjEqbjySNyOThO8VIi798lK/TM3sx1s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7366 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:7d00::72c (failed) Received-SPF: pass client-ip=2a01:111:f400:7d00::72c; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We don't generate trace events for tests/ and qga/ because that it is not simple and not necessary. We have corresponding comments in both tests/meson.build and qga/meson.build. Still to not miss possible future qapi code generation call, and not to forget to enable trace events generation, let's enable it by default. So, turn option --gen-trace into opposite --no-trace-events and use new option only in tests/ and qga/ where we already have good comments why we don't generate trace events code. Note that this commit enables trace-events generation for qapi-gen.py call from tests/qapi-schema/meson.build and storage-daemon/meson.build. Still, both are kind of noop: tests/qapi-schema/ doesn't seem to generate any QMP command code and no .trace-events files anyway, storage-daemon/ uses common QMP command implementations and just generate empty .trace-events Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- qapi/meson.build | 2 +- qga/meson.build | 3 ++- scripts/qapi/main.py | 8 ++++---- tests/meson.build | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/qapi/meson.build b/qapi/meson.build index b22558ca73..656ef0e039 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -127,7 +127,7 @@ endforeach qapi_files = custom_target('shared QAPI source files', output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs, input: [ files('qapi-schema.json') ], - command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@', '--gen-trace' ], + command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], depend_files: [ qapi_inputs, qapi_gen_depends ]) # Now go through all the outputs and add them to the right sourceset. diff --git a/qga/meson.build b/qga/meson.build index 724d5a667b..f06b726ad3 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -25,7 +25,8 @@ qga_qapi_outputs = [ qga_qapi_files = custom_target('QGA QAPI files', output: qga_qapi_outputs, input: 'qapi-schema.json', - command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@' ], + command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@', + '--suppress-tracing' ], depend_files: qapi_gen_depends) qga_ss = ss.source_set() diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py index 687d408aba..fc216a53d3 100644 --- a/scripts/qapi/main.py +++ b/scripts/qapi/main.py @@ -76,10 +76,10 @@ def main() -> int: dest='unmask', help="expose non-ABI names in introspection") - # Option --gen-trace exists so we can avoid solving build system + # Option --suppress-tracing exists so we can avoid solving build system # problems. TODO Drop it when we no longer need it. - parser.add_argument('--gen-trace', action='store_true', - help="add trace events to qmp marshals") + parser.add_argument('--suppress-tracing', action='store_true', + help="suppress adding trace events to qmp marshals") parser.add_argument('schema', action='store') args = parser.parse_args() @@ -96,7 +96,7 @@ def main() -> int: prefix=args.prefix, unmask=args.unmask, builtins=args.builtins, - gen_tracing=args.gen_trace) + gen_tracing=not args.suppress_tracing) except QAPIError as err: print(f"{sys.argv[0]}: {str(err)}", file=sys.stderr) return 1 diff --git a/tests/meson.build b/tests/meson.build index af8f5b1746..6d11dd436e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -44,7 +44,8 @@ test_qapi_files = custom_target('Test QAPI files', 'qapi-schema/include/sub-module.json', 'qapi-schema/sub-sub-module.json'), command: [ qapi_gen, '-o', meson.current_build_dir(), - '-b', '-p', 'test-', '@INPUT0@' ], + '-b', '-p', 'test-', '@INPUT0@', + '--suppress-tracing' ], depend_files: qapi_gen_depends) # meson doesn't like generated output in other directories