From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 538A7CA0FE1 for ; Fri, 1 Sep 2023 10:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2uVi5dcr9DpX/vn6RVV0FvlY1fHTDvrurjkBc1WHoHg=; b=D+7hPMHIwN3gpy /h32rgSbhzcX57Ru0E7Oy1eGikOtOz948iJdMbDImR+J4Udv8ETQbfJ7aV0yNgqmvKUa19zQomHcE xC+AbP7O9a0whX2Mk7VygJZc2R4veYeXdxd8UzvCulpR4XN/96mA+KLjsD1opwELu3uPUXe0njQCc XuoVd+A1tROro+e0UkrvW4CjDNJl4nGGKzOQZr4uFZF5318nLJJo++nR6+M4oKNp/n895s6VwvL5/ qjmlkkRdfyYQyA49wIQaQHXJPgU/PAS3evUN1SRDH2XaUA2mBFyHYuSOTlgDiN+5x7DnHHbBqVZkJ g3vNyuLrwDrDHA7iQffQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qc17n-00GoLv-0x; Fri, 01 Sep 2023 10:11:35 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qc17h-00GoJ9-2A for linux-arm-kernel@lists.infradead.org; Fri, 01 Sep 2023 10:11:33 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RcYb42GCnz6FGVs; Fri, 1 Sep 2023 18:06:24 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 11:11:17 +0100 Date: Fri, 1 Sep 2023 11:11:16 +0100 From: Jonathan Cameron To: Jijie Shao CC: , , , , , , , , Subject: Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue Message-ID: <20230901111116.00006468@Huawei.com> In-Reply-To: <20230901035027.3881389-1-shaojijie@huawei.com> References: <20230901035027.3881389-1-shaojijie@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230901_031129_878124_8DAEBD78 X-CRM114-Status: GOOD ( 21.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 1 Sep 2023 11:50:27 +0800 Jijie Shao wrote: > From: Hao Chen 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 > Signed-off-by: Jijie Shao > --- > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AB51CA0FE6 for ; Fri, 1 Sep 2023 10:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346050AbjIAKL0 (ORCPT ); Fri, 1 Sep 2023 06:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231719AbjIAKLY (ORCPT ); Fri, 1 Sep 2023 06:11:24 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82B31B2 for ; Fri, 1 Sep 2023 03:11:20 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RcYb42GCnz6FGVs; Fri, 1 Sep 2023 18:06:24 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 11:11:17 +0100 Date: Fri, 1 Sep 2023 11:11:16 +0100 From: Jonathan Cameron To: Jijie Shao CC: , , , , , , , , Subject: Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue Message-ID: <20230901111116.00006468@Huawei.com> In-Reply-To: <20230901035027.3881389-1-shaojijie@huawei.com> References: <20230901035027.3881389-1-shaojijie@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 1 Sep 2023 11:50:27 +0800 Jijie Shao wrote: > From: Hao Chen 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 > Signed-off-by: Jijie Shao > --- > 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