From nobody Fri May 3 06:03:26 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=1643284685; cv=none; d=zohomail.com; s=zohoarc; b=iMO2mbEMt4+7C4wcBkR6zVqHols1aAGJCgyXV4TzIsCIKmh295juzBmV6ZDPIle0CqMMpLe10FriY8SJ0iUsYbWLAoOy5/11nvjwbGS+x6yFkdkQ423pwN7QFuyMn1NHaHKA9gN3OVbAg/aXX8p6w2e4+xHASrOsf2dNIcEmQEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643284685; 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=KOPPVNf+wUgQYP1C0yMt/SRy4ZLgAm9v516K1Vnz6fAhvghRWuo7SrDZhUav93/x7V7/moTERefiYaZmtIKaywWZ30gxk79Qy2lgsTauyhVrzf5tk6eBn1tp8QRwwGOejOq7qZWUkKp1ER/wK7keRL1e/gwAts2arkASsWILaUM= 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 1643284685501356.18319195850347; Thu, 27 Jan 2022 03:58:05 -0800 (PST) Received: from localhost ([::1]:45342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3Pg-00080Z-DH for importer@patchew.org; Thu, 27 Jan 2022 06:58:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xj-0005dX-3m for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xg-0000NO-V4 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:10 -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-620-DWPVtN8NPsGWuAPzW_E7fQ-1; Thu, 27 Jan 2022 06:29:05 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28B7464092; Thu, 27 Jan 2022 11:29: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 D041C75535; Thu, 27 Jan 2022 11:29:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5FA3E11384A5; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282948; 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=g5P7ezzptBTl9ZQ0TspHDafeYEQ7KqGbZrefQNVwgQll8dtlNXM7IxhjNun5GZfeSX1G1Y NavmriAHRtHl+TgOEI0jen5DrqV+l2S8ybXCHYbvjYdh7kOk4oTwLuot1No1lRMq/flRiD iGJowL/KAgMuKEdvjmWIoErX7b+Zpwc= X-MC-Unique: DWPVtN8NPsGWuAPzW_E7fQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 1/8] schemas: add missing vim modeline Date: Thu, 27 Jan 2022 12:28:52 +0100 Message-Id: <20220127112859.222484-2-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1643284687648100003 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 06:03:26 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=1643284522; cv=none; d=zohomail.com; s=zohoarc; b=d0E29PjyOBpD3YRBGYXak72F+fHiEnl0aX6VFFsvXhmB5+ByvlsajR3/oq3DOTONx+7h91hvQqJThTmBloEDdTYa2fz5ad3Rs5LCatECMh6G8YEVk8Iu9WgHLWXyjWnVEf5wLHiLL5WnwsW0qRCfv89E2sMP1WyYyO4kBlNNSeM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643284522; 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=KtA2JLPpoLNUIYTxO9oc+mzWLTkS0OtQtRODjgMmum8LIj25Qul6h4EvOmznOG3MOKM0dTeaXWORQ6tX8z+bMesZ2MkwohzDiPU7GMSsZisfDAcRFjvFqt4YFAl7LNL7b3uuje1xoPrhvXGUTBOsZg9eaa0LWn2W1FlxeERfUCY= 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 1643284522255381.51027219145385; Thu, 27 Jan 2022 03:55:22 -0800 (PST) Received: from localhost ([::1]:41960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3N3-0005gv-By for importer@patchew.org; Thu, 27 Jan 2022 06:55:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xv-0005ql-FD for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xr-0000Oy-Sl for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:21 -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-668-JZByR8pkOUG8-OiBMls8DQ-1; Thu, 27 Jan 2022 06:29:17 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ECA88196E6C0; Thu, 27 Jan 2022 11:29:16 +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 D06E36C1AC; Thu, 27 Jan 2022 11:29:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6312B1138220; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282959; 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=ggRJkROqdX5MdO/uaAuOJ/PxQvUpxudI+9SvVZAEx6srIwHe6QwNw7Vz2mQFggeYaOZg4n wVlic/oaaytigYRx+td7xSFxb8EV2TEtkKRGeX5+QUOmmVpeafsWoe7MiN5j3sxJNnvn0M 9tmsqoQ0tI3TluBQOv9+KBpkInjV6f0= X-MC-Unique: JZByR8pkOUG8-OiBMls8DQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 2/8] qapi/gen: Add FOO.trace-events output module Date: Thu, 27 Jan 2022 12:28:53 +0100 Message-Id: <20220127112859.222484-3-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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: 1643284525501100001 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 06:03:26 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=1643285424; cv=none; d=zohomail.com; s=zohoarc; b=jiKq4wtHaM0Q/92F5bRjufPpvwzPuOr0xGk8HBAh/WyU0OfzkdMcrosiwsOlCYVna/dkOr6jXS3nStq3O+gptTKlASl1aeM7+5NucvAjAAPHQLilxf5ZxyVGAH5Qtq4EZUMuLi28j4dC4Fb20Oi/ngsUnIYcsb5QfkCyTiXfsiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643285424; 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=mzcRe5LtHD/UzkuDSklSeoO7ob7bB3Rj1Ks9mesYZ8vj1fwaEmQSe99SLIa1BvZo+oNwh36cSCQbOM2HJ1Qw49082ufaaHF0MR5uBEeDZVIR1DfFn6AIgFSMWscCAX/FmfzgxpQleNrATL/3l2zuSxdAncUpb5TpXzLSaEm0VbA= 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 1643285424418984.224962855981; Thu, 27 Jan 2022 04:10:24 -0800 (PST) Received: from localhost ([::1]:34142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3ba-0003GX-JT for importer@patchew.org; Thu, 27 Jan 2022 07:10:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xk-0005eC-Uv for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xi-0000Nh-ND for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29: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-183-TkyVzbioPE6knNspAHUnkQ-1; Thu, 27 Jan 2022 06:29:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B26A3196E6C4; Thu, 27 Jan 2022 11:29: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 D0804167A8; Thu, 27 Jan 2022 11:29:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 66B5D1138221; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282950; 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=T6me36FDJTMezps9YYJJCiLhBAptxh1gY9XZ6HK0zpA+jb/bTorGwrpTOafewyPH2QfSnN 0KlSmi2rk1M55ABfBWh1FcrUNgrmwnt1dUeWyB+aAtR6oH3C5EFGTSx3dvomvCOZDBZQxE 0KcRAiHeKB7NzGUn/wqAEn2+ecI+iv4= X-MC-Unique: TkyVzbioPE6knNspAHUnkQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 3/8] qapi/commands: refactor error handling code Date: Thu, 27 Jan 2022 12:28:54 +0100 Message-Id: <20220127112859.222484-4-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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: 1643285427094100001 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 06:03:26 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=1643284019; cv=none; d=zohomail.com; s=zohoarc; b=foSa+jcnzGy1IVwu2PO/fP7Xdkp0OTU25WhNx/0ke/Opl0LlefGRnVIuHmWZmcVTDx/ba/waKmBgm0SEVeNaKEY0jZfLIF2VxK/k0w0KoPcsqNEslCej+p7Cl7zYRDEVma0VGqUO0UkfEknJNh8Lo90EoWN6MEu0LLWOj2ZOoO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643284019; 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=RgSB2DD/Ts8DrSY5eaizzzVCQNXAJJvQsGo/mZ/xS7Nvp5DiZ2mmUz0Hv+mZaaTsOUw8MGer++we57pWq8YI+5YpwYI2TKVDDr+0uf+ZcFXaFP/PyAtdyDYhdVfKaP3dqCMdtx/VZUUGUkLArx+fipmjbmGuW6SS8R+DXcgg3eM= 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 164328401906199.26981942476505; Thu, 27 Jan 2022 03:46:59 -0800 (PST) Received: from localhost ([::1]:56414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3Ew-0004HW-95 for importer@patchew.org; Thu, 27 Jan 2022 06:46:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xq-0005mb-R0 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xo-0000Oa-So for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29: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-620-1ob0fGwpNRSoF6b9Oz7G2g-1; Thu, 27 Jan 2022 06:29:05 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 502511091DA1; Thu, 27 Jan 2022 11:29: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 D062976108; Thu, 27 Jan 2022 11:29:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6A29F1138222; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282955; 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=aTTYLetWZTtkZaAHhFevj9g7X6h8vE7BbGdPs9YWa/VX6cVMu3F3kmLain/RKSgSHnKGT0 w8llUA2b3/yf7kyHLQZOb/RbaYL5Qcqgl2Q2fIB05iHcZSjmxwAHUDx95LB6rdo+rNCWiK 8Krv7Ppd1mpVHH2TQcFz8FlXEAvbOOk= X-MC-Unique: 1ob0fGwpNRSoF6b9Oz7G2g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 4/8] qapi/commands: Optionally generate trace for QMP commands Date: Thu, 27 Jan 2022 12:28:55 +0100 Message-Id: <20220127112859.222484-5-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1643284021507100001 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 06:03:26 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 1643284384024677.9774179339997; Thu, 27 Jan 2022 03:53:04 -0800 (PST) Received: from localhost ([::1]:36730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3Ko-0001yF-V0 for importer@patchew.org; Thu, 27 Jan 2022 06:53:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xh-0005Xu-8N for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xf-0000Mv-BM for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29: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-43-egX8rFd4McOFaRsJED-vmw-1; Thu, 27 Jan 2022 06:29:05 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28DE51091DA0; Thu, 27 Jan 2022 11:29: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 5413176110; Thu, 27 Jan 2022 11:29:02 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6FECC1138223; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282946; 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=JLwMWAYLXt2wx4WhEi1Bdu60QK5stStNEcN0vgtTAg67dXZpU437n9m5SzDz7TRi4iTplZ vfADVKvHMDDuu98msjr12DFoqv1S8ibnT6IZUzk2Us528oIUMZYNpD98mVpmxpGAzpHqAk f0Nfu/vXuNWR/wGagjhQTSEKP+xaTNw= X-MC-Unique: egX8rFd4McOFaRsJED-vmw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 5/8] meson: generate trace events for qmp commands Date: Thu, 27 Jan 2022 12:28:56 +0100 Message-Id: <20220127112859.222484-6-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1643284386351100001 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 06:03:26 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=1643284037; cv=none; d=zohomail.com; s=zohoarc; b=RNyeBwAE98ObVH9AYbQiJkgupXqQq/pmEytCOyRl7lkMBiNPQyrBGx7gDI+zoro1nXmTA62pwRM6D5yLT3GC0uy9kd9fPAES7XzMk2owUyNKoDtRJQYaHzsJqeyE7SWYNAFCEHpEurglIEUaYDHYFr0p3ZjLTlAhSr6zSGCLLOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643284037; 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=qxKlxViWpgSf9LtZ1s+dubIXFaVhaanbEAQg41cJ1yA=; b=FErdNwHY/J+DMNTTiBtThzf4l/MkzUK3qYFJXBkg453xN4+K572uItXiIiGXQu65uyI0Jj2zmFfTMiELvrfQUYxygd0qMcreEwFx0xyzRPyGQA+R09LaA9E8WRp18WhyZwesgOYtYOamW/pXahPHhDkou6SLIJogmQ7Rp/bVmoQ= 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 1643284037554881.4161051322756; Thu, 27 Jan 2022 03:47:17 -0800 (PST) Received: from localhost ([::1]:57412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3FC-0004zC-Gy for importer@patchew.org; Thu, 27 Jan 2022 06:47:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xp-0005jb-70 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xn-0000OV-DG for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:16 -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-455-CVXn3FKXPKywDxJBDyuD0g-1; Thu, 27 Jan 2022 06:29:13 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FACF1091DA4; Thu, 27 Jan 2022 11:29: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 539141059177; Thu, 27 Jan 2022 11:29:02 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 733271138224; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282954; 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=qxKlxViWpgSf9LtZ1s+dubIXFaVhaanbEAQg41cJ1yA=; b=L0HGcIACR/L5apGaurnxWGSfw59LolcWHsEWJVFL4Q2eEqtxpbhV7JE76hNbYbAIXOEz4A wXsuchoxVYtmOwEZfvzok7EpEHg5Ofzx4gCwz7wX9jPfkJ422H/CTm8TRN/NB8ujOI3pLe OkkA7yCG+8oAuiZfwci2yVBwLacRjg0= X-MC-Unique: CVXn3FKXPKywDxJBDyuD0g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 6/8] docs/qapi-code-gen: update to cover trace events code generation Date: Thu, 27 Jan 2022 12:28:57 +0100 Message-Id: <20220127112859.222484-7-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: 1643284038717100001 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 +++++++++++++++++++++++ 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 =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(); --=20 2.31.1 From nobody Fri May 3 06:03:26 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=1643284963; cv=none; d=zohomail.com; s=zohoarc; b=Jyg6wpHA8vtQCfBGQ5lxI5zVFpth6tl32DfzbsS5K9eLyrkerHlPuKkvfvdpn2ArzUDiOAE0WK5e5HSOfQRt5N0PhVG0+k2t8AMO3PHw+Ct8NspNekX04+bg9AynHs1J6ajpHbmVVHc4XVtuX8GPipD/mpkx+xtb7oM3p2uoXu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643284963; 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=Rcb4ShwC8/eaBR1MzS1OkKlUe7YaZ6spULxOJLn+oJTZ6vQsAO9G5I/INNlfQf4bVhbj4jyZIMs1JRk8Eh6crvWQ7/XWJhK0ZyFWTBxbRauM7JM0FeC3AlM5dW6T7RNvTfeAln8mdOHHW/Hw46ksuVvhyOWXOyJE2QwKWAQYI6U= 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 1643284963634951.7212316868525; Thu, 27 Jan 2022 04:02:43 -0800 (PST) Received: from localhost ([::1]:53824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3UA-0005PB-HG for importer@patchew.org; Thu, 27 Jan 2022 07:02:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xk-0005dy-9m for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xi-0000Nf-Fn for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29: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-30-sK5ghe3FOEqvicqnCrVZrQ-1; Thu, 27 Jan 2022 06:29:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5ACB8519E3; Thu, 27 Jan 2022 11:29: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 838C6110F9C; Thu, 27 Jan 2022 11:29:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7680F11380A9; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282949; 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=WkAvtBiOKG7QnPYQnSXYSZQkVI/dcfpTtoP4J/F95QSDPSZUHPZ8RyIzjtohHcPmcMd3Cs WcIm78KTIuXBKHwdbqmAmGddlT9wuMJOFRgQB5pc8AxW+seaajtW5NB5VueIq31GdK5aV7 r8/XNYYUrtwuHdxf1JxoOWZW6oCKxdg= X-MC-Unique: sK5ghe3FOEqvicqnCrVZrQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 7/8] meson: document why we don't generate trace events for tests/ and qga/ Date: Thu, 27 Jan 2022 12:28:58 +0100 Message-Id: <20220127112859.222484-8-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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: 1643284965514100001 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 06:03:26 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=1643284316; cv=none; d=zohomail.com; s=zohoarc; b=PrS79WXoeK/sACBPr62B7xsQ7t6E3EgyWXynZbk10LtRu81Qk0Ei914sjpuL8vQ/L0/X6KG2VJAb+TCtMc5PsNJZHJQA33sop2HpwReqR+dxPEF4/2YEK9tg4p72jJ3605YbpuG/lCqCbQzH/F0Lk4TRF79f5dR6Z0bISy99PM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643284316; 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=WrZTpN1IUVTN05j9qeD1YAPecUBuKXVHJOPDESxYwQbWVHwPEgAmQO5lodpF8g3Phw89gn5Z88e2Y0KXw7iQaJzCpddjVOiEmuon7XYJJTNoJNWhJ65+VLLy9pm+RFE74rmxbLXtwugP0orZM/ZxofJlA7XiSoZZa88H4Pcv6rA= 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 1643284316986433.4104782071803; Thu, 27 Jan 2022 03:51:56 -0800 (PST) Received: from localhost ([::1]:33234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD3Jj-0007qs-Of for importer@patchew.org; Thu, 27 Jan 2022 06:51:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xl-0005eI-76 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:23320) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD2xi-0000Np-Vj for qemu-devel@nongnu.org; Thu, 27 Jan 2022 06:29: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-183-YTFoOv2OM2OYKMyUxd3s9Q-1; Thu, 27 Jan 2022 06:29:07 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB89686A064; Thu, 27 Jan 2022 11:29: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 8340A752DE; Thu, 27 Jan 2022 11:29:05 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 79E1311380AB; Thu, 27 Jan 2022 12:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643282950; 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=X2YXYY0ZAkaPgq0AvHRlvIUcw17q0w5h5nHKMQriRqnefg4LWBgfYSHHQaHCWhLf7r7xbA R4EePc5e9t90VJghCOPq11Mr+K9vIfOOd5c9PdDvup1Nu7JbskNRAxoCZ/sdC/NXaGXkEb rJ8F0s59tMQrrNw9009r54GBFrJ4YRg= X-MC-Unique: YTFoOv2OM2OYKMyUxd3s9Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 8/8] qapi: generate trace events by default Date: Thu, 27 Jan 2022 12:28:59 +0100 Message-Id: <20220127112859.222484-9-armbru@redhat.com> In-Reply-To: <20220127112859.222484-1-armbru@redhat.com> References: <20220127112859.222484-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1643284318291100001 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