From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643295124; cv=none; d=zohomail.com; s=zohoarc; b=HN1d2or7lR0+P/Vu2wnfyjjfScWirBhiwQ/H6DVbIIUpLJ66bs21s9BXeTpTysSEuP2Mm/yHJWJx6bLf4oZYE4O/uHz+JcjNOainPFTu+ejJqTefAXJG0q/qKGpTN1ajn8yXMryk4U1kLmcLRJakMgzhlT9Exb9IWBuWtNIEG2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643295124; 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=LD/BvmwFxeDFmz1CA0PqMx56Fm1tSxQo7h+DwLqdHOc=; b=bx8wBg77uhsRGtNQ461ULBz9oEeasJ6leHx9msE9NT3JF5Vty+ORG8h8JI1YTns6iisI/79cYNDSz11cyME0xJq4V2Ni9c0Nk33Y5UfcEittKFJ0i/0EtJk5N9L3uvfmiu1XxeZxMVO372gMrB9heNojnKNxSOuOGjI582uB+xM= 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 1643295124253396.0514999787398; Thu, 27 Jan 2022 06:52:04 -0800 (PST) Received: from localhost ([::1]:40416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD683-0000QJ-Bz for importer@patchew.org; Thu, 27 Jan 2022 09:52:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fG-0007L5-He for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fE-0003Oh-Vy for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-jfBz99nOPqmF3S0VEwOvIA-1; Thu, 27 Jan 2022 09:22:13 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 986AD1932480; Thu, 27 Jan 2022 14:22:12 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED3F370D3C; Thu, 27 Jan 2022 14:22:03 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9DA5E11384A5; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LD/BvmwFxeDFmz1CA0PqMx56Fm1tSxQo7h+DwLqdHOc=; b=ej00LMMykzqvEDUcCUADVwNVPaE4/ja0YbWyL0zyh5M7WvgzvGogkArH6e4pheaU51Y45g pnsAI44aA56A3ZWarD9qOVqf+CpuAlwHRAIiTGrLaVCkHGuMwRX7wEdDEs0kBm8fdSil2l LGyxguQGMjVS95UVm7fYsEe2ZxYrDKY= X-MC-Unique: jfBz99nOPqmF3S0VEwOvIA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 1/8] schemas: add missing vim modeline Date: Thu, 27 Jan 2022 15:21:55 +0100 Message-Id: <20220127142202.236638-2-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Victor Toso Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643295127318100001 From: Victor Toso Similar to f7160f3218 "schemas: Add vim modeline" Signed-off-by: Victor Toso Message-Id: <20211220145624.52801-1-victortoso@redhat.com> Acked-by: Markus Armbruster Signed-off-by: Markus Armbruster --- qapi/audio.json | 1 + qapi/compat.json | 1 + qapi/replay.json | 1 + qapi/trace.json | 1 + 4 files changed, 4 insertions(+) diff --git a/qapi/audio.json b/qapi/audio.json index 693e327c6b..0785e70a50 100644 --- a/qapi/audio.json +++ b/qapi/audio.json @@ -1,4 +1,5 @@ # -*- mode: python -*- +# vim: filetype=3Dpython # # Copyright (C) 2015-2019 Zolt=C3=A1n K=C5=91v=C3=A1g=C3=B3 # diff --git a/qapi/compat.json b/qapi/compat.json index dd7261ae2a..c53b69fe3f 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -1,4 +1,5 @@ # -*- Mode: Python -*- +# vim: filetype=3Dpython =20 ## # =3D Compatibility policy diff --git a/qapi/replay.json b/qapi/replay.json index bfd83d7591..b4d1ba253b 100644 --- a/qapi/replay.json +++ b/qapi/replay.json @@ -1,4 +1,5 @@ # -*- Mode: Python -*- +# vim: filetype=3Dpython # =20 ## diff --git a/qapi/trace.json b/qapi/trace.json index eedfded512..119509f565 100644 --- a/qapi/trace.json +++ b/qapi/trace.json @@ -1,4 +1,5 @@ # -*- mode: python -*- +# vim: filetype=3Dpython # # Copyright (C) 2011-2016 Llu=C3=ADs Vilanova # --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643293616; cv=none; d=zohomail.com; s=zohoarc; b=IKVlEWZwai9lUa6EJ/Uv+OKGT5O/FZPcAsQbW/kTE8LHzbUelm0hbRAOiaPjU2UU04UsKtBa13n9ARG0qgfgWXlP/qX8Ddyw9Yq/hQyYnODVG+1JvfoKAL85D956CWIWqDgFOH2JXb+AYrC645PRyxiwGQ3JT/uLsLur3W+oQzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643293616; 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=EBVfk5Drnxa5r7L1W8s+nyKN/rrmSrs6fEweCFh6oSQ=; b=VTtb1sB+MNEDCjJ1BVrujVS7MsNsCBlb8QoHZAZ5iLFfNa2dxoALGfP7O/oS7lWqnJMYEW8kZy8faSTKh4avm3LA9PHQtngLgodw0rpt/Lu6Be2XJ3osesYfRMomKK2f/+ZnL1PYMpifjNEaewSd9bSMrEZHrWC2ssBGaafz1hE= 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 1643293616211754.8100587044668; Thu, 27 Jan 2022 06:26:56 -0800 (PST) Received: from localhost ([::1]:51922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD5jj-0001eg-5o for importer@patchew.org; Thu, 27 Jan 2022 09:26:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f6-00071D-Sv for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36061) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f4-0003Nh-MH for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:08 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-zr-eHCxwM8GkZ_SSviXgIQ-1; Thu, 27 Jan 2022 09:22:05 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C71A8144E3; Thu, 27 Jan 2022 14:22:04 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED30B8049B; Thu, 27 Jan 2022 14:22:03 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A0AE91138220; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EBVfk5Drnxa5r7L1W8s+nyKN/rrmSrs6fEweCFh6oSQ=; b=Nvp1dNo7VfIrSm9oibdgD/IICBUGtZhwC0eyfapzHI/No6X+mWbN+h9bCaqb0s6IUWIYBG 90Rj7YmMy7/OHoNaz9ERH3NBsHh8AGLBf9a9VOIvGMm3BhpyigEnds9Bc9X2bAz0rAa13V cLf53LFfTtkppiKw5R6SAQRj3qKZoWI= X-MC-Unique: zr-eHCxwM8GkZ_SSviXgIQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 2/8] qapi/gen: Add FOO.trace-events output module Date: Thu, 27 Jan 2022 15:21:56 +0100 Message-Id: <20220127142202.236638-3-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643293617974100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-2-vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- 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) =20 =20 +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[N= one]: """ @@ -244,15 +249,18 @@ def __init__(self, what: str, user_blurb: str, builtin_blurb: Optional[str], - pydoc: str): + pydoc: str, + gen_tracing: bool =3D False): self._prefix =3D prefix self._what =3D what self._user_blurb =3D user_blurb self._builtin_blurb =3D builtin_blurb self._pydoc =3D pydoc self._current_module: Optional[str] =3D None - self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH]] =3D {} + self._module: Dict[str, Tuple[QAPIGenC, QAPIGenH, + Optional[QAPIGenTrace]]] =3D {} self._main_module: Optional[str] =3D None + self._gen_tracing =3D gen_tracing =20 @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] =20 + @property + def _gen_trace_events(self) -> QAPIGenTrace: + assert self._gen_tracing + assert self._current_module is not None + gent =3D 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 =3D self._module_filename(self._what, name) genc =3D QAPIGenC(basename + '.c', blurb, self._pydoc) genh =3D QAPIGenH(basename + '.h', blurb, self._pydoc) - self._module[name] =3D (genc, genh) + + gent: Optional[QAPIGenTrace] =3D None + if self._gen_tracing: + gent =3D QAPIGenTrace(basename + '.trace-events') + + self._module[name] =3D (genc, genh, gent) self._current_module =3D name =20 @contextmanager @@ -304,11 +325,13 @@ def _temp_module(self, name: str) -> Iterator[None]: self._current_module =3D old_module =20 def write(self, output_dir: str, opt_builtins: bool =3D 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_builti= ns: continue genc.write(output_dir) genh.write(output_dir) + if gent is not None: + gent.write(output_dir) =20 def _begin_builtin_module(self) -> None: pass --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643294389; cv=none; d=zohomail.com; s=zohoarc; b=m5uOLlKLTZxe4lORZwUyGod+S7qQaitAlR4MwAG8rigiOKrHmIAelaTjeierj7WHY7CyAnXRcp2UIkb/L+HYZCnPA1de9XhSpWbfgnM80IP3cV+5AFfcOC9aPMPEA4taBnGqqvs/SMpwB6peWTrHzS904VnTbyVg40ddn95nARw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643294389; 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=Zld+Z14lPntaDcU318MSf9lAeevfMx47AxegRJNf6jE=; b=SAGXKyxIb86jFaBHbFmfXiSQT9gdQnFEo3XV0uWLz9O27r9OH2NfqRW8PoZiAE7fcrFZ6fX4F8acvmk4HRTr+rKEUGtjZmYa6r8pMNlNSgxhfM8joJ4U6ltCFaJSrtiMsnpfgsUvQxNDxMrV0vCrV2YA4jiy+Fl/Qtg7GuOWSok= 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 1643294389947869.442728212917; Thu, 27 Jan 2022 06:39:49 -0800 (PST) Received: from localhost ([::1]:48548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD5wD-000242-48 for importer@patchew.org; Thu, 27 Jan 2022 09:39:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fQ-0007oF-KW for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fP-0003Pe-1v for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:28 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-338-Ud-e2O68P6WTMwZwKft6Dw-1; Thu, 27 Jan 2022 09:22:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 426E7101F000; Thu, 27 Jan 2022 14:22:19 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE65770D3D; Thu, 27 Jan 2022 14:22:03 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A3F601138221; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zld+Z14lPntaDcU318MSf9lAeevfMx47AxegRJNf6jE=; b=XHtA4WNzUS19mKbjv2xcE8vIKKGykGlTQV11UwwclVqIErxDBaSwpdW/C3Lge0k8G9+4OK NVrBIEQuGqH4sLQ3ty9tWByQeajKhH4cFkig3/Wloqvj0oBiJ4u6KgL+f6MTC4AeHu9bpJ zLLpY6P59Z91r87G8PpujUT67FfLI6I= X-MC-Unique: Ud-e2O68P6WTMwZwKft6Dw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 3/8] qapi/commands: refactor error handling code Date: Thu, 27 Jan 2022 15:21:57 +0100 Message-Id: <20220127142202.236638-4-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643294392335100005 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-3-vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- 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:: } =20 retval =3D qmp_my_command(arg.arg1, &err); - error_propagate(errp, err); if (err) { + error_propagate(errp, err); goto out; } =20 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 =3D mcgen(''' =20 %(lhs)sqmp_%(c_name)s(%(args)s&err); - error_propagate(errp, err); ''', c_name=3Dc_name(name), args=3Dargstr, lhs=3Dlhs) - if ret_type: - ret +=3D mcgen(''' + + ret +=3D mcgen(''' if (err) { + error_propagate(errp, err); goto out; } +''') + + if ret_type: + ret +=3D mcgen(''' =20 qmp_marshal_output_%(c_name)s(retval, ret, errp); ''', --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643294156; cv=none; d=zohomail.com; s=zohoarc; b=NqA4JggFKnL2N6UaID4Qg2GaftbHw8mt/oL+zddUAyfLYiBDqewJfsPFkIn3rP4SdX/APlobTB6IAqsJSPuIB1V5kA6UEuJRz7KVtnnJkoM4qPAUytf9JsLrhZms91qXWGINOGJ3tYJZQwO9KJkw1mHPG24Oi9ZMJGVkOhX/Q/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643294156; 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=YsJT5MTHf2Cezs4F6cTQHCH9i3TE+9e/7vwcK3wos4g=; b=Hul/oW0ZDek1KzMFbSEDYKDodzzQ8nIfYGw8R/B/Sh8QYLne35E9rrOuX797m9rDwbXBeDiMbBFimw/FctHSpCFD5ur6ylTQBwLNpSVHrSI1u/AyQTVa2YYP/LDXRXZ1h5A/CH8cCyzu/IQF0syW3PyNOPr5v20BjSwAC5kIzCA= 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 1643294156893349.8559607231583; Thu, 27 Jan 2022 06:35:56 -0800 (PST) Received: from localhost ([::1]:39188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD5sS-0003sQ-1r for importer@patchew.org; Thu, 27 Jan 2022 09:35:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f6-00071E-Sz for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f4-0003Nn-Vu for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:08 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-sSHKR_iHP52upZ-kjiWV-A-1; Thu, 27 Jan 2022 09:22:05 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 522D31091DA4; Thu, 27 Jan 2022 14:22:04 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED23C7D735; Thu, 27 Jan 2022 14:22:03 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A780B1138222; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YsJT5MTHf2Cezs4F6cTQHCH9i3TE+9e/7vwcK3wos4g=; b=evXsqmORNj/NDdCdm3dgrKFVQXlxxLPEtdfnbg0KhCJw/JJQriS9KQdMeF369dv6MuzNRB u7wD8fGTSwCsvgRkfL/2Xw1xqfFe4PVu/5ZVYrP6/shb7CEir3O9zVn9K67Kh76aW8/hgG TEavkthrLj3x6ytuJMD8wJNeZqpkCv0= X-MC-Unique: sSHKR_iHP52upZ-kjiWV-A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 4/8] qapi/commands: Optionally generate trace for QMP commands Date: Thu, 27 Jan 2022 15:21:58 +0100 Message-Id: <20220127142202.236638-5-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643294159389100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-4-vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster [Superfluous #include dropped] Signed-off-by: Markus Armbruster --- scripts/qapi/commands.py | 90 +++++++++++++++++++++++++++++++++++----- scripts/qapi/main.py | 14 +++++-- 2 files changed, 90 insertions(+), 14 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 17e5ed2414..869d799ed2 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 =3D '' =20 argstr =3D '' @@ -71,14 +72,37 @@ def gen_call(name: str, if ret_type: lhs =3D 'retval =3D ' =20 - ret =3D mcgen(''' + name =3D c_name(name) + upper =3D name.upper() =20 - %(lhs)sqmp_%(c_name)s(%(args)s&err); + if gen_tracing: + ret +=3D mcgen(''' + + if (trace_event_get_state_backends(TRACE_QMP_ENTER_%(upper)s)) { + g_autoptr(GString) req_json =3D qobject_to_json(QOBJECT(args)); + + trace_qmp_enter_%(name)s(req_json->str); + } + ''', + upper=3Dupper, name=3Dname) + + ret +=3D mcgen(''' + + %(lhs)sqmp_%(name)s(%(args)s&err); ''', - c_name=3Dc_name(name), args=3Dargstr, lhs=3Dlhs) + name=3Dname, args=3Dargstr, lhs=3Dlhs) =20 ret +=3D mcgen(''' if (err) { +''') + + if gen_tracing: + ret +=3D mcgen(''' + trace_qmp_exit_%(name)s(error_get_pretty(err), false); +''', + name=3Dname) + + ret +=3D 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=3Dret_type.c_name()) + + if gen_tracing: + if ret_type: + ret +=3D mcgen(''' + + if (trace_event_get_state_backends(TRACE_QMP_EXIT_%(upper)s)) { + g_autoptr(GString) ret_json =3D qobject_to_json(*ret); + + trace_qmp_exit_%(name)s(ret_json->str, true); + } + ''', + upper=3Dupper, name=3Dname) + else: + ret +=3D mcgen(''' + + trace_qmp_exit_%(name)s("{}", true); + ''', + name=3Dname) + return ret =20 =20 @@ -126,10 +169,19 @@ def gen_marshal_decl(name: str) -> str: proto=3Dbuild_marshal_proto(name)) =20 =20 +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=3Dc_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 =3D 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, } ''') =20 - ret +=3D gen_call(name, arg_type, boxed, ret_type) + ret +=3D gen_call(name, arg_type, boxed, ret_type, gen_tracing) =20 ret +=3D mcgen(''' =20 @@ -242,11 +294,13 @@ def gen_register_command(name: str, =20 =20 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=3Dgen_tracing) self._visited_ret_types: Dict[QAPIGenC, Set[QAPISchemaType]] =3D {} + self._gen_tracing =3D gen_tracing =20 def _begin_user_module(self, name: str) -> None: self._visited_ret_types[self._genc] =3D set() @@ -265,6 +319,16 @@ def _begin_user_module(self, name: str) -> None: =20 ''', commands=3Dcommands, visit=3Dvisit)) + + if self._gen_tracing and commands !=3D 'qapi-commands': + self._genc.add(mcgen(''' +#include "qapi/qmp/qjson.h" +#include "trace/trace-%(nm)s_trace_events.h" +''', + nm=3Dc_name(commands, protect=3DFalse))) + # We use c_name(commands, protect=3DFalse) to turn '-' into '_= ', to + # match .underscorify() in trace/meson.build + self._genh.add(mcgen(''' #include "%(types)s.h" =20 @@ -326,7 +390,10 @@ def visit_command(self, with ifcontext(ifcond, self._genh, self._genc): self._genh.add(gen_command_decl(name, arg_type, boxed, ret_typ= e)) 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 +403,8 @@ def visit_command(self, =20 def gen_commands(schema: QAPISchema, output_dir: str, - prefix: str) -> None: - vis =3D QAPISchemaGenCommandVisitor(prefix) + prefix: str, + gen_tracing: bool) -> None: + vis =3D 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 =3D False, - builtins: bool =3D False) -> None: + builtins: bool =3D False, + gen_tracing: bool =3D False) -> None: """ Generate C code for the given schema into the target directory. =20 @@ -49,7 +50,7 @@ def generate(schema_file: str, schema =3D 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) =20 @@ -74,6 +75,12 @@ def main() -> int: parser.add_argument('-u', '--unmask-non-abi-names', action=3D'store_tr= ue', dest=3D'unmask', help=3D"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=3D'store_true', + help=3D"add trace events to qmp marshals") + parser.add_argument('schema', action=3D'store') args =3D parser.parse_args() =20 @@ -88,7 +95,8 @@ def main() -> int: output_dir=3Dargs.output_dir, prefix=3Dargs.prefix, unmask=3Dargs.unmask, - builtins=3Dargs.builtins) + builtins=3Dargs.builtins, + gen_tracing=3Dargs.gen_trace) except QAPIError as err: print(f"{sys.argv[0]}: {str(err)}", file=3Dsys.stderr) return 1 --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1643294371695959.4978907214328; Thu, 27 Jan 2022 06:39:31 -0800 (PST) Received: from localhost ([::1]:47258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD5vu-0001BY-LF for importer@patchew.org; Thu, 27 Jan 2022 09:39:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fB-00073j-C6 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f9-0003OI-Cv for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:13 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-413-2XLV2QfKNmmts89tU8HZ-A-1; Thu, 27 Jan 2022 09:22:06 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99C731091DA0; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68F877D735; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AB7791138223; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2lbnBSx6s7PyjoEIgmQc6Kb11SK0yBEdluoczg4PChE=; b=Z+lsebYbHwgH3ub1TW/Gf8/sF8YJOWM2SmXxqIXFDl9wyPsUfUegGGQS9tWPcZ0eNnzp14 PWdJl0JyiUWI2sPlsy/ZGV2HDwz6BmvWeIpuENEIUEjs5PRPrQCYQt9TDkJXzqNDZ6KUgC xe4x9wddpQNLkedFTIosfyR0EvrspSg= X-MC-Unique: 2XLV2QfKNmmts89tU8HZ-A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 5/8] meson: generate trace events for qmp commands Date: Thu, 27 Jan 2022 15:21:59 +0100 Message-Id: <20220127142202.236638-6-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643294374154100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-5-vsementsov@virtuozzo.com> Signed-off-by: Markus Armbruster --- 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 =3D get_option('datadir') / 'icons' =20 config_host_data =3D configuration_data() genh =3D [] +qapi_trace_events =3D [] =20 target_dirs =3D config_host['TARGET_DIRS'].split() have_linux_user =3D false @@ -2557,6 +2558,8 @@ if 'CONFIG_VHOST_USER' in config_host vhost_user =3D libvhost_user.get_variable('vhost_user_dep') endif =20 +# 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 =3D custom_target('shared QAPI source files', output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outpu= ts, 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 ]) =20 # 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 +=3D qapi_files[i] endif + if output.endswith('.trace-events') + qapi_trace_events +=3D qapi_files[i] + endif util_ss.add(qapi_files[i]) i =3D i + 1 endforeach @@ -145,6 +149,9 @@ foreach output : qapi_specific_outputs + qapi_nonmodule= _outputs if output.endswith('.h') genh +=3D qapi_files[i] endif + if output.endswith('.trace-events') + qapi_trace_events +=3D qapi_files[i] + endif specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: qapi_files[i]) i =3D 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')) =20 trace_events_files =3D [] -foreach dir : [ '.' ] + trace_events_subdirs - trace_events_file =3D meson.project_source_root() / dir / 'trace-events' +foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events + if item in qapi_trace_events + trace_events_file =3D item + group_name =3D item.full_path().split('/')[-1].underscorify() + else + trace_events_file =3D meson.project_source_root() / item / 'trace-even= ts' + group_name =3D item =3D=3D '.' ? 'root' : item.underscorify() + endif trace_events_files +=3D [ trace_events_file ] - group_name =3D dir =3D=3D '.' ? 'root' : dir.underscorify() group =3D '--group=3D' + group_name fmt =3D '@0@-' + group_name + '.@1@' =20 --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643295421; cv=none; d=zohomail.com; s=zohoarc; b=EeKWxgh+nON+TuE0vqTvCemEXx1FnVrn6Az2AVoEXxC6aQ9geHsWRj+quCTK6tusVpAF7ekFpTxh4/ScyytYPdd12Sc96oe5vCpeG6ExNnSHC3fVzmA95G1qFbdxEuUvN0KGf3dvQqKlsBpWrLMBwOVT7jmsDXAujghajsubB6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643295421; 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=hAE4/uxm5nEiNKnBfQnCpAQ9p9jfXH/3iDAiVZ2ztPk=; b=YldHNNQ0Yx89r6NCIeI2OX+F5WLHJfSY88GYszKPhHu58zX9EWsGTMznAiHqKQAu1fFv1aush/5rMEALHgKDf/Jdb5IjeHqZn/8V5t9L6GbYy8YObNIvVQZSFw82DmFBvYJTZ6DQBFFG7yjaLLJxsHaNDlUx9NeGg8gGzRXno6g= 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 1643295421035593.9810268806589; Thu, 27 Jan 2022 06:57:01 -0800 (PST) Received: from localhost ([::1]:48168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD6Cp-00067R-Ub for importer@patchew.org; Thu, 27 Jan 2022 09:56:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fL-0007ep-Rh for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46225) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fK-0003PJ-3Z for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:23 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-79-kc185jK3NCmdk23G5ENNfA-1; Thu, 27 Jan 2022 09:22:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4221A15720; Thu, 27 Jan 2022 14:22:19 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68ABE70D43; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AEB2D1138224; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hAE4/uxm5nEiNKnBfQnCpAQ9p9jfXH/3iDAiVZ2ztPk=; b=aGuqM5+T7xfvnkzqkjsjC07bzwfjLbs5SHTGwJA9hxtsvF/O1JnypyByrDdJvGBmmOYpOG wjzCAD0w9Cb9QJufEtw0+E7ISf7t5MrcnXScykHcnDDih5Bw/ROqW9KUDCmS0NaSYTu47D 60Wy/pW8psJ+bUu0tq17aNRJEdjVANc= X-MC-Unique: kc185jK3NCmdk23G5ENNfA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 6/8] docs/qapi-code-gen: update to cover trace events code generation Date: Thu, 27 Jan 2022 15:22:00 +0100 Message-Id: <20220127142202.236638-7-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643295422906100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-6-vsementsov@virtuozzo.com> Reviewed-by: Stefan Hajnoczi Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- docs/devel/qapi-code-gen.rst | 23 +++++++++++++++++++++++ docs/devel/tracing.rst | 2 ++ 2 files changed, 25 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 =20 + ``$(prefix)qapi-commands.trace-events`` + Trace event declarations, see :ref:`tracing`. + ``$(prefix)qapi-init-commands.h`` Command initialization prototype =20 @@ -1650,6 +1653,13 @@ Example:: void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp); =20 #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...] =20 @@ -1689,14 +1699,27 @@ Example:: goto out; } =20 + if (trace_event_get_state_backends(TRACE_QMP_ENTER_MY_COMMAND)) { + g_autoptr(GString) req_json =3D qobject_to_json(QOBJECT(args)); + + trace_qmp_enter_my_command(req_json->str); + } + retval =3D qmp_my_command(arg.arg1, &err); if (err) { + trace_qmp_exit_my_command(error_get_pretty(err), false); error_propagate(errp, err); goto out; } =20 qmp_marshal_output_UserDefOne(retval, ret, errp); =20 + if (trace_event_get_state_backends(TRACE_QMP_EXIT_MY_COMMAND)) { + g_autoptr(GString) ret_json =3D qobject_to_json(*ret); + + trace_qmp_exit_my_command(ret_json->str, true); + } + out: visit_free(v); v =3D qapi_dealloc_visitor_new(); diff --git a/docs/devel/tracing.rst b/docs/devel/tracing.rst index ba83954899..4290ac42ee 100644 --- a/docs/devel/tracing.rst +++ b/docs/devel/tracing.rst @@ -1,3 +1,5 @@ +.. _tracing: + =3D=3D=3D=3D=3D=3D=3D Tracing =3D=3D=3D=3D=3D=3D=3D --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643293616; cv=none; d=zohomail.com; s=zohoarc; b=XZcDXl+c7kIly20ca6PYUL/ICSUpGbHOMCe1ALLStyXdEvAt87zA2uZcxN69L0iujCC4pY2lS1aWw559rzHhE5PyO/dxTfyWZCJ7SouJ+AqCWHSEovbK6LutxsEIgcB1wqTrv6Ho9YS3TPvqN9MXLWzTswEeuIrqmCHCXYIGlXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643293616; 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=RWHYDG+AYSTXXnvdt63cGlbBLmMtorvMEgBAXFzb4G4=; b=LAVf8E2xcd0yi6sLqkA+JAoyqmd26+WhxfDVQuVn9giz5i5NQbZY0kzyTid9GOt2CVIsvNueHbT8kT8IIqvNlfy0nHTxlMJcllTV0G14EaMDfDjDk0jr6/kjoCO1KMF31vQfGCrsMvaSy5xoo/ILqQF9Sw6uslcZ4jzeudGMm4c= 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 1643293616891998.8471434305374; Thu, 27 Jan 2022 06:26:56 -0800 (PST) Received: from localhost ([::1]:52042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD5jk-0001kX-3A for importer@patchew.org; Thu, 27 Jan 2022 09:26:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f9-00072I-Qh for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f8-0003O6-7Q for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-Bq4u9OmbNK6uC6tWNaeppw-1; Thu, 27 Jan 2022 09:22:06 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E6F98144E4; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6CB3D81F72; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B218C11380A9; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RWHYDG+AYSTXXnvdt63cGlbBLmMtorvMEgBAXFzb4G4=; b=JN0HzW7Ds5QOiwRHn8/hf/uCzMyaQkk56MMAsBGUgwOJmeOxQxMq/PG2R/VyNDk49KKwCR kEuGXO8uIByvp+MZuTIqPl0LjQswHX/Bj4thPbaJjfgALJH3Ak1c/t6E0na7HOj4uojVkK q8QoY+0wDlpraOGouxWI+eFU1QwuABw= X-MC-Unique: Bq4u9OmbNK6uC6tWNaeppw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 7/8] meson: document why we don't generate trace events for tests/ and qga/ Date: Thu, 27 Jan 2022 15:22:01 +0100 Message-Id: <20220127142202.236638-8-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643293619835100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-7-vsementsov@virtuozzo.com> Reviewed-by: Stefan Hajnoczi Reviewed-by: Markus Armbruster [Pasto fixed, commit message punctuation tidied up] Signed-off-by: Markus Armbruster --- 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 =3D [ 'qga-qapi-visit.h', ] =20 +# 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 =3D 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..c8ab6272d1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -31,6 +31,13 @@ test_qapi_outputs =3D [ 'test-qapi-visit.h', ] =20 +# 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('tests') 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 =3D custom_target('Test QAPI files', output: test_qapi_outputs, input: files('qapi-schema/qapi-schema-test= .json', --=20 2.31.1 From nobody Fri May 3 07:34:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643293908; cv=none; d=zohomail.com; s=zohoarc; b=E1HVlrtIDplO+uoo7/71dlmyPdqoJEG49Bc7nsJfwTmCnd5Z18wlj2yn3jykE4QVLfJMcMLBdpM9papiFwwfbJGQLKw13ZOM7XD3pXeoli9ezZNLWCfHn9Y2i4kDIvMeWqzBE15wy70xYB5neOS6jOLRJdlA28hJ7zz/okIE8DU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643293908; 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=hc7P+KISRThSIHMrqupvteMA+A9ZU/+oAwFyGejzFEU=; b=EEzJWqQcPZX8IYYHk3ejwCSxEwZ5Q9UeifkCcK/H8RwEEoDN4SAM0RHtuH7+uCs1+kTlH2ilYVL8pcrVItSEKAE6T/440HDD8fbBQLgPMsw6Oq/gBx4xL0t+3CMPOrFY+tl6LQ0YH+cNva8CN6K+/kBEQ9gzoWzhCUFzc+QxTBk= 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 1643293908436463.4701647145191; Thu, 27 Jan 2022 06:31:48 -0800 (PST) Received: from localhost ([::1]:60770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD5oR-0007dO-Kh for importer@patchew.org; Thu, 27 Jan 2022 09:31:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5fA-00072O-N4 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37886) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD5f9-0003OA-1G for qemu-devel@nongnu.org; Thu, 27 Jan 2022 09:22:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-395-zkMDLiEGPLO5WKR38yOTLQ-1; Thu, 27 Jan 2022 09:22:06 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C8EEF101F004; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 728FF8049B; Thu, 27 Jan 2022 14:22:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B567B11380AB; Thu, 27 Jan 2022 15:22:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643293330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hc7P+KISRThSIHMrqupvteMA+A9ZU/+oAwFyGejzFEU=; b=Fyr5gZN7APrU7747HHIxfWBtqn3PAcBtg14Osg5FFpmiZrjWACQVYjr3ei+67JOwJOBC/A rO4qZOMyIASwxa39nVTnUnu72rZdstp05fHyWJjyYsuyLe3G1z52GM7LqlvKN045hNXs5O IogU0+CBUmPBuY5tTyUvYeuS97M8j9k= X-MC-Unique: zkMDLiEGPLO5WKR38yOTLQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 8/8] qapi: generate trace events by default Date: Thu, 27 Jan 2022 15:22:02 +0100 Message-Id: <20220127142202.236638-9-armbru@redhat.com> In-Reply-To: <20220127142202.236638-1-armbru@redhat.com> References: <20220127142202.236638-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1643293911199100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy 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 Message-Id: <20220126161130.3240892-8-vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- 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 =3D custom_target('shared QAPI source files', output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outpu= ts, 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 ]) =20 # 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 =3D [ qga_qapi_files =3D custom_target('QGA QAPI files', output: qga_qapi_outputs, input: 'qapi-schema.json', - command: [ qapi_gen, '-o', 'qga', '-p', 'qg= a-', '@INPUT0@' ], + command: [ qapi_gen, '-o', 'qga', '-p', 'qg= a-', '@INPUT0@', + '--suppress-tracing' ], depend_files: qapi_gen_depends) =20 qga_ss =3D 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=3D'unmask', help=3D"expose non-ABI names in introspection") =20 - # 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=3D'store_true', - help=3D"add trace events to qmp marshals") + parser.add_argument('--suppress-tracing', action=3D'store_true', + help=3D"suppress adding trace events to qmp marsha= ls") =20 parser.add_argument('schema', action=3D'store') args =3D parser.parse_args() @@ -96,7 +96,7 @@ def main() -> int: prefix=3Dargs.prefix, unmask=3Dargs.unmask, builtins=3Dargs.builtins, - gen_tracing=3Dargs.gen_trace) + gen_tracing=3Dnot args.suppress_tracing) except QAPIError as err: print(f"{sys.argv[0]}: {str(err)}", file=3Dsys.stderr) return 1 diff --git a/tests/meson.build b/tests/meson.build index c8ab6272d1..94a425d94a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -44,7 +44,8 @@ test_qapi_files =3D custom_target('Test QAPI files', 'qapi-schema/include/sub-modu= le.json', 'qapi-schema/sub-sub-module.j= son'), command: [ qapi_gen, '-o', meson.current_b= uild_dir(), - '-b', '-p', 'test-', '@INPUT0@'= ], + '-b', '-p', 'test-', '@INPUT0@', + '--suppress-tracing' ], depend_files: qapi_gen_depends) =20 # meson doesn't like generated output in other directories --=20 2.31.1