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 98873C48BF6 for ; Mon, 26 Feb 2024 15:12:56 +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=N98G0zITQu5g5yoVv+PzOrkEiyz82HawbJWEQF9t0QE=; b=G0h9bJVAAffZdy zFY7vhhfFekeschXAvU8wTLHjYDscalJlzXnHVnyRusamc/rxlIL89mcrRgcvS9RTccWXmcpDhK0+ 4NePiw1/anXrL3HzwGWr6DkGWuOo+KGED3M48Utf7tzQ975I6d/8nGbOnB4tG6kztPKvx8B9XKuKe arZsrS1Gg7Bn0NanJwmGgftwONp4h0HOu3fuPB4PIt9dgtgqlZdOKtu+0o1CcuN88443a84vcVsoI qOOkW7W7q7usTpOof03VhPuSIm4kVJRzuLbDPpJbNjMQlAPmTAFHhgt1nGGBqZAWBPBuXDISf8ZFQ bKb5IAWd7jNY6gtVUMDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1receo-00000001Lpg-2F5O; Mon, 26 Feb 2024 15:12:42 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1recel-00000001Lnm-3kQs for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2024 15:12:41 +0000 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Tk3sr6BYxz6K7Gv; Mon, 26 Feb 2024 23:08:48 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 3CFE81400DB; Mon, 26 Feb 2024 23:12:32 +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_256_GCM_SHA384) id 15.1.2507.35; Mon, 26 Feb 2024 15:12:31 +0000 Date: Mon, 26 Feb 2024 15:12:30 +0000 From: Jonathan Cameron To: Yicong Yang CC: , , , , , , , , Subject: Re: [PATCH v2 3/8] drivers/perf: hisi_pcie: Fix incorrect counting under metric mode Message-ID: <20240226151230.00002654@Huawei.com> In-Reply-To: <20240223103359.18669-4-yangyicong@huawei.com> References: <20240223103359.18669-1-yangyicong@huawei.com> <20240223103359.18669-4-yangyicong@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: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240226_071240_194048_A96A9FCD X-CRM114-Status: GOOD ( 15.01 ) 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, 23 Feb 2024 18:33:54 +0800 Yicong Yang wrote: > From: Yicong Yang > > The metric counting shows incorrect results if the events in the > metric group using the same event but different filter options. > This is because we only judge the event code to decide whether > the event in the metric group should share the same hardware > counter, but ignore the settings of the filter. > > For example, on a platform of 2 ports 0x1 and 0x2 but only port > 0x1 has a downstream PCIe NVME device. The metric counting > shows both ports have the same counts because we misassign these > two events to one same hardware counter: > [root@localhost perf-iostat]# ./perf stat -e '{hisi_pcie0_core1/event=0x0104,port=0x2/,hisi_pcie0_core1/event=0x0104,port=0x1/}' > > Performance counter stats for 'system wide': > > 7907484924 hisi_pcie0_core1/event=0x0104,port=0x2/ > 7907484924 hisi_pcie0_core1/event=0x0104,port=0x1/ > > 10.153863691 seconds time elapsed > > Fix this by using the whole config rather than the event only > to judge whether two events are the same and should share the > same hardware counter. With this patch, the metric counting in > the above case tends to be corrected: > > [root@localhost perf-iostat]# ./perf stat -e '{hisi_pcie0_core1/event=0x0104,port=0x2/,hisi_pcie0_core1/event=0x0104,port=0x1/}' > > Performance counter stats for 'system wide': > > 0 hisi_pcie0_core1/event=0x0104,port=0x2/ > 8123122077 hisi_pcie0_core1/event=0x0104,port=0x1/ > > 10.152875631 seconds time elapsed > > Fixes: 8404b0fbc7fb ("drivers/perf: hisi: Add driver for HiSilicon PCIe PMU") > Signed-off-by: Yicong Yang Reviewed-by: Jonathan Cameron _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel