Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1176216rdb; Mon, 4 Sep 2023 05:36:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExQOJqKJKS4CKWVnY1MHf2FLnKbgwtEcPLS+P4fuitT3AbwXZgTydloxXPY4utZt3hRWJh X-Received: by 2002:a05:6a20:14d:b0:14b:f386:f6fb with SMTP id 13-20020a056a20014d00b0014bf386f6fbmr9814541pzs.35.1693830991257; Mon, 04 Sep 2023 05:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693830991; cv=none; d=google.com; s=arc-20160816; b=UtLdk5HXVTyZj9OkbZ280hOEAMmdqqXgXgyiSk47r8n7Kpwjwoz+k6vrWl1jQ+hlMn MKG5ZxI9PNr5fTXPipgeytc4K9GGxiXJAbwycGWurkIQhx/htz2/bU6QjgIGo2Xnb1L4 eSxxRryGFe7vBVkBfjDtL6VmlcAke01dvWn7CEl/CDW+lCE2BisDdO6FYGuHYrQOybSw STrBrwwKlcnZHoUtyXruQ0gF7P9v4Oq6mPF6EfHeE62nX4PtKS5uBCAEYhSP9oYZ3SlF cvc+W7/TjcJrmIv+wCWTPMivjE5YhjdCzxJ2KWtI7pPJDmvi2+3eMAU5V75n5Nl1cNlX yYCA== 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:cc:references:to :subject; bh=feS1iQaTGjZNN0bI4wAUBtQNO76N9wl1sOS47xHuUoE=; fh=3pkQdfvMTr0MPEyScH0nzJFCzvY7emmQnkXqCcZzGNU=; b=IXOvuSu8aRcERG3eZiSpRs6yNOS4EPH1oR3g+y2UCBXDoevz/EWXth5qW/lciAEV3m CAOaEH4z1H1aGzQefCBysuc1pZUQfRyndBSmfohk5HSFhq34/bdtWDXtfEh1g/wc2ww0 oFYUydOP0mxKAaYbuBGbaOVbV5ZmuHlHdispywoPm/iGcrBjM+AiAbja6sBCIoOwRVKe +BqjJ7jAZdTqRqJXM0l/nZQKu92QyA6PvfiNlZOLOZdfU879uSQyNbXpGJaMRBY4X98C h7hODbF+gaCinBpb/zsMHrtnk5D7rB58mRvXa2dAokVR4S/dWV8PG3EzDZ2vRiDEUUYD ShLw== 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 m129-20020a633f87000000b0056ad77ddd4csi7625503pga.438.2023.09.04.05.36.17; Mon, 04 Sep 2023 05:36:31 -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 S242537AbjIDDKM (ORCPT + 99 others); Sun, 3 Sep 2023 23:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjIDDKL (ORCPT ); Sun, 3 Sep 2023 23:10:11 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D84E9AF for ; Sun, 3 Sep 2023 20:10:05 -0700 (PDT) Received: from kwepemi500004.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RfD6k6tM6ztS8N; Mon, 4 Sep 2023 11:06:06 +0800 (CST) Received: from [10.67.121.37] (10.67.121.37) by kwepemi500004.china.huawei.com (7.221.188.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 4 Sep 2023 11:10:03 +0800 Subject: Re: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue To: Jonathan Cameron , Jijie Shao References: <20230901035027.3881389-1-shaojijie@huawei.com> <20230901111116.00006468@Huawei.com> CC: , , , , , , , From: "chenhao (EZ)" Message-ID: <84eacd1e-f259-4428-f722-f61695ede3ee@huawei.com> Date: Mon, 4 Sep 2023 11:10:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20230901111116.00006468@Huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.37] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500004.china.huawei.com (7.221.188.17) 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 18:11, Jonathan Cameron wrote: > 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. 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 >> 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 > > . >