Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp2381734rdb; Wed, 6 Sep 2023 03:06:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkw3rX4L3dlPh7SwqGHVHR62c1Oubnu56WL+OXCJYR5ooYpjcnQdidSgDyQrubbvRv7EyK X-Received: by 2002:aa7:d790:0:b0:52a:6497:d02b with SMTP id s16-20020aa7d790000000b0052a6497d02bmr2021489edq.16.1693994802698; Wed, 06 Sep 2023 03:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693994802; cv=none; d=google.com; s=arc-20160816; b=x6e4VqebViltsGQoslURs4dEeAp8RjQkPYygEdgOQG8xZ+6su5Ae9XQyK0jmNFfVFt /6S07Fc0b/vYok2iYXNZl9QmtaDw5WZF/If4/aDd9Qi5Rul854lRC57nlqhpx3XJP9ys dyzGlvGsofpgONWeqVU/V9I1FVrBAcfAt+Lll/h/gzTIsmjIPFqQ81vQvTYm0BkpPYiF BHhYTRrxVbesJi7I473hmiQEgj+Kzj27sP2S/KanMwSBgQjEAXHUPUlSCZi7mtsTbVhY OW5nmLKeuSSVWyTtToGR7axWUdOWJxtvJWkSDgR054sYu73eOA98SUkgKd6oFqObikHJ /Ldg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :cc; bh=TUJuDYtpeMgPVk0M8LbN8rKt/erkZj9fvdfUD1/sIC4=; fh=W28yVZ0dUTCPG8X/jjUyCFKdS2jTpuRx7DTpFFKIzyA=; b=a3bDh35+pIpyel66nTMCiKTsict+SLzpamcnFHR+dzqBOjyDYY+71JwG3mGFa8k2JI GKplId9VBeNOZdEytleJAbi2N26Rad5LHUSSBW5cm9n6k7nILZNepyNLrYeyIaGITl0z zPw0cPS/2wfBpy/m9A4OPTFsLUUTIIBfRizxaR0PKmS0CTmWD68kV4ES5h0TjN7xOiTj hjSVGLkXHxdddBSu3jf83k6PVlE1m1dldlif7dr4tx1OnyAgzhTsF2x947XCGo6bh+gD ND1nndYr3/XK9zi2ea/ZY/dg+LNdAnjCWyzJe4kiJvToS67dS71p4DwZ1rKCXtLWSaKK VTsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020aa7d70b000000b0052337ed4c3bsi9389864edq.151.2023.09.06.03.06.13; Wed, 06 Sep 2023 03:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240448AbjIFG0y (ORCPT + 99 others); Wed, 6 Sep 2023 02:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjIFG0u (ORCPT ); Wed, 6 Sep 2023 02:26:50 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7445197 for ; Tue, 5 Sep 2023 23:26:45 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RgXNf2zTPzhZDx; Wed, 6 Sep 2023 14:22:42 +0800 (CST) Received: from [10.67.121.177] (10.67.121.177) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 6 Sep 2023 14:26:41 +0800 CC: , , , , , , , , Subject: Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue To: Jijie Shao , References: <20230901035027.3881389-1-shaojijie@huawei.com> From: Yicong Yang Message-ID: Date: Wed, 6 Sep 2023 14:26:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20230901035027.3881389-1-shaojijie@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.177] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/9/1 11:50, Jijie Shao wrote: > From: Hao Chen > > 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 > 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); > } > > static bool >