From: "tip-bot2 for Adrian Hunter" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Adrian Hunter <adrian.hunter@intel.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Yi Lai <yi1.lai@intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf/x86/intel/pt: Use bitwise access for PERF_HES_STOPPED
Date: Mon, 10 Aug 2026 10:29:39 -0000 [thread overview]
Message-ID: <178635777941.442315.15664781126706469288.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260721070254.13557-3-adrian.hunter@intel.com>
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 265bb4ef75fa657f4957d72087a6a246b89d5f0d
Gitweb: https://git.kernel.org/tip/265bb4ef75fa657f4957d72087a6a246b89d5f0d
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 21 Jul 2026 10:02:53 +03:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 07 Aug 2026 18:27:06 +02:00
perf/x86/intel/pt: Use bitwise access for PERF_HES_STOPPED
The Intel PT driver reads and writes event->hw.state as a whole value,
assuming it is either 0 or PERF_HES_STOPPED. That is true today, but a
subsequent fix needs to also track an open AUX output buffer using the
PERF_HES_UPTODATE bit of the same field.
When more than one bit can be set, whole-value assignments would
overwrite the other bits and whole-value comparisons would fail to match.
Convert all accesses to set, clear and test the PERF_HES_STOPPED bit
individually, in preparation for that change.
No functional change intended: event->hw.state currently only ever
holds 0 or PERF_HES_STOPPED, so the bitwise forms are equivalent.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Yi Lai <yi1.lai@intel.com>
Link: https://patch.msgid.link/20260721070254.13557-3-adrian.hunter@intel.com
---
arch/x86/events/intel/pt.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index dc1be7f..2163e5c 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -1540,12 +1540,12 @@ void intel_pt_interrupt(void)
perf_aux_output_end(&pt->handle, local_xchg(&buf->data_size, 0));
- if (!event->hw.state) {
+ if (!(event->hw.state & PERF_HES_STOPPED)) {
int ret;
buf = perf_aux_output_begin(&pt->handle, event);
if (!buf) {
- event->hw.state = PERF_HES_STOPPED;
+ event->hw.state |= PERF_HES_STOPPED;
WRITE_ONCE(pt->resume_allowed, 0);
return;
}
@@ -1639,7 +1639,7 @@ static void pt_event_start(struct perf_event *event, int mode)
goto fail_end_stop;
}
- hwc->state = 0;
+ hwc->state &= ~PERF_HES_STOPPED;
pt_config_buffer(buf);
pt_config(event);
@@ -1649,7 +1649,7 @@ static void pt_event_start(struct perf_event *event, int mode)
fail_end_stop:
perf_aux_output_end(&pt->handle, 0);
fail_stop:
- hwc->state = PERF_HES_STOPPED;
+ hwc->state |= PERF_HES_STOPPED;
}
static void pt_event_stop(struct perf_event *event, int mode)
@@ -1680,10 +1680,10 @@ static void pt_event_stop(struct perf_event *event, int mode)
pt_config_stop(event);
- if (event->hw.state == PERF_HES_STOPPED)
+ if (event->hw.state & PERF_HES_STOPPED)
return;
- event->hw.state = PERF_HES_STOPPED;
+ event->hw.state |= PERF_HES_STOPPED;
if (mode & PERF_EF_UPDATE) {
struct pt_buffer *buf = perf_get_aux(&pt->handle);
@@ -1778,10 +1778,10 @@ static int pt_event_add(struct perf_event *event, int mode)
if (mode & PERF_EF_START) {
pt_event_start(event, 0);
ret = -EINVAL;
- if (hwc->state == PERF_HES_STOPPED)
+ if (hwc->state & PERF_HES_STOPPED)
goto fail;
} else {
- hwc->state = PERF_HES_STOPPED;
+ hwc->state |= PERF_HES_STOPPED;
}
ret = 0;
next prev parent reply other threads:[~2026-08-10 10:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 7:02 [PATCH 0/3] perf/x86/intel/pt: Fix stop/start with no update Adrian Hunter
2026-07-21 7:02 ` [PATCH 1/3] perf/x86/intel/pt: Factor out pt_config_enable() Adrian Hunter
2026-08-10 10:29 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2026-07-21 7:02 ` [PATCH 2/3] perf/x86/intel/pt: Use bitwise access for PERF_HES_STOPPED Adrian Hunter
2026-08-10 10:29 ` tip-bot2 for Adrian Hunter [this message]
2026-07-21 7:02 ` [PATCH 3/3] perf/x86/intel/pt: Fix stop/start with no update Adrian Hunter
2026-08-10 10:29 ` [tip: perf/core] " tip-bot2 for Adrian Hunter
2026-07-29 13:36 ` [PATCH 0/3] " Lai, Yi
2026-08-05 11:22 ` Adrian Hunter
2026-08-07 16:10 ` Peter Zijlstra
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=178635777941.442315.15664781126706469288.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=adrian.hunter@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
--cc=yi1.lai@intel.com \
/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
all inboxes | Powered by JetHome®