[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNPTwxnlXGbazFLR@willie-the-truck>
Date: Wed, 24 Sep 2025 12:19:31 +0100
From: Will Deacon <will@...nel.org>
To: Yicong Yang <yangyicong@...wei.com>
Cc: Yushan Wang <wangyushan12@...wei.com>, Jonathan.Cameron@...wei.com,
yangyicong@...ilicon.com, mark.rutland@....com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
robin.murphy@....com, liuyonglong@...wei.com,
wanghuiqiang@...wei.com, prime.zeng@...ilicon.com,
hejunhao3@...artners.com, linuxarm@...wei.com, fanghao11@...wei.com
Subject: Re: [PATCH v3 5/9] drivers/perf: hisi: Extend the field of tt_core
On Tue, Sep 23, 2025 at 03:31:15PM +0800, Yicong Yang wrote:
> 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?
Will
Powered by blists - more mailing lists