From nobody Sat Nov 15 16:34:55 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=1750430322; cv=none; d=zohomail.com; s=zohoarc; b=OLUxX9uyRFnqbgm6XnWsTlbTepfU+YzHzcakwK3khPyxLUOcIkiZMwqpbkgGv1+i7yQVm6vbdNvw3ZcrD9FX8PzihwkMOXT6AnGJJvfoWUJs7oi2KImiqnxfblCHvayH4Z1sszceKLgS1cwfPhqXTIZ6WeG7U1V8U9t51dQETYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750430322; 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=Mo/UcdRBnmSx+dkvg7nn6+3os5maF0Sk3Z74fE1uACY=; b=aCHDCXd/x3VCVEVLRmNPKjTrtaw1kxoBcbZowSee3eSYKdtCP1Mvy+ItPqoshzZIcsptxR1mHobUX3/zjikpQwswJZO7gpAqakDo5l3OjGsq+jnwf8aWTXG3sMlnqct4efyWdKWHL49St5uxaWaP9vAo4UhuZ+eQbtGs7K5vd4M= 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 1750430322111467.8334571362883; Fri, 20 Jun 2025 07:38:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uScsD-0000J7-UX; Fri, 20 Jun 2025 10:37:45 -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 1uScs3-0000Hj-6Y for qemu-devel@nongnu.org; Fri, 20 Jun 2025 10:37:35 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uScs1-0001is-0d for qemu-devel@nongnu.org; Fri, 20 Jun 2025 10:37:34 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-311a6236effso1331740a91.2 for ; Fri, 20 Jun 2025 07:37:31 -0700 (PDT) Received: from ubuntu.. ([27.61.32.140]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3158a2f0cf5sm4368820a91.26.2025.06.20.07.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jun 2025 07:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750430250; x=1751035050; 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=Mo/UcdRBnmSx+dkvg7nn6+3os5maF0Sk3Z74fE1uACY=; b=bE1ajetK0L4hp9s9Llkq61XqEWHVv1of1+ToG0Y90y+f2AX4l19/r7GTo6cS96cGk7 TNf+y4cKpNeflPO7xqUEPlu7op43/+nJflPwl2UmR4UCD0lc6fPvROLVzwgKxwiqN/AO fvDSjqTIhNvDVxeIorZmmRFW5k0lYd8Ffte/aQQBXG2xvx/kXVCQSghVSif5vs070ZJ/ Zmgta12mJxt/dHT6LCwVq5Gr5tXc+XTynmBXrvqRlGQjj0lRJCeOipS9NFJfFs35r2gx ap5vXH878yWYEuW0w/OSAP3R/CRelT8ga5SAVUOq96cV07uAHF9KLMIUVHe/RucaSqwD NfIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750430250; x=1751035050; 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=Mo/UcdRBnmSx+dkvg7nn6+3os5maF0Sk3Z74fE1uACY=; b=Lr77RZ3jZOyIdffGnKHwIt4W4GYc21q56VcWv+elgB3AI01GhOffspGAdD82S42quO mH5FaLsyPPGbJQ2h/0vfM8F5OAtkRjZmy178tGZFag0iAL3WnDnXFv5ohAWuMdAbOLyn UpQJGT+DkSe/tqinuTO+2ikBNGSQ893bTqqIKkYX6qgcYKabzAR7dEvn4Y3ydbyY+MgM DuLT6eu0FBhqKHXDhJsPzPwuFgCcuZVcqLXSfijAgpQrpV/JJpYG85+x8GaSu+wBs7cz qw1rI0JPBDag/Jd2kvu2Lw6sWi+kzzXEhNgUNRdpszYHVs35KNyue2AnCFmNGsELqxNZ TEAA== X-Gm-Message-State: AOJu0Yz2YXZzejSLtS3VmzxnI+4zLupINuqpRqokh7blU5LyjvYonIj4 qcqKYG9b96bOgktoKTjK/lJd5mtMsQ0z6OLU6+o+ZUhj6W5BwBbWSz5OGyp0XqdKfcIe6g== X-Gm-Gg: ASbGncsgmWbs9rAArYtC65SngM8aWcYmQMtUKJEXgho6XhwFn2wjkMpjyKRXwwiygOo sbaHHH4RIelxOzONpoiMuhuJ16ath2b+I7+BK0NbaWmCqSL78k0SUxANlebFchmwTFpCmwsGxEC slgrbZXzLRgHfD8J6WHRwRa0H+5/xxWMT3Sm80/jQJfmrVBijhx9ElEtFVfNFP7vSPaOrL+5MyA a+fbR7OpEfU2l4Z3ER2QXpu7K5rhnmmBXQtLql03gh+BbRnPCUB07KN/iJxvmhQM8h9UyyrvRBv B1CmrOKAhilEPWDKl4hM8YMnC/CYL3QOAOLxvI8pEHwRh1E+Opm7tG7vAUm0fEFKcXLGhiDhB30 /8PXfy48= X-Google-Smtp-Source: AGHT+IGg8UVSEyjWg/V2EETztL/F211NPlIQJLdlQEf3yvz4E21Wu9inpqoriaroxDhvRDHuqq5GAw== X-Received: by 2002:a17:90b:1e53:b0:313:31ca:a69 with SMTP id 98e67ed59e1d1-3159d8c8f6cmr6349137a91.18.1750430249983; Fri, 20 Jun 2025 07:37:29 -0700 (PDT) From: Tanish Desai To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Mads Ynddal , Tanish Desai Subject: [PATCH v2 2/3] tracetool: introduce generate_unconditional Date: Fri, 20 Jun 2025 14:37:19 +0000 Message-Id: <20250620143720.3143-3-tanishdesai37@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250620143720.3143-1-tanishdesai37@gmail.com> References: <20250620143720.3143-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::1031; envelope-from=tanishdesai37@gmail.com; helo=mail-pj1-x1031.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: 1750430323459116600 Content-Type: text/plain; charset="utf-8" This patch separates the generation logic of trace_foo() for the UST and DTrace backends from other backends. The motivation is to remove the unnecessary if (true) in the trace_foo() function, as UST and DTrace do not require a trace_event_get_state check without introducing a seperate function it is very difficult to generate code which keeps them out of unified if condition. With this separation, we can safely move the trace_event_get_state check into trace_foo for the other backends only, keeping UST/DTrace generation paths 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 DTrace backends. This ensures that generate_h is used by the other backends, while UST/DTrace selectively use generate_h_unconditional. Signed-off-by: Tanish Desai --- 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