Linux Perf Users
 help / color / mirror / Atom feed
From: Junxiao Chang <junxiao.chang@intel.com>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	james.clark@linaro.org, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: bigeasy@linutronix.de, junxiao.chang@intel.com
Subject: [PATCH 1/1] perf/core: allow trace events to be accessed from any CPU
Date: Thu, 28 May 2026 08:51:36 +0800	[thread overview]
Message-ID: <20260528005136.1906479-2-junxiao.chang@intel.com> (raw)
In-Reply-To: <20260528005136.1906479-1-junxiao.chang@intel.com>

Using perf to collect trace event statistics may introduce unnecessary
SMP IPI interrupts. For example:

  perf stat -e i915:i915_context_create -I 1000

In perf_event_read(), an SMP IPI is triggered when the event CPU
differs from the local CPU.

Allow trace events to be accessed from any CPU so the event CPU can
be set to the local CPU, eliminating the extra IPI overhead.

Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
---
 kernel/events/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index acdb1f02924da..b3a817c0eb3a2 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11376,6 +11376,7 @@ static struct pmu perf_tracepoint = {
 	.start		= perf_swevent_start,
 	.stop		= perf_swevent_stop,
 	.read		= perf_swevent_read,
+	.scope		= PERF_PMU_SCOPE_SYS_WIDE,
 };
 
 static int perf_tp_filter_match(struct perf_event *event,
-- 
2.43.0


  reply	other threads:[~2026-05-27  0:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  0:51 [PATCH 0/1] allow trace events to be accessed from any CPU Junxiao Chang
2026-05-28  0:51 ` Junxiao Chang [this message]
2026-05-27  1:52   ` [PATCH 1/1] perf/core: " sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260528005136.1906479-2-junxiao.chang@intel.com \
    --to=junxiao.chang@intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox