RE: [PATCH 2/4] perf: nvidia_t410_cmem_latency: handle PERF_EF_UPDATE in stop
From: Besar Wicaksono
Date: Thu May 14 2026 - 12:00:44 EST
> -----Original Message-----
> From: Saurav Sachidanand <sauravsc@xxxxxxxxxx>
> Sent: Wednesday, May 13, 2026 8:06 PM
> To: Will Deacon <will@xxxxxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>; Besar Wicaksono
> <bwicaksono@xxxxxxxxxx>; Ilkka Koskinen
> <ilkka@xxxxxxxxxxxxxxxxxxxxxx>; Andi Shyti <andi.shyti@xxxxxxxxxx>; linux-
> arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-perf-users@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; aghayev@xxxxxxxxxx; juew@xxxxxxxxxx; Saurav
> Sachidanand <sauravsc@xxxxxxxxxx>
> Subject: [PATCH 2/4] perf: nvidia_t410_cmem_latency: handle
> PERF_EF_UPDATE in stop
>
> External email: Use caution opening links or attachments
>
>
> cmem_lat_pmu_stop() does not read the final counter value when called
> with PERF_EF_UPDATE. When perf core calls pmu->del() -> pmu->stop()
> with PERF_EF_UPDATE, the last counter delta is lost because the event
> is marked stopped without reading hardware.
>
> Add the standard PMU stop pattern: bail out if already stopped, call
> the event update function when PERF_EF_UPDATE is requested, then mark
> the event stopped.
>
> Fixes: 429b7638b2df ("perf: add NVIDIA Tegra410 CPU Memory Latency
> PMU")
> Signed-off-by: Saurav Sachidanand <sauravsc@xxxxxxxxxx>
> ---
> drivers/perf/nvidia_t410_cmem_latency_pmu.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/perf/nvidia_t410_cmem_latency_pmu.c
> b/drivers/perf/nvidia_t410_cmem_latency_pmu.c
> index e27bf31b2b366..c7fa54c7a7c9e 100644
> --- a/drivers/perf/nvidia_t410_cmem_latency_pmu.c
> +++ b/drivers/perf/nvidia_t410_cmem_latency_pmu.c
> @@ -303,6 +303,12 @@ static void cmem_lat_pmu_start(struct perf_event
> *event, int pmu_flags)
>
> static void cmem_lat_pmu_stop(struct perf_event *event, int pmu_flags)
> {
> + if (event->hw.state & PERF_HES_STOPPED)
> + return;
> +
> + if (pmu_flags & PERF_EF_UPDATE)
> + cmem_lat_pmu_event_update(event);
> +
Hi Saurav,
This call is not needed since the driver called it on pmu_disable callback.
Adding it on stop callback would be redundant.
Regards,
Besar