Re: [PATCH] alpha/perf: Clean up stale comments referencing old hw_perf_* APIs
From: Ian Rogers
Date: Tue Sep 15 2026 - 17:45:58 EST
On Mon, Feb 23, 2026 at 10:25 PM Yunbo Lyu <yunbolv@xxxxxxxxx> wrote:
>
> Two outdated comments in arch/alpha/kernel/perf_event.c referred to
> functions from the deprecated hw_perf_* APIs that were removed more
> than a decade ago:
>
> 1. hw_perf_disable():
> This was superseded by per-PMU disable APIs such as
> alpha_pmu_disable(), after commit 33696fc0d141 ("perf: Per PMU
> disable"). The comment has been updated to reflect the correct
> function name.
>
> 2. hw_perf_group_sched_in():
> This function was removed in commit a13c3afd9b62 ("perf, sparc:
> Implement group scheduling transactional APIs"). The corresponding
> comment mentioning it has been removed. The if (n_ev == 0) check in
> alpha_check_constraints() has also been removed, as this condition is
> never true. The alpha_check_constraints() function is only called
> from two places:
>
> - alpha_pmu_add(), which calls alpha_check_constraints() with
> n0 + 1, where n0 is the number of existing events (>= 0).
> - __hw_perf_event_init(), which calls it with n + 1, where n is the
> number of events in the group (>= 0).
>
> In both cases, the n_ev argument is guaranteed to be at least 1.
> Therefore, the check is redundant.
>
> No functional changes; comments and dead code cleanup.
>
> Fixes: 33696fc0d141 ("perf: Per PMU disable")
> Fixes: a13c3afd9b62 ("perf, sparc: Implement group scheduling transactional APIs")
>
> Signed-off-by: Yunbo Lyu <yunbolyu@xxxxxxxxxx>
Thanks for the cleanup! A nit: the commit message mentions comments
but there is also the dead code clean up. Someone bisecting may
struggle to attribute this change if the commit message suggests it
only impacts comments. Could we either do 2 patches (comments + dead
code) or change the commit title to mention dead code?
Thanks,
Ian
> ---
> arch/alpha/kernel/perf_event.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
> index a3eaab094ece..2f57626ffcfb 100644
> --- a/arch/alpha/kernel/perf_event.c
> +++ b/arch/alpha/kernel/perf_event.c
> @@ -35,7 +35,7 @@ struct cpu_hw_events {
> int enabled;
> /* Number of events scheduled; also number entries valid in arrays below. */
> int n_events;
> - /* Number events added since last hw_perf_disable(). */
> + /* Number of events added since last alpha_pmu_disable(). */
> int n_added;
> /* Events currently scheduled. */
> struct perf_event *event[MAX_HWEVENTS];
> @@ -372,10 +372,6 @@ static int alpha_check_constraints(struct perf_event **events,
> unsigned long *evtypes, int n_ev)
> {
>
> - /* No HW events is possible from hw_perf_group_sched_in(). */
> - if (n_ev == 0)
> - return 0;
> -
> if (n_ev > alpha_pmu->num_pmcs)
> return -1;
>
> --
> 2.25.1
>