[PATCH 1/3] drivers/perf: hisi_pcie: Record hardware counts correctly

Jonathan Cameron Jonathan.Cameron at Huawei.com
Thu Aug 29 06:41:39 PDT 2024


On Thu, 29 Aug 2024 17:03:30 +0800
Yicong Yang <yangyicong at huawei.com> wrote:

> From: Yicong Yang <yangyicong at hisilicon.com>
> 
> Currently we set the period and record it as the initial value of the
> counter without checking it's set to the hardware successfully or not.
> However the counter maybe unwritable if the target event is unsupported
> by the device. In such case we will pass user a wrong count:
> 
> [start counts when setting the period]
> hwc->prev_count = 0x8000000000000000
> device.counter_value = 0 // the counter is not set as the period
> [when user reads the counter]
> event->count = device.counter_value - hwc->prev_count
>              = 0x8000000000000000 // wrong. should be 0.
> 
> Fix this by record the hardware counter counts correctly when setting
> the period.
> 
> Fixes: 8404b0fbc7fb ("drivers/perf: hisi: Add driver for HiSilicon PCIe PMU")
> Signed-off-by: Yicong Yang <yangyicong at hisilicon.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron at huawei.com>



More information about the linux-arm-kernel mailing list