Re: [PATCH v3 5/9] drivers/perf: hisi: Extend the field of tt_core
From: Yicong Yang <hidden>
Date: 2025-09-25 03:59:36
Also in:
lkml
On 2025/9/24 19:19, Will Deacon wrote:
On Tue, Sep 23, 2025 at 03:31:15PM +0800, Yicong Yang wrote:quoted
diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c index bbd81a43047d..a52d98f1ed34 100644 --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c@@ -57,6 +57,11 @@ #define L3C_V2_NR_EVENTS 0xFF HISI_PMU_EVENT_ATTR_EXTRACTOR(ext, config, 17, 16); +/* + * Remain the config1:0-7 for backward compatibility if some existing users + * hardcode the config1:0-7 directly without parsing the sysfs attribute. + */ +HISI_PMU_EVENT_ATTR_EXTRACTOR(tt_core_deprecated, config1, 7, 0); HISI_PMU_EVENT_ATTR_EXTRACTOR(tt_req, config1, 10, 8); HISI_PMU_EVENT_ATTR_EXTRACTOR(datasrc_cfg, config1, 15, 11); HISI_PMU_EVENT_ATTR_EXTRACTOR(datasrc_skt, config1, 16, 16);@@ -95,6 +100,21 @@ static bool support_ext(struct hisi_l3c_pmu *pmu) return l3c_pmu_ext->support_ext; } +/* + * tt_core was extended to cover all the CPUs sharing the L3 and was moved from + * config1:0-7 to config2:0-*. Try it first and fallback to tt_core_deprecated + * if user's still using the deprecated one. + */ +static u32 hisi_l3c_pmu_get_tt_core(struct perf_event *event) +{ + u32 core = hisi_get_tt_core(event); + + if (core) + return core; + + return hisi_get_tt_core_deprecated(event); +}Perhaps we should be stricter about this and fail validation for events that specify both a non-zero tt_core and a non-zero tt_core_deprecated?
added in hisi_uncore_l3c_ops->check_filter() that hisi_uncore_pmu_event_init() will call check_filter() to ask uncore pmu to validate the filter configuration. https://lore.kernel.org/linux-arm-kernel/20250925033123.5836-1-yangyicong@huawei.com/ (local) thanks.