From patchwork Wed Aug 16 09:46:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jijie Shao X-Patchwork-Id: 13354813 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 AED3CC001DF for ; Wed, 16 Aug 2023 09:50:29 +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:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mt0VcICgXKsrWQGgGWLk4s805K9aSHf/WCF+GI16HBo=; b=ynCTswz21tkdfn Sx+Z3g1c7u6Kh2jipkhat5w/tP5CURC4Fz1XY25it9SX8D+BVko8lqt+FClshZ4Zqx1VOOjcGpBoW muYQOzU8x4DO0UhjsK29YFgyB75GdmxKCq+pzSmBn+Qxpn7tFD9bmoCVmrJiN6ZiY9n729SGQnXJK +QQB1pedAQ1zpnQtuYz2Z6SzaeEBXCu6rCNzgncK9YNVHllG006XUReTDIitlaamm7Gvyj9D/HzcX WPXdACCE506r/7cX0aMRfmv3zcLLCkebtmvNENkpHDONv0ocq2e//tRSnA3xW8y6RKpIwntrJXuSd kLXlKPRMzgS3xZckgsrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWDAB-003evF-0c; Wed, 16 Aug 2023 09:50:03 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWDA1-003esh-2w for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 09:49:55 +0000 Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RQjvv4NLwzFqbx; Wed, 16 Aug 2023 17:46:51 +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:48 +0800 From: Jijie Shao To: , , CC: , , , , , , Subject: [PATCH drivers/perf: hisi: 1/2] drivers/perf: hisi: hns3: default use hardware event 0 as group leader event. Date: Wed, 16 Aug 2023 17:46:18 +0800 Message-ID: <20230816094619.3563784-2-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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_024954_175731_0B848E8B X-CRM114-Status: GOOD ( 13.79 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Hao Chen For hns3 pmu events, we use command as below before: perf stat -g -e hns3_pmu_sicl_0/config=0x00105,global=1/ -e hns3_pmu_sicl_0/config=0x10105,global=1/ -I 1000 We want to use -g parameter to make 0x00105 event and 0x10105 event share a hardware event, but for kernel 6.2, 'commit 5f8f95673f68 ("perf evlist: Remove group option.")' remove -g parameter. So add this patch to set default related event idx as 0 to share the first hardware event. The new command shows as below: perf stat -e hns3_pmu_sicl_0/config=0x00105,global=1/ -e hns3_pmu_sicl_0/config=0x10105,global=1/ -I 1000 Fixes: 5f8f95673f68 ("perf evlist: Remove group option.") Signed-off-by: Hao Chen Signed-off-by: Jijie Shao --- drivers/perf/hisilicon/hns3_pmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c index e0457d84af6b..6a4d04cbae91 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -796,9 +796,11 @@ static int hns3_pmu_find_related_event_idx(struct hns3_pmu *hns3_pmu, if (!hns3_pmu_cmp_event(sibling, event)) continue; - /* Related events is used in group */ + /* Related events is used in group, else we use index 0 event as related event */ if (sibling->group_leader == event->group_leader) return idx; + else + return 0; } /* No related event and all hardware events are used up */