* [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue
@ 2023-09-01 3:50 Jijie Shao
2023-09-01 10:11 ` Jonathan Cameron
2023-09-06 6:26 ` Yicong Yang
0 siblings, 2 replies; 5+ messages in thread
From: Jijie Shao @ 2023-09-01 3:50 UTC (permalink / raw)
To: will, jonathan.cameron, mark.rutland, yangyicong, shaojijie
Cc: chenhao418, shenjian15, wangjie125, liuyonglong, linux-kernel,
linux-arm-kernel
From: Hao Chen <chenhao418@huawei.com>
hns3_pmu_select_filter_mode() includes A series of mode judgments such
as global mode ,function mode, function-queue mode, port mode, port-tc
mode.
For a special scenario:
command use parameter
perf stat -a -e hns3_pmu_sicl_0/bdf=0x3700,config=0x3,queue=0x0,
and hns3_pmu_is_enabled_func_mode() has a judgement as below:
if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_FUNC))
filter_support of event 0x3 hasn't set bit for func mode, so it can't
enter func-mode branch, and continue to func-queue mode judgement, port
judgement, port-tc mode, then enter port-tc mode.
It's not up to expectations, it shouldn't enter any modes but
return -ENOENT.
port-tc mode parameter show as below:
perf stat -a -e hns3_pmu_sicl_0/config=0x00001,port=0x0,tc=0x1
port-tc mode should use bdf parameter as 0, so, add judgement of
bdf parameter to fix it.
Signed-off-by: Hao Chen <chenhao418@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
changeLog:
v2: add more details in log message suggested by Will
v1 link: https://lore.kernel.org/all/20230816094619.3563784-1-shaojijie@huawei.com/
---
drivers/perf/hisilicon/hns3_pmu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
index e0457d84af6b..2aa9cb045705 100644
--- a/drivers/perf/hisilicon/hns3_pmu.c
+++ b/drivers/perf/hisilicon/hns3_pmu.c
@@ -998,12 +998,13 @@ static bool
hns3_pmu_is_enabled_port_tc_mode(struct perf_event *event,
struct hns3_pmu_event_attr *pmu_event)
{
+ u16 bdf = hns3_pmu_get_bdf(event);
u8 tc_id = hns3_pmu_get_tc(event);
if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_PORT_TC))
return false;
- return tc_id != HNS3_PMU_FILTER_ALL_TC;
+ return (tc_id != HNS3_PMU_FILTER_ALL_TC) && (!bdf);
}
static bool
--
2.30.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue
2023-09-01 3:50 [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue Jijie Shao
@ 2023-09-01 10:11 ` Jonathan Cameron
2023-09-04 3:10 ` chenhao (EZ)
2023-09-06 6:26 ` Yicong Yang
1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2023-09-01 10:11 UTC (permalink / raw)
To: Jijie Shao
Cc: will, mark.rutland, yangyicong, chenhao418, shenjian15,
wangjie125, liuyonglong, linux-kernel, linux-arm-kernel
On Fri, 1 Sep 2023 11:50:27 +0800
Jijie Shao <shaojijie@huawei.com> wrote:
> From: Hao Chen <chenhao418@huawei.com>
Mention which hisi pmu this is in the patch description (hns)
>
> hns3_pmu_select_filter_mode() includes A series of mode judgments such
includes a series
> as global mode ,function mode, function-queue mode, port mode, port-tc
> mode.
>
> For a special scenario:
> command use parameter
> perf stat -a -e hns3_pmu_sicl_0/bdf=0x3700,config=0x3,queue=0x0,
> and hns3_pmu_is_enabled_func_mode() has a judgement as below:
> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_FUNC))
>
> filter_support of event 0x3 hasn't set bit for func mode, so it can't
> enter func-mode branch, and continue to func-queue mode judgement, port
> judgement, port-tc mode, then enter port-tc mode.
>
> It's not up to expectations, it shouldn't enter any modes but
> return -ENOENT.
>
> port-tc mode parameter show as below:
> perf stat -a -e hns3_pmu_sicl_0/config=0x00001,port=0x0,tc=0x1
>
> port-tc mode should use bdf parameter as 0, so, add judgement of
> bdf parameter to fix it.
I don't follow the description here. As far as I can see from the code
the change just checks that BDF is not set before allowing a port based
filter.
>
> Signed-off-by: Hao Chen <chenhao418@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> changeLog:
> v2: add more details in log message suggested by Will
> v1 link: https://lore.kernel.org/all/20230816094619.3563784-1-shaojijie@huawei.com/
> ---
> drivers/perf/hisilicon/hns3_pmu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
> index e0457d84af6b..2aa9cb045705 100644
> --- a/drivers/perf/hisilicon/hns3_pmu.c
> +++ b/drivers/perf/hisilicon/hns3_pmu.c
> @@ -998,12 +998,13 @@ static bool
> hns3_pmu_is_enabled_port_tc_mode(struct perf_event *event,
> struct hns3_pmu_event_attr *pmu_event)
> {
> + u16 bdf = hns3_pmu_get_bdf(event);
> u8 tc_id = hns3_pmu_get_tc(event);
>
> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_PORT_TC))
> return false;
>
> - return tc_id != HNS3_PMU_FILTER_ALL_TC;
> + return (tc_id != HNS3_PMU_FILTER_ALL_TC) && (!bdf);
No need for brackets on !bdf
> }
>
> static bool
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue
2023-09-01 10:11 ` Jonathan Cameron
@ 2023-09-04 3:10 ` chenhao (EZ)
0 siblings, 0 replies; 5+ messages in thread
From: chenhao (EZ) @ 2023-09-04 3:10 UTC (permalink / raw)
To: Jonathan Cameron, Jijie Shao
Cc: will, mark.rutland, yangyicong, shenjian15, wangjie125,
liuyonglong, linux-kernel, linux-arm-kernel
On 2023/9/1 18:11, Jonathan Cameron wrote:
> On Fri, 1 Sep 2023 11:50:27 +0800
> Jijie Shao <shaojijie@huawei.com> wrote:
>
>> From: Hao Chen <chenhao418@huawei.com>
>
> Mention which hisi pmu this is in the patch description (hns)
>
>>
>> hns3_pmu_select_filter_mode() includes A series of mode judgments such
>
> includes a series
>
>> as global mode ,function mode, function-queue mode, port mode, port-tc
>> mode.
>>
>> For a special scenario:
>> command use parameter
>> perf stat -a -e hns3_pmu_sicl_0/bdf=0x3700,config=0x3,queue=0x0,
>> and hns3_pmu_is_enabled_func_mode() has a judgement as below:
>> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_FUNC))
>>
>> filter_support of event 0x3 hasn't set bit for func mode, so it can't
>> enter func-mode branch, and continue to func-queue mode judgement, port
>> judgement, port-tc mode, then enter port-tc mode.
>>
>> It's not up to expectations, it shouldn't enter any modes but
>> return -ENOENT.
>>
>> port-tc mode parameter show as below:
>> perf stat -a -e hns3_pmu_sicl_0/config=0x00001,port=0x0,tc=0x1
>>
>> port-tc mode should use bdf parameter as 0, so, add judgement of
>> bdf parameter to fix it.
>
> I don't follow the description here. As far as I can see from the code
> the change just checks that BDF is not set before allowing a port based
> filter.
Thanks for review.
Maybe I don't think about it completely.
For this patch, I only consider this scenario mentioned in patch and exactly filter out
port based mode, then enter port-tc based mode.
Actually port based mode also need this change for other scenarios, do you agree with it?
>
>>
>> Signed-off-by: Hao Chen <chenhao418@huawei.com>
>> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
>> ---
>> changeLog:
>> v2: add more details in log message suggested by Will
>> v1 link: https://lore.kernel.org/all/20230816094619.3563784-1-shaojijie@huawei.com/
>> ---
>> drivers/perf/hisilicon/hns3_pmu.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
>> index e0457d84af6b..2aa9cb045705 100644
>> --- a/drivers/perf/hisilicon/hns3_pmu.c
>> +++ b/drivers/perf/hisilicon/hns3_pmu.c
>> @@ -998,12 +998,13 @@ static bool
>> hns3_pmu_is_enabled_port_tc_mode(struct perf_event *event,
>> struct hns3_pmu_event_attr *pmu_event)
>> {
>> + u16 bdf = hns3_pmu_get_bdf(event);
>> u8 tc_id = hns3_pmu_get_tc(event);
>>
>> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_PORT_TC))
>> return false;
>>
>> - return tc_id != HNS3_PMU_FILTER_ALL_TC;
>> + return (tc_id != HNS3_PMU_FILTER_ALL_TC) && (!bdf);
>
> No need for brackets on !bdf
>
>> }
>>
>> static bool
>
> .
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue
2023-09-01 3:50 [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue Jijie Shao
2023-09-01 10:11 ` Jonathan Cameron
@ 2023-09-06 6:26 ` Yicong Yang
2023-09-06 7:39 ` chenhao (EZ)
1 sibling, 1 reply; 5+ messages in thread
From: Yicong Yang @ 2023-09-06 6:26 UTC (permalink / raw)
To: Jijie Shao, chenhao418
Cc: shenjian15, wangjie125, liuyonglong, linux-kernel,
linux-arm-kernel, will, jonathan.cameron, mark.rutland,
yangyicong
On 2023/9/1 11:50, Jijie Shao wrote:
> From: Hao Chen <chenhao418@huawei.com>
>
> hns3_pmu_select_filter_mode() includes A series of mode judgments such
> as global mode ,function mode, function-queue mode, port mode, port-tc
> mode.
>
> For a special scenario:
> command use parameter
> perf stat -a -e hns3_pmu_sicl_0/bdf=0x3700,config=0x3,queue=0x0,
> and hns3_pmu_is_enabled_func_mode() has a judgement as below:
> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_FUNC))
>
> filter_support of event 0x3 hasn't set bit for func mode, so it can't
> enter func-mode branch, and continue to func-queue mode judgement, port
> judgement, port-tc mode, then enter port-tc mode.
>
> It's not up to expectations, it shouldn't enter any modes but
> return -ENOENT.
>
> port-tc mode parameter show as below:
> perf stat -a -e hns3_pmu_sicl_0/config=0x00001,port=0x0,tc=0x1
>
> port-tc mode should use bdf parameter as 0, so, add judgement of
> bdf parameter to fix it.
>
Will the change here block the below unsupported case for event 0x3?
$ perf stat -a -e hns3_pmu_sicl_0/bdf=0x0,config=0x3,queue=0x0/
Otherwise you should handle this case.
> Signed-off-by: Hao Chen <chenhao418@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> changeLog:
> v2: add more details in log message suggested by Will
> v1 link: https://lore.kernel.org/all/20230816094619.3563784-1-shaojijie@huawei.com/
> ---
> drivers/perf/hisilicon/hns3_pmu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
> index e0457d84af6b..2aa9cb045705 100644
> --- a/drivers/perf/hisilicon/hns3_pmu.c
> +++ b/drivers/perf/hisilicon/hns3_pmu.c
> @@ -998,12 +998,13 @@ static bool
> hns3_pmu_is_enabled_port_tc_mode(struct perf_event *event,
> struct hns3_pmu_event_attr *pmu_event)
> {
> + u16 bdf = hns3_pmu_get_bdf(event);
> u8 tc_id = hns3_pmu_get_tc(event);
>
> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_PORT_TC))
> return false;
>
> - return tc_id != HNS3_PMU_FILTER_ALL_TC;
> + return (tc_id != HNS3_PMU_FILTER_ALL_TC) && (!bdf);
> }
>
> static bool
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue
2023-09-06 6:26 ` Yicong Yang
@ 2023-09-06 7:39 ` chenhao (EZ)
0 siblings, 0 replies; 5+ messages in thread
From: chenhao (EZ) @ 2023-09-06 7:39 UTC (permalink / raw)
To: Yicong Yang, Jijie Shao
Cc: shenjian15, wangjie125, liuyonglong, linux-kernel,
linux-arm-kernel, will, jonathan.cameron, mark.rutland,
yangyicong
On 2023/9/6 14:26, Yicong Yang wrote:
> On 2023/9/1 11:50, Jijie Shao wrote:
>> From: Hao Chen <chenhao418@huawei.com>
>>
>> hns3_pmu_select_filter_mode() includes A series of mode judgments such
>> as global mode ,function mode, function-queue mode, port mode, port-tc
>> mode.
>>
>> For a special scenario:
>> command use parameter
>> perf stat -a -e hns3_pmu_sicl_0/bdf=0x3700,config=0x3,queue=0x0,
>> and hns3_pmu_is_enabled_func_mode() has a judgement as below:
>> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_FUNC))
>>
>> filter_support of event 0x3 hasn't set bit for func mode, so it can't
>> enter func-mode branch, and continue to func-queue mode judgement, port
>> judgement, port-tc mode, then enter port-tc mode.
>>
>> It's not up to expectations, it shouldn't enter any modes but
>> return -ENOENT.
>>
>> port-tc mode parameter show as below:
>> perf stat -a -e hns3_pmu_sicl_0/config=0x00001,port=0x0,tc=0x1
>>
>> port-tc mode should use bdf parameter as 0, so, add judgement of
>> bdf parameter to fix it.
>>
>
> Will the change here block the below unsupported case for event 0x3?
>
> $ perf stat -a -e hns3_pmu_sicl_0/bdf=0x0,config=0x3,queue=0x0/
>
> Otherwise you should handle this case.
>
Yes, it can't block this scenario, this modify of judgement for bdf is not inappropriate.
I will think another scheme to handle this issue.
>> Signed-off-by: Hao Chen <chenhao418@huawei.com>
>> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
>> ---
>> changeLog:
>> v2: add more details in log message suggested by Will
>> v1 link: https://lore.kernel.org/all/20230816094619.3563784-1-shaojijie@huawei.com/
>> ---
>> drivers/perf/hisilicon/hns3_pmu.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
>> index e0457d84af6b..2aa9cb045705 100644
>> --- a/drivers/perf/hisilicon/hns3_pmu.c
>> +++ b/drivers/perf/hisilicon/hns3_pmu.c
>> @@ -998,12 +998,13 @@ static bool
>> hns3_pmu_is_enabled_port_tc_mode(struct perf_event *event,
>> struct hns3_pmu_event_attr *pmu_event)
>> {
>> + u16 bdf = hns3_pmu_get_bdf(event);
>> u8 tc_id = hns3_pmu_get_tc(event);
>>
>> if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_PORT_TC))
>> return false;
>>
>> - return tc_id != HNS3_PMU_FILTER_ALL_TC;
>> + return (tc_id != HNS3_PMU_FILTER_ALL_TC) && (!bdf);
>> }
>>
>> static bool
>>
> .
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-06 7:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01 3:50 [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue Jijie Shao
2023-09-01 10:11 ` Jonathan Cameron
2023-09-04 3:10 ` chenhao (EZ)
2023-09-06 6:26 ` Yicong Yang
2023-09-06 7:39 ` chenhao (EZ)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).