[PATCH 2/4] perf: nvidia_t410_cmem_latency: handle PERF_EF_UPDATE in stop

Besar Wicaksono bwicaksono at nvidia.com
Thu May 14 08:59:00 PDT 2026



> -----Original Message-----
> From: Saurav Sachidanand <sauravsc at amazon.com>
> Sent: Wednesday, May 13, 2026 8:06 PM
> To: Will Deacon <will at kernel.org>
> Cc: Mark Rutland <mark.rutland at arm.com>; Besar Wicaksono
> <bwicaksono at nvidia.com>; Ilkka Koskinen
> <ilkka at os.amperecomputing.com>; Andi Shyti <andi.shyti at kernel.org>; linux-
> arm-kernel at lists.infradead.org; linux-perf-users at vger.kernel.org; linux-
> kernel at vger.kernel.org; aghayev at amazon.com; juew at amazon.com; Saurav
> Sachidanand <sauravsc at amazon.com>
> 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 at amazon.com>
> ---
>  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




More information about the linux-arm-kernel mailing list