mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/core: Reset remaining bits in perf_clear_branch_entry_bitfields()
@ 2022-12-01  5:51 Anshuman Khandual
  2022-12-01 10:24 ` James Clark
  2022-12-05  3:41 ` Anshuman Khandual
  0 siblings, 2 replies; 3+ messages in thread
From: Anshuman Khandual @ 2022-12-01  5:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: james.clark, Anshuman Khandual, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-perf-users

perf_clear_branch_entry_bitfields() resets all struct perf_branch_entry bit
fields before capturing branch records. This resets remaining bit fields
except 'new_type', which is valid only when 'type' is PERF_BR_EXTEND_ABI.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.1-rc6

'perf_branch_entry.new_type' can remain uninitialized as explained earlier.
Also there is no PERF_BR_NEW_UNKNOWN to spare, because 'perf_branch_entry.
new_type' enumeration starts at PERF_BR_NEW_FAULT_ALGN, to save a position
for the extended branch types instead.

 include/linux/perf_event.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 0031f7b4d9ab..c97b5f6f77a4 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1110,8 +1110,9 @@ static inline void perf_clear_branch_entry_bitfields(struct perf_branch_entry *b
 	br->in_tx = 0;
 	br->abort = 0;
 	br->cycles = 0;
-	br->type = 0;
+	br->type = PERF_BR_UNKNOWN;
 	br->spec = PERF_BR_SPEC_NA;
+	br->priv = PERF_BR_PRIV_UNKNOWN;
 	br->reserved = 0;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-05  3:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01  5:51 [PATCH] perf/core: Reset remaining bits in perf_clear_branch_entry_bitfields() Anshuman Khandual
2022-12-01 10:24 ` James Clark
2022-12-05  3:41 ` Anshuman Khandual

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®