From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 30C1D3AE6E5; Mon, 10 Aug 2026 10:29:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786357784; cv=none; b=u5z8hp6r9JqquFDIbT8cerhgD4v2bVQP0QkLr/I9ot1kiAlQpSTIhLeS74LD2Wxh+dQ77M2FWZQ585tvsSxdF4WlWLMq4dX0yXFJ59ZTKbC6qm9cW+F4RWuZ9C5dL60GiOhOqoRZdVJ/xZDUJ7ba7SF79bKlJL3ZAee401c+ReU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786357784; c=relaxed/simple; bh=3x+xkI6KdRjU+Q3W0QTSRPb61USCeZ8zh5Sp2UBg0lk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=kKNrMbx/iwYkRVbBGnctrkN0bFWpkZ/Ke5/233L9x4Z52uiaETIJ9XeAoNOcWrC9ZHTxIWnenS9sDEj1BlVxDjKp+k4TGsFkXzDYHke+IJ6mcpJmeuE7fEHQC567gjqN7syGVbaIVgfK7hacL4lhnlAECNswmSqhIC2yNlA12zk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BiPpCZzq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Arr4BLyc; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BiPpCZzq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Arr4BLyc" Date: Mon, 10 Aug 2026 10:29:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786357781; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2MoPuJ42RcLSfQFOZAAZR9sKZVr+6U4o7/S6nZQI7TY=; b=BiPpCZzq4VbTvLmCCFz/7aG433Gi9qUfR/cAJWqMFCKwZh2oKRnawOo9WcodpIxuaOyX6l Qv58aaqCx7wEcgOqIOmHblZ237qWvNoLb43YjJT/oflS7ol9oxw0iwxCFZgNU/8x+K79lE qDgcbfn1S90FQyJF25wI6rVYVN8b7mMFcg35EWLJpeUY5BcaGD4QR6w8sGoF5uo+E4tC8i tao1DcT1xAWv2xZAB0fcTTZSV0aUmus9cGEK5KZZVgot4KPBlD0DmhAFSiGIT9WgYSqqYv fD4aGBM1jqqFOOvwbBCofqvbkFayXMf2kS/8wrWztvfexgxAuq/G4a7V/SizhQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786357781; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2MoPuJ42RcLSfQFOZAAZR9sKZVr+6U4o7/S6nZQI7TY=; b=Arr4BLycRFLKCmII5I6R/+qkuNcMJ3x5kQlT2H14r2e8qnlSGKCxM0SqB8X/uHZoR/yy9q LNhzT+xolTFqMiBw== From: "tip-bot2 for Adrian Hunter" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel/pt: Use bitwise access for PERF_HES_STOPPED Cc: Adrian Hunter , "Peter Zijlstra (Intel)" , Yi Lai , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260721070254.13557-3-adrian.hunter@intel.com> References: <20260721070254.13557-3-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178635777941.442315.15664781126706469288.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the perf/core branch of tip: Commit-ID: 265bb4ef75fa657f4957d72087a6a246b89d5f0d Gitweb: https://git.kernel.org/tip/265bb4ef75fa657f4957d72087a6a246b89= d5f0d Author: Adrian Hunter AuthorDate: Tue, 21 Jul 2026 10:02:53 +03:00 Committer: Peter Zijlstra 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 Signed-off-by: Peter Zijlstra (Intel) Tested-by: Yi Lai 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) =20 perf_aux_output_end(&pt->handle, local_xchg(&buf->data_size, 0)); =20 - if (!event->hw.state) { + if (!(event->hw.state & PERF_HES_STOPPED)) { int ret; =20 buf =3D perf_aux_output_begin(&pt->handle, event); if (!buf) { - event->hw.state =3D PERF_HES_STOPPED; + event->hw.state |=3D PERF_HES_STOPPED; WRITE_ONCE(pt->resume_allowed, 0); return; } @@ -1639,7 +1639,7 @@ static void pt_event_start(struct perf_event *event, in= t mode) goto fail_end_stop; } =20 - hwc->state =3D 0; + hwc->state &=3D ~PERF_HES_STOPPED; =20 pt_config_buffer(buf); pt_config(event); @@ -1649,7 +1649,7 @@ static void pt_event_start(struct perf_event *event, in= t mode) fail_end_stop: perf_aux_output_end(&pt->handle, 0); fail_stop: - hwc->state =3D PERF_HES_STOPPED; + hwc->state |=3D PERF_HES_STOPPED; } =20 static void pt_event_stop(struct perf_event *event, int mode) @@ -1680,10 +1680,10 @@ static void pt_event_stop(struct perf_event *event, i= nt mode) =20 pt_config_stop(event); =20 - if (event->hw.state =3D=3D PERF_HES_STOPPED) + if (event->hw.state & PERF_HES_STOPPED) return; =20 - event->hw.state =3D PERF_HES_STOPPED; + event->hw.state |=3D PERF_HES_STOPPED; =20 if (mode & PERF_EF_UPDATE) { struct pt_buffer *buf =3D 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 =3D -EINVAL; - if (hwc->state =3D=3D PERF_HES_STOPPED) + if (hwc->state & PERF_HES_STOPPED) goto fail; } else { - hwc->state =3D PERF_HES_STOPPED; + hwc->state |=3D PERF_HES_STOPPED; } =20 ret =3D 0;