diff mbox series

[4/5] hwtracing: hisi_ptt: Don't try to attach a task

Message ID 20230809081825.11518-5-yangyicong@huawei.com (mailing list archive)
State Superseded
Headers show
Series Several updates for PTT driver | expand

Commit Message

Yicong Yang Aug. 9, 2023, 8:18 a.m. UTC
From: Yicong Yang <yangyicong@hisilicon.com>

PTT is an uncore PMU and shouldn't be attached to any task. Block
the usage in pmu::event_init().

Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 drivers/hwtracing/ptt/hisi_ptt.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jonathan Cameron Aug. 25, 2023, 11:25 a.m. UTC | #1
On Wed, 9 Aug 2023 16:18:24 +0800
Yicong Yang <yangyicong@huawei.com> wrote:

> From: Yicong Yang <yangyicong@hisilicon.com>
> 
> PTT is an uncore PMU and shouldn't be attached to any task. Block
> the usage in pmu::event_init().
> 
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>

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

> ---
>  drivers/hwtracing/ptt/hisi_ptt.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
> index 3aba7bb6e548..916686c6a9c8 100644
> --- a/drivers/hwtracing/ptt/hisi_ptt.c
> +++ b/drivers/hwtracing/ptt/hisi_ptt.c
> @@ -1003,6 +1003,9 @@ static int hisi_ptt_pmu_event_init(struct perf_event *event)
>  		return -EOPNOTSUPP;
>  	}
>  
> +	if (event->attach_state & PERF_ATTACH_TASK)
> +		return -EOPNOTSUPP;
> +
>  	if (event->attr.type != hisi_ptt->hisi_ptt_pmu.type)
>  		return -ENOENT;
>
diff mbox series

Patch

diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
index 3aba7bb6e548..916686c6a9c8 100644
--- a/drivers/hwtracing/ptt/hisi_ptt.c
+++ b/drivers/hwtracing/ptt/hisi_ptt.c
@@ -1003,6 +1003,9 @@  static int hisi_ptt_pmu_event_init(struct perf_event *event)
 		return -EOPNOTSUPP;
 	}
 
+	if (event->attach_state & PERF_ATTACH_TASK)
+		return -EOPNOTSUPP;
+
 	if (event->attr.type != hisi_ptt->hisi_ptt_pmu.type)
 		return -ENOENT;