[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhSdy1QDZc9LAnoZacFeQt-vCbrBCxxM4cY=EvLJXFAWifv5w@mail.gmail.com>
Date: Mon, 4 Aug 2025 10:24:27 +0530
From: Anup Patel <anup@...infault.org>
To: Yunhui Cui <cuiyunhui@...edance.com>
Cc: atish.patra@...ux.dev, will@...nel.org, mark.rutland@....com,
paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
alex@...ti.fr, linux-riscv@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf: riscv: skip empty batches in counter start
On Mon, Aug 4, 2025 at 8:21 AM Yunhui Cui <cuiyunhui@...edance.com> wrote:
>
> Avoid unnecessary SBI calls when starting non-overflowed counters
> in pmu_sbi_start_ovf_ctrs_sbi() by checking ctr_start_mask.
>
> Signed-off-by: Yunhui Cui <cuiyunhui@...edance.com>
LGTM.
Reviewed-by: Anup Patel <anup@...infault.org>
Regards,
Anup
> ---
> drivers/perf/riscv_pmu_sbi.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
> index 698de8ddf895b..3977f7488e4ef 100644
> --- a/drivers/perf/riscv_pmu_sbi.c
> +++ b/drivers/perf/riscv_pmu_sbi.c
> @@ -877,8 +877,10 @@ static inline void pmu_sbi_start_ovf_ctrs_sbi(struct cpu_hw_events *cpu_hw_evt,
> for (i = 0; i < BITS_TO_LONGS(RISCV_MAX_COUNTERS); i++) {
> ctr_start_mask = cpu_hw_evt->used_hw_ctrs[i] & ~ctr_ovf_mask;
> /* Start all the counters that did not overflow in a single shot */
> - sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, i * BITS_PER_LONG, ctr_start_mask,
> - 0, 0, 0, 0);
> + if (ctr_start_mask) {
> + sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, i * BITS_PER_LONG,
> + ctr_start_mask, 0, 0, 0, 0);
> + }
> }
>
> /* Reinitialize and start all the counter that overflowed */
> --
> 2.39.5
>
Powered by blists - more mailing lists