From nobody Sat Nov 15 16:43:24 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1750104791; cv=none; d=zohomail.com; s=zohoarc; b=KC1rbF7GvwRqjVt398fMtPGq2Xu7FiXpAZMdBybZK1WLQoIR5836RrPRcFpcmZFnu8Zj2KRfsVzD1f/j0GRfz+iwh730n3r0OGisLFDfmlcOWtash3wc63TwgtC2I+359ZumKDlV4r+cq1j11w2HQRUuskVtS4oRoj4HutPtUeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750104791; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Uq8r4SY6dBJOUCHBztuIABwLi9QFf5rV0uIKi8BAX2Y=; b=aZS8kg5lgXEMqDGtfyJGWniLfh0owT5jYgdL0m7iBcFf4yIdMSOLFgrXy2wserug4r9QygDv+tlBXgJ0A96zeB6gYcFpVN0SHdoN+5+Rk7R7nlW/HbCZCbWP2jSOoyeRNvggVFGxfWQXcp3IgqcrqeRJ8vBD1uU2P3gXjcx9ndU= 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 1750104791742533.410643362775; Mon, 16 Jun 2025 13:13:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uRGCG-0002WD-4j; Mon, 16 Jun 2025 16:12:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uRGCB-0002VC-JS for qemu-devel@nongnu.org; Mon, 16 Jun 2025 16:12:44 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uRGC5-00073s-8y for qemu-devel@nongnu.org; Mon, 16 Jun 2025 16:12:43 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7fd35b301bdso5905440a12.2 for ; Mon, 16 Jun 2025 13:12:36 -0700 (PDT) Received: from ubuntu.. ([49.207.59.180]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b2fe1642dfdsm7369494a12.18.2025.06.16.13.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jun 2025 13:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750104753; x=1750709553; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uq8r4SY6dBJOUCHBztuIABwLi9QFf5rV0uIKi8BAX2Y=; b=UQZ6AIo7i0PPJb04zBK8i1qBvxvmt0khhnODL8NZY+Z4hsYyh8wSUxMo+bcdmGrGi8 3n3yqnw4S6+CueEqT6egZUzxrZOjL0Pz0n/rmZu9eNqT6BTyl+X2gvAR4DAoGPn3qh1x 4UmSu92+MAx6mDfo1a5Z56izQ3omWyST5bkOiLqfIRzb6H4CPX6BescPQ1z/IMrsvCN0 F/XhpBVrhrP2pJ/mrnWJR4R3xLb0HmlGLsaW15DjIqq2lFxurfWTmM5qLsBmOAIzMd/D nKyPFhCq0RmNG91wL9aOhNFklcj4ETKBbFx5+KNLAyB10EBeC3p3R7TipJow6X2v8yhg 8xpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750104753; x=1750709553; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uq8r4SY6dBJOUCHBztuIABwLi9QFf5rV0uIKi8BAX2Y=; b=GX7kN8+yYzStywk7LrbPtBHJuEt9Gbq25c39ZKI8LpnVU8caqE/Ozgy5z+D+Jdjufe bjcRtsatBgSxW8dI3nntEZsi9Cdxz71+YU4+Tx4ly5G8SFAb6Q9jtWL+lYmfEZ1wHWqd YRftBbLweI/bHmwZGAx0XtFa2ZVXrBwYxQi49q/DakILl78kah5mCbgK03T61cT/Kqa3 m1v+FxOuQ2xR0TOy5UoUGvBrs7afKIGp5WhGS5k/TffWyVvzCOgINoDzF2+DTBvt/0PV YKQhM7AT8OMAJvVSyWkvCKmk81XI948AuLexGk5YswKdycNuXr3nFt9fCBdPPOdH9yCo MUqw== X-Gm-Message-State: AOJu0YzJvw2s3KQsjUfmGeAlJVKWJN3NV+cVkvKpbf5p9j1+BUALmWUJ yPEjoW4CI3l4u3wk9IiddNB2u3SvPwGwf1vjwjYUx6m30fEM64N7m24+DqYnGmByiMECYA== X-Gm-Gg: ASbGnctgNZvweO/OzcwJLNywhc77L2h0BmlWRBGUK8h1PqdsFEBFowJ9rHLlsgjXI+s OJjcmmKpsdbhW3stuorY2ugxE4YmQXdv347/xIbpvR/RIVMuSUGyuPCg8cy2EoyCkWXARvre+eF 46aSQXqE775++YK7Les8UlsPfLCfJG9Vi9Cqzo1jaTymXhlbLZkqsL5Az2FPA8yAyaT8UwBBURB KB3mVRKxw948vNQ9TOreE0Jw19BboMAsyWwAleLdDIGCHBr7mQcgebilnAoD9FW0mqFH2oc//EK 5eth2pwxpUVqO0mnf6u05zeFhiOZVckT+7ndVS6d980wVeFhWUmVrwiXB69IX/OE8hMQQ2gXFl6 FQg== X-Google-Smtp-Source: AGHT+IH2HblgeAwP+Nsiok75hKrwGZM2CSefExtvTqQzZyrNRCojSbSeJY68oUefXPV+QGBkII6HRA== X-Received: by 2002:a05:6a20:e687:b0:1f5:9330:29fe with SMTP id adf61e73a8af0-21fbd4c7e08mr13286691637.17.1750104752982; Mon, 16 Jun 2025 13:12:32 -0700 (PDT) From: Tanish Desai To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Paolo Bonzini , Mads Ynddal , Stefan Hajnoczi , Tanish Desai Subject: [PATCH 2/3] tracetool: introduce generate_unconditional Date: Mon, 16 Jun 2025 20:12:21 +0000 Message-Id: <20250616201222.6416-3-tanishdesai37@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250616201222.6416-1-tanishdesai37@gmail.com> References: <20250616201222.6416-1-tanishdesai37@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=tanishdesai37@gmail.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1750104792647116600 Content-Type: text/plain; charset="utf-8" This patch separates the generation logic of trace_foo() for the UST and DT= race backends from other backends. The motivation is to remove the unnecessary if (true) in the _no_check func= tion, as UST and DTrace do not require a trace_event_get_state check withou= t introducing a seperate function it is very difficult to generate code whi= ch keeps them out of unified if condition. With this separation, we can safely move the trace_event_get_state check in= to trace_foo for the other backends only, keeping UST/DTrace generation pat= hs clean. A new generate_h_unconditional function has been introduced for UST and DTr= ace. It behaves similarly to generate_h, but is defined only in UST and DTr= ace backends. This ensures that generate_h is used by the other backends, w= hile UST/DTrace selectively use generate_h_unconditional. Signed-off-by: Tanish Desai Reviewed-by: Alex Benn=C3=A9e --- scripts/tracetool/backend/__init__.py | 3 +++ scripts/tracetool/backend/dtrace.py | 3 ++- scripts/tracetool/backend/ust.py | 2 +- scripts/tracetool/format/h.py | 10 +++++++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/back= end/__init__.py index 7bfcc86cc5..c4456a5efd 100644 --- a/scripts/tracetool/backend/__init__.py +++ b/scripts/tracetool/backend/__init__.py @@ -118,6 +118,9 @@ def generate_begin(self, events, group): def generate(self, event, group): self._run_function("generate_%s", event, group) =20 + def generate_unconditional(self, event, group): + self._run_function("generate_%s_unconditional", event, group) + =20 def generate_backend_dstate(self, event, group): self._run_function("generate_%s_backend_dstate", event, group) =20 diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backen= d/dtrace.py index e17edc9b9d..171b7e09ed 100644 --- a/scripts/tracetool/backend/dtrace.py +++ b/scripts/tracetool/backend/dtrace.py @@ -61,7 +61,8 @@ def generate_h_begin(events, group): '#endif', uppername=3De.name.upper()) =20 -def generate_h(event, group): + +def generate_h_unconditional(event, group): out(' QEMU_%(uppername)s(%(argnames)s);', uppername=3Devent.name.upper(), argnames=3D", ".join(event.args.names())) diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/u= st.py index c857516f21..1564b490ec 100644 --- a/scripts/tracetool/backend/ust.py +++ b/scripts/tracetool/backend/ust.py @@ -30,7 +30,7 @@ def generate_h_begin(events, group): '') =20 =20 -def generate_h(event, group): +def generate_h_unconditional(event, group): argnames =3D ", ".join(event.args.names()) if len(event.args) > 0: argnames =3D ", " + argnames diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index ea126b07ea..89d54b9aff 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -76,13 +76,17 @@ def generate(events, backend, group): out('', 'static inline void %(api)s(%(args)s)', '{', - ' if (%(cond)s) {', + api=3De.api(), + args=3De.args) + =20 + if "disable" not in e.properties: + backend.generate_unconditional(e, group) + + out(' if (%(cond)s) {', ' %(api_nocheck)s(%(names)s);', ' }', '}', - api=3De.api(), api_nocheck=3De.api(e.QEMU_TRACE_NOCHECK), - args=3De.args, names=3D", ".join(e.args.names()), cond=3Dcond) =20 --=20 2.34.1