From: Yicong Yang <yangyicong@huawei.com>
To: Leo Yan <leo.yan@arm.com>,
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Cc: <yangyicong@hisilicon.com>, James Clark <james.clark@linaro.org>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Ali Saidi <alisaidi@amazon.com>, "Leo Yan" <leo.yan@linaro.org>,
Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
yangjinqian <yangjinqian1@huawei.com>,
Douglas Anderson <dianders@chromium.org>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
Kan Liang <kan.liang@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: perf usage of arch/arm64/include/asm/cputype.h
Date: Mon, 16 Jun 2025 23:04:08 +0800 [thread overview]
Message-ID: <2dc510b4-ff3d-edff-42be-f8260cd27840@huawei.com> (raw)
In-Reply-To: <20250616130736.GA788469@e132581.arm.com>
On 2025/6/16 21:07, Leo Yan wrote:
> On Mon, Jun 16, 2025 at 09:54:43AM +0000, Shameerali Kolothum Thodi wrote:
>
> [...]
>
>>>> -bool is_midr_in_range_list(struct midr_range const *ranges) -{
>>>> - while (ranges->model)
>>>> - if (is_midr_in_range(ranges++))
>>>> - return true;
>>>> return false;
>>>> }
>
>>> Looks ok to me.
>>>
>>> You could do it with slightly less churn on the kernel side if you keep the
>>> function name and arguments the same there. There's only one usage in
>>> Perf so that one could be renamed and have the midr argument added back
>>> in.
>>
>> +1.
>>
>> Can we use a separate one for perf here, something like below(untested)?
>
> Thanks for working on this. Agreed.
>
>> --- a/tools/perf/util/arm-spe.c
>> +++ b/tools/perf/util/arm-spe.c
>> @@ -842,6 +842,18 @@ static void arm_spe__synth_memory_level(const
>> struct arm_spe_record *record,
>> data_src->mem_lvl |= PERF_MEM_LVL_REM_CCE1;
>> }
>>
>> +static bool is_perf_midr_in_range_list(u32 midr, struct midr_range
>> const *ranges)
>> +{
>> + while (ranges->model) {
>> + if (midr_is_cpu_model_range(midr, ranges->model,
>> + ranges->rv_min, ranges->rv_max)) {
>> + return true;
>> + }
>> + ranges++;
>> + }
>> + return false;
>> +}
>
> Maybe we can make it more general. For example, move this function into
> a common header such as tools/perf/arch/arm64/include/cputype.h. Then,
> util/arm-spe.c can include this header.
>
ok this sounds just like as before except rename the midr check function and modify the
users in perf. will do in below steps:
- move cpu_errata_set_target_impl()/is_midr_in_range_list() out of cputype.h
since they're only used in the kernel with errata information
- introduce is_target_midr_in_range_list() in cputype.h to test certain MIDR
is within the ranges. (is_perf_midr_in_range_list() only make sense in
userspace and is a bit strange to me in a kernel header). maybe reimplement
is_midr_in_range_list() with is_target_midr_in_range_list() otherwise there's
no users in kernel
- copy cputype.h to userspace and make users use new is_target_midr_in_range_list()
this will avoid touching the kernel too much and userspace don't need to implement
a separate function.
Thanks.
next prev parent reply other threads:[~2025-06-16 15:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 20:13 Arnaldo Carvalho de Melo
2025-06-13 20:53 ` Doug Anderson
2025-06-16 7:56 ` Yicong Yang
2025-06-16 9:29 ` James Clark
2025-06-16 9:54 ` Shameerali Kolothum Thodi
2025-06-16 13:07 ` Leo Yan
2025-06-16 15:04 ` Yicong Yang [this message]
2025-06-16 16:08 ` Leo Yan
2025-06-16 17:47 ` Mark Rutland
2025-06-17 14:18 ` Leo Yan
2025-06-18 6:47 ` Yicong Yang
2025-06-18 8:52 ` Mark Rutland
2025-06-18 11:24 ` Leo Yan
2025-06-18 11:51 ` Yicong Yang
2025-06-18 13:02 ` Leo Yan
2025-06-18 13:15 ` Arnaldo Carvalho de Melo
2025-06-18 14:44 ` Leo Yan
2025-06-16 17:41 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2dc510b4-ff3d-edff-42be-f8260cd27840@huawei.com \
--to=yangyicong@huawei.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alisaidi@amazon.com \
--cc=catalin.marinas@arm.com \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=james.morse@arm.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@arm.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=will@kernel.org \
--cc=yangjinqian1@huawei.com \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®