mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>, <robin.murphy@arm.com>,
	<yangyicong@huawei.com>, <liuyonglong@huawei.com>,
	<wanghuiqiang@huawei.com>, <prime.zeng@hisilicon.com>,
	<hejunhao3@h-partners.com>
Subject: Re: [PATCH v2 1/9] drivers/perf: hisi: Relax the event ID check in the framework
Date: Tue, 26 Aug 2025 14:03:29 +0100	[thread overview]
Message-ID: <20250826140329.0000146c@huawei.com> (raw)
In-Reply-To: <20250821135049.2010220-2-wangyushan12@huawei.com>

On Thu, 21 Aug 2025 21:50:41 +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
> rest 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>

Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>

One comment inline but up to you whether you act on it.

> ---
>  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 a449651f79c9..6594d64b03a9 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 777675838b80..6186b232f454 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

I'd use GENMASK(7, 0) here but this one is obvious enough that it's not important
and clearly you are just moving the definition.

> +#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)


  reply	other threads:[~2025-08-26 13:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21 13:50 [PATCH v2 0/9] Updates of HiSilicon Uncore L3C PMU Yushan Wang
2025-08-21 13:50 ` [PATCH v2 1/9] drivers/perf: hisi: Relax the event ID check in the framework Yushan Wang
2025-08-26 13:03   ` Jonathan Cameron [this message]
2025-08-21 13:50 ` [PATCH v2 2/9] drivers/perf: hisi: Export hisi_uncore_pmu_isr() Yushan Wang
2025-08-26 13:03   ` Jonathan Cameron
2025-08-21 13:50 ` [PATCH v2 3/9] drivers/perf: hisi: Simplify the probe process of each L3C PMU version Yushan Wang
2025-08-26 13:06   ` Jonathan Cameron
2025-08-21 13:50 ` [PATCH v2 4/9] drivers/perf: hisi: Extract the event filter check of L3C PMU Yushan Wang
2025-08-26 13:06   ` Jonathan Cameron
2025-08-21 13:50 ` [PATCH v2 5/9] drivers/perf: hisi: Extend the field of tt_core Yushan Wang
2025-08-26 13:07   ` Jonathan Cameron
2025-08-21 13:50 ` [PATCH v2 6/9] drivers/perf: hisi: Refactor the event configuration of L3C PMU Yushan Wang
2025-08-26 13:08   ` Jonathan Cameron
2025-08-21 13:50 ` [PATCH v2 7/9] drivers/perf: hisi: Add support for L3C PMU v3 Yushan Wang
2025-08-26 13:12   ` Jonathan Cameron
2025-08-27  6:21     ` wangyushan
2025-08-27  3:43   ` Yicong Yang
2025-08-27  7:07     ` wangyushan
2025-08-21 13:50 ` [PATCH v2 8/9] Documentation: hisi-pmu: Fix of minor format error Yushan Wang
2025-08-26 13:21   ` Jonathan Cameron
2025-08-27  2:15   ` Yicong Yang
2025-08-21 13:50 ` [PATCH v2 9/9] Documentation: hisi-pmu: Add introduction to HiSilicon Yushan Wang
2025-08-26 13:22   ` Jonathan Cameron
2025-08-27  2:27   ` Yicong Yang
2025-08-27  7:22     ` wangyushan

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=20250826140329.0000146c@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=hejunhao3@h-partners.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=robin.murphy@arm.com \
    --cc=wanghuiqiang@huawei.com \
    --cc=wangyushan12@huawei.com \
    --cc=will@kernel.org \
    --cc=yangyicong@huawei.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®