[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d47f257a-a71f-4063-8918-8f4d8a9b814d@linux.intel.com>
Date: Wed, 26 Nov 2025 13:25:46 +0800
From: "Mi, Dapeng" <dapeng1.mi@...ux.intel.com>
To: david.laight.linux@...il.com, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Ingo Molnar
<mingo@...hat.com>, Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 03/44] perf: Fix branch stack callchain limit
On 11/20/2025 6:40 AM, david.laight.linux@...il.com wrote:
> From: David Laight <david.laight.linux@...il.com>
>
> The code that bounds the brs->nr to event->attr.sample_max_stack
> incorrectly masks brs->nr with 65535 before the limit check.
> Replace the min_t(u16, ...) with a plain min(...).
>
> I guess there may be another limit on brs->nr (which is u64).
>
> Fixes: c53e14f1ea4a8 ("perf: Extend per event callchain limit to branch stack")
> Signed-off-by: David Laight <david.laight.linux@...il.com>
> ---
> include/linux/perf_event.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index fd1d91017b99..f91c875ea311 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -1430,7 +1430,7 @@ static inline void perf_sample_save_brstack(struct perf_sample_data *data,
> if (branch_sample_hw_index(event))
> size += sizeof(u64);
>
> - brs->nr = min_t(u16, event->attr.sample_max_stack, brs->nr);
> + brs->nr = min(event->attr.sample_max_stack, brs->nr);
>
> size += brs->nr * sizeof(struct perf_branch_entry);
>
LGTM. Thanks.
Reviewed-by: Dapeng Mi <dapeng1.mi@...ux.intel.com>
Powered by blists - more mailing lists