mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@huawei.com>
To: Jijie Shao <shaojijie@huawei.com>, <chenhao418@huawei.com>
Cc: <shenjian15@huawei.com>, <wangjie125@huawei.com>,
	<liuyonglong@huawei.com>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <will@kernel.org>,
	<jonathan.cameron@huawei.com>, <mark.rutland@arm.com>,
	<yangyicong@hisilicon.com>
Subject: Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue
Date: Wed, 6 Sep 2023 14:26:40 +0800	[thread overview]
Message-ID: <a2111bbf-4d40-2112-6f3a-86c152e7ee0b@huawei.com> (raw)
In-Reply-To: <20230901035027.3881389-1-shaojijie@huawei.com>

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
> 

  parent reply	other threads:[~2023-09-06  6:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  3:50 Jijie Shao
2023-09-01 10:11 ` Jonathan Cameron
2023-09-04  3:10   ` chenhao (EZ)
2023-09-06  6:26 ` Yicong Yang [this message]
2023-09-06  7:39   ` chenhao (EZ)

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=a2111bbf-4d40-2112-6f3a-86c152e7ee0b@huawei.com \
    --to=yangyicong@huawei.com \
    --cc=chenhao418@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=wangjie125@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®