Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp917355lqh; Sat, 1 Jun 2024 01:32:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZ+Y1FiElwKJC+AdKg0cJk2ZWdKh7HSmikv/RJu9CsTwXsAvsCBKaVZLpnQIPuxKeethddn4p9XNsafaOZEG7EnKmYI/g9j1Mv/LTM5Q== X-Google-Smtp-Source: AGHT+IGFSERyQJBgaeU6zy59uu3gvo8ITDzLAp2WFGohh4Qpphriv4Fw5Zru0ihL+4/ahBmPk+Wx X-Received: by 2002:a50:9ea9:0:b0:57a:1aa8:b4af with SMTP id 4fb4d7f45d1cf-57a3644b1c5mr2882720a12.32.1717230777689; Sat, 01 Jun 2024 01:32:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717230777; cv=pass; d=google.com; s=arc-20160816; b=i5GHmqSeJlMezdIjIsEP2903hhkXUtp+Nezy21L03DrSwoBZoB2vGcFs+w+k48CsEn BGgrMBn1TFy7ecBpEZFZGKokQVIcglXHa9PoDDTbqs6Alc+u+9GG9AZ07ctV+9Pp7oXC 9AWiLkcixIEoKo1A4mbL6eXbiZPRoLBOaqPKQOq/z+5jGV2RUXiN8vjVZUpYtALpBWNH 1z8j0L1uXlqjEen2OUJSl/5nVCHYFn95GxsMLJ96plydNqNH8cdoyppzF+R/DgAhO/sA iZdZzWAMLkwkzKEij2NsbEQdynjHZS8g09uptuQovTnah8nbPCA124/mMzFVgLdOxDIE 08yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=f9IoJY3Xtw989dsFlXWpUkemRduK0IW4TowUoqR8Wsc=; fh=MVwHBGRSGmZU74aLqYm+M/AGhZWHsMrP0c2+q3cgSNc=; b=Q7MYa9ZI2To01uPtSuC82bahY3F6eYaIglVy00+Q6525OptfX3tUU9+Sg6WChE75QW 9nw2i3AOf87IdcvukHEVPUa7AlH/0ZbLo7LJoMq76fnnrU7Cyniz/Gy8FZ6So4YI62oq yZElKXOfqLvcVtprWQX7bCS653fQp2qk/yH9nmydoGeZg02wc7Jpp+8S1ct5Qoa5uhA3 R52DsIxKF2TejoSg82zrzG5SgCOrvy5GtOwR1p7MMlxrqUdeOozzi5WBtTZRRRfcRi5f giKRNbRvKH15qsCT1ASl9Zmw1LYC3yPbHV9nAOkwXsl3kWEMW2o5quEXIP/b7FYFquoq vT2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dkgb3fBN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31cc93f4si1860173a12.633.2024.06.01.01.32.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 01:32:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dkgb3fBN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197766-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B8D441F27484 for ; Sat, 1 Jun 2024 08:23:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D91E0208C4; Sat, 1 Jun 2024 08:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dkgb3fBN" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 089C82BD0F; Sat, 1 Jun 2024 08:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717230161; cv=none; b=SBhMXb9NT/0sj/zo3eGhbi4ev1pk0hRGwQqiGr5HOQTDY46Q35TGuH8oCIz2V+YB5/+pvQr/h9qfRx1aEd0L5pqH2vzehwEx4Lu8sFjdrENIyVvpskf0kEkcZE8FEQ6swPVFw92DvLlHaweVI0i36OGCZ6gJZx/8UBYHk78QiKE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717230161; c=relaxed/simple; bh=SEa6/naGWiY7r2mBFfkW8iDQpAWKMrIxI6Kmz0cQV7c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=GUXaJI6kqfG2ppU7YUCqM8swPXf1hyJkLRd7Mf+PUAXc1ii8HNBD7KTYjDadnYphToqKSD8T4JFj0hMOaJco6quxGuK8ZAVchC0YKnJeQnbUrbIx7xr7iTloSKDblCgGM31qp5gt2g5kjy5YuNQHFRZToD0j/C6a1cr0Cj3LE1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dkgb3fBN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C7E8C3277B; Sat, 1 Jun 2024 08:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717230160; bh=SEa6/naGWiY7r2mBFfkW8iDQpAWKMrIxI6Kmz0cQV7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dkgb3fBNELIPx0iqHx5H4BzpP0nrcQ2qs+LNXaqgfBhr11y4qu/TzTqnlNAVJ0ioG jcFiMfbQiAnK7Ets+2e70k6v3nIB2B3+78eKormQglI1p7Lj0KUa+t1bv/o0g3SrFw Yh8Kjti9jMxw3LayhLPvSp76HPQD/X/OnaQda7CAGxPXapctqEF0/KUTXmYRUTCUQf L4ZXMmNIbqiMI/SlgY00Ehb3+f0vJS7EgpujOnuYhBImG/yX+k/kwhkLsuDyHwDoET qKSxZ4MTd8GJvP2i9h1KqqlkCM4ax3AXqfPRXvJywb+u9vIIWXtdy7kfy9lZtWErIj rrRvGkY1mWT9w== From: "Masami Hiramatsu (Google)" To: Steven Rostedt Cc: Mathieu Desnoyers , don , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org Subject: [PATCH v2 1/3] tracepoint: Support iterating over tracepoints on modules Date: Sat, 1 Jun 2024 17:22:37 +0900 Message-Id: <171723015695.258703.10976621187063548530.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <171723014778.258703.6731294779199848686.stgit@devnote2> References: <171723014778.258703.6731294779199848686.stgit@devnote2> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit From: Masami Hiramatsu (Google) Add for_each_module_tracepoint() for iterating over tracepoints on modules. This is similar to the for_each_kernel_tracepoint() but only for the tracepoints on modules (not including kernel built-in tracepoints). Signed-off-by: Masami Hiramatsu (Google) --- include/linux/tracepoint.h | 7 +++++++ kernel/tracepoint.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 689b6d71590e..46e6a5e759fd 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -65,6 +65,8 @@ struct tp_module { bool trace_module_has_bad_taint(struct module *mod); extern int register_tracepoint_module_notifier(struct notifier_block *nb); extern int unregister_tracepoint_module_notifier(struct notifier_block *nb); +void for_each_module_tracepoint(void (*fct)(struct tracepoint *, void *), + void *priv); #else static inline bool trace_module_has_bad_taint(struct module *mod) { @@ -80,6 +82,11 @@ int unregister_tracepoint_module_notifier(struct notifier_block *nb) { return 0; } +static inline +void for_each_module_tracepoint(void (*fct)(struct tracepoint *, void *), + void *priv) +{ +} #endif /* CONFIG_MODULES */ /* diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 8d1507dd0724..b9b90dc46ab1 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -735,6 +735,22 @@ static __init int init_tracepoints(void) return ret; } __initcall(init_tracepoints); + +void for_each_module_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), + void *priv) +{ + struct tp_module *tp_mod; + struct module *mod; + + mutex_lock(&tracepoint_module_list_mutex); + list_for_each_entry(tp_mod, &tracepoint_module_list, list) { + mod = tp_mod->mod; + for_each_tracepoint_range(mod->tracepoints_ptrs, + mod->tracepoints_ptrs + mod->num_tracepoints, + fct, priv); + } + mutex_unlock(&tracepoint_module_list_mutex); +} #endif /* CONFIG_MODULES */ /**