From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Yushan Wang <wangyushan12@huawei.com>
Cc: <will@kernel.org>, <mark.rutland@arm.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <prime.zeng@hisilicon.com>,
<fanghao11@huawei.com>, <linuxarm@huawei.com>,
<yangyicong@hisilicon.com>
Subject: Re: [PATCH 1/8] drivers/perf: hisi: Relax the event ID check in the framework
Date: Thu, 31 Jul 2025 13:15:03 +0100 [thread overview]
Message-ID: <20250731131503.0000740f@huawei.com> (raw)
In-Reply-To: <20250729153823.2026154-2-wangyushan12@huawei.com>
On Tue, 29 Jul 2025 23:38:16 +0800
Yushan Wang <wangyushan12@huawei.com> wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
>
> Event ID is only using the attr::config bit [7, 0] but we check the
> event range using the whole 64bit field. It blocks the usage of the
> resident field of attr::config. Relax the check by only using the
> bit [7, 0].
>
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> Signed-off-by: Yushan Wang <wangyushan12@huawei.com>
Reviewed-by: Jonathan Csmeron <Jonathan.Cameron@huawei.com>
This seems sensible clean up even without the rest of the series.
> ---
> drivers/perf/hisilicon/hisi_uncore_pmu.c | 2 +-
> drivers/perf/hisilicon/hisi_uncore_pmu.h | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
> index ef058b1dd509..3050899ddf17 100644
> --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
> +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
> @@ -234,7 +234,7 @@ int hisi_uncore_pmu_event_init(struct perf_event *event)
> return -EINVAL;
>
> hisi_pmu = to_hisi_pmu(event->pmu);
> - if (event->attr.config > hisi_pmu->check_event)
> + if ((event->attr.config & HISI_EVENTID_MASK) > hisi_pmu->check_event)
> return -EINVAL;
>
> if (hisi_pmu->on_cpu == -1)
> diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.h b/drivers/perf/hisilicon/hisi_uncore_pmu.h
> index f4fed2544877..50a97e79076a 100644
> --- a/drivers/perf/hisilicon/hisi_uncore_pmu.h
> +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.h
> @@ -43,7 +43,8 @@
> return FIELD_GET(GENMASK_ULL(hi, lo), event->attr.config); \
> }
>
> -#define HISI_GET_EVENTID(ev) (ev->hw.config_base & 0xff)
> +#define HISI_EVENTID_MASK 0xff
> +#define HISI_GET_EVENTID(ev) ((ev)->hw.config_base & HISI_EVENTID_MASK)
>
> #define HISI_PMU_EVTYPE_BITS 8
> #define HISI_PMU_EVTYPE_SHIFT(idx) ((idx) % 4 * HISI_PMU_EVTYPE_BITS)
next prev parent reply other threads:[~2025-07-31 12:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 15:38 [PATCH 0/8] Updates of HiSilicon Uncore L3C PMU Yushan Wang
2025-07-29 15:38 ` [PATCH 1/8] drivers/perf: hisi: Relax the event ID check in the framework Yushan Wang
2025-07-31 12:15 ` Jonathan Cameron [this message]
2025-07-29 15:38 ` [PATCH 2/8] drivers/perf: hisi: Export hisi_uncore_pmu_isr() Yushan Wang
2025-07-31 12:15 ` Jonathan Cameron
2025-07-29 15:38 ` [PATCH 3/8] drivers/perf: hisi: Simplify the probe process of each L3C PMU version Yushan Wang
2025-07-31 12:17 ` Jonathan Cameron
2025-07-29 15:38 ` [PATCH 4/8] drivers/perf: hisi: Extract the event filter check of L3C PMU Yushan Wang
2025-07-31 12:20 ` Jonathan Cameron
2025-07-29 15:38 ` [PATCH 5/8] drivers/perf: hisi: Extend the field of tt_core Yushan Wang
2025-07-31 12:21 ` Jonathan Cameron
2025-07-29 15:38 ` [PATCH 6/8] drivers/perf: hisi: Refactor the event configuration of L3C PMU Yushan Wang
2025-07-31 12:25 ` Jonathan Cameron
2025-07-29 15:38 ` [PATCH 7/8] drivers/perf: hisi: Add support for L3C PMU v3 Yushan Wang
2025-07-31 12:45 ` Jonathan Cameron
2025-07-29 15:38 ` [PATCH 8/8] Documentation: hisi-pmu: Add introduction to HiSilicon V3 PMU Yushan Wang
2025-07-31 12:47 ` Jonathan Cameron
2025-08-01 9:49 ` Yicong Yang
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=20250731131503.0000740f@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=fanghao11@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=prime.zeng@hisilicon.com \
--cc=wangyushan12@huawei.com \
--cc=will@kernel.org \
--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®