Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp298034rdb; Sat, 19 Aug 2023 02:05:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx2i0i5CP8N2M6j8QGOnk1G/P8rxrBJ1OGuIpZBS23Vw7afmcJZ4toyYrPD7whB2ObTWgn X-Received: by 2002:a05:6a20:938d:b0:13c:bda3:79c3 with SMTP id x13-20020a056a20938d00b0013cbda379c3mr2260325pzh.4.1692435945393; Sat, 19 Aug 2023 02:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692435945; cv=none; d=google.com; s=arc-20160816; b=oTUAH407E4C7tkUfieTAwWYwUk7RZFfwHSSIVdWDydAcedgFJeTcPl15hJA1G7rI3W VIpfZ/MYse7AQhM1+a6Vl1VJTuJ9ck3h8tii6WWRXPWqbJwYqSpDfgRRuYjQVIR8rbCH mzaAgZVc7wRVaJyY6PIhCP5v1D8VzCdI63kWC+YKb6KNLTh3iGeTLToy4dqN9he4TeHX 7WyJ6h8Tl1vIfSENMe0j+f41fowlqUogn0dDH4DGEjrd/Uv1YYTBKaRu4hk13mXCZkV8 Lb6cgc1yQ5a0DHFfm7EKt2/+sBaNOdcr5wKefIRMrbXdz6gZ/jYXtQ8bvlTPFKmAkncz BulA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Er9TpC9E763aYUFOviWAekdGRu3l1wDDguQJPA93oAQ=; fh=8QLVBfcgYX2G5GgfR2zvRwpe6AMsW+pFzXducbfrh6A=; b=yZhUE4rJu5r7+DggsYAFgpu97QLPVdB6H+qM+pcYvhfTFs5IHI3Xd/fQF+BquMt1kT Z1jW4dC+Cv75FX2N/S5HUeKnNd9DQ82zUs2DyyjlePRM5awIXlW93dcDr3/GZsTj4QlC N2McZcI+R4vNE1stjz6hkF1sfhSpvUzs9PvC2hQb/P22iu2gmmLiXROrVz1GGMY0b5pz yXH9k/FQCUGgvi0vZSje8hhLpA2mAZw5p+gIzf/iXaVHtJKN/TK6/Vi15ytxuxzdMp82 MjcuORyLlE2Soz1aEyU29kqut2HCMzpWMHOj9y1RLny7uTW8vYA0bpHalZNObZ6HnXsk IkpQ== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v185-20020a6389c2000000b00565e9707d06si3028058pgd.18.2023.08.19.02.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 02:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 911331B339; Sat, 19 Aug 2023 01:26:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243517AbjHPJu0 (ORCPT + 99 others); Wed, 16 Aug 2023 05:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243587AbjHPJt5 (ORCPT ); Wed, 16 Aug 2023 05:49:57 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0A226B7 for ; Wed, 16 Aug 2023 02:49:51 -0700 (PDT) Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RQjxn2QmCz1GDWZ; Wed, 16 Aug 2023 17:48:29 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 16 Aug 2023 17:49:49 +0800 From: Jijie Shao To: , , CC: , , , , , , Subject: [PATCH drivers/perf: hisi: 2/2] drivers/perf: hisi: fix set wrong filter mode for running events issue Date: Wed, 16 Aug 2023 17:46:19 +0800 Message-ID: <20230816094619.3563784-3-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230816094619.3563784-1-shaojijie@huawei.com> References: <20230816094619.3563784-1-shaojijie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 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 "bdf=0x3700,config=0x3, queue=0x0", it is expected to enter function-queue mode, but event of config 0x3 doesn't support func-queue mode, then it enter port-tc mode. it's not up to expectations. It shouldn't enter any modes but return -ENOENT. So, add judgement of bdf parameter to fix it. Fixes: 66637ab137b4 ("drivers/perf: hisi: add driver for HNS3 PMU") Signed-off-by: Hao Chen Signed-off-by: Jijie Shao --- 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 6a4d04cbae91..7f38a9e489d4 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -1000,12 +1000,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