Re: [PATCH] perf/core: Reset remaining bits in perf_clear_branch_entry_bitfields()
From: Anshuman Khandual
Date: Sun Dec 04 2022 - 22:41:29 EST
On 12/1/22 11:21, Anshuman Khandual wrote:
> 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@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Cc: linux-perf-users@xxxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> 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;
> }
>
Hello Peter,
Just wondering is there a chance that this patch could make it to v6.2-rc1 ?
- Anshuman