Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1376453rbb; Mon, 26 Feb 2024 07:27:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXp9+WUoCOeBkWFzkJoaC3ib6yzkqDb3+gzwjXippsTzOs1l93tHthmJVfBp0irP06H1vM22Ha2I9Q3xW/MApwxtMz47EA9lLRTi3Ghig== X-Google-Smtp-Source: AGHT+IHt4OP0nByXtfS+sIcNw/nY/xYz4BxfSx2kLe3AYFoQiZr7QNMzoRXMJepWwE6QCPLRECjg X-Received: by 2002:a05:6a21:1743:b0:1a0:f5d7:5f52 with SMTP id nw3-20020a056a21174300b001a0f5d75f52mr3975258pzb.20.1708961242038; Mon, 26 Feb 2024 07:27:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708961242; cv=pass; d=google.com; s=arc-20160816; b=hkU0459htICRnN2aHSIMgRFmXHUrwuM+y7N0A7cjH5rG8LXvtVQpMRnCTFoBmIpw47 uLtQlnqBarNhiu71R8PYGL/KUO84Hqo9eAOF1FiZN28FomUbqx/cRSgPFBKiWHNkCf9s n/SIbIcg31NlKopMNNmVQ6bikNNfMx/8xpmF6RYoCoIbzuX2hZol+aA8gJUJIg2N6gMh ot4yMGYMOadQsT7AjwFvr5hlCM1SqqYwZQ9kFWq9pyLJ+IdxOr/kD5hq3T1w0Q8gj836 rLCDMlyTInHvb2dFNfRZ9MBFdsNn7ZVv9TtQKwMLSGB3WNHL5V1STOnf5tPujGSyuqE9 YVog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=esc3Bfaeh7DquXiCMRcz4Rn4A+MfzVOeiHxxv7vOxjQ=; fh=CSJaGuChrpWdJ0Q6/VaYsWAN0wo7uO/W+ZOtSBE/1do=; b=0wGUYwc19CEfBPRWmddXTDcet7+O8ekvseCa94jT1M9BwYhs4E6HrkIXe0xy6lKZFw aofrFLVFmZ0SSYq91WA8sq2W8gwJ9gMxDvEQXyiHXLoYTvKUSSGifxMF3zCrsILAhw1b bhc5ZfwPd0D2fnYeRFGRaKQeZ/MjE9aYGCwH40yAafuN57c808zeLDSH3iIVM4YIcSuu jyyEsQCd6oOWjh3yuGHfpMEs/ZGt0gVBrJuxam+qG6Ngsw8kY2KkUNV+7n8XNGqh6FYK rKMZn+iWFVHKadtoYlzX1SKuYMVP13SEMJKLgfao43hucExvgwXPxj4NvRl4VITTK9UQ n04g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-81768-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id v1-20020a63f841000000b005dcab90d688si3834753pgj.526.2024.02.26.07.27.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:27:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81768-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-81768-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E5CC629E705 for ; Mon, 26 Feb 2024 15:18:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2392112AAD0; Mon, 26 Feb 2024 15:12:38 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98B0D60B87 for ; Mon, 26 Feb 2024 15:12:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960357; cv=none; b=Z0V1SozY1iBmphtUdC2veQUZ1WlFJGnfkVKD92CoM9pwMzW+c/AsNohXq8UAV/5IgfkBrtDWYVzrLWuquWXvbH7JbNbGMU+mYcn20IpSiWh6xhhCCNvjdq0JuA8XdZOnuBfZfMWkLbLawnk/mVyxyTsBnu0dzSIcbKEa7h6TOl0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960357; c=relaxed/simple; bh=tGT7qj9x4O/x8Xg+FUY+hV9nQjfCdZHO4iZ/+Lortng=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CEh8wpyV4bju/qv6Jbz7HBFiyj7Q9I8I4PKSGmyGQ++30Oe1RVRMhTmVFEgRECD09oDWHWK73zr6PNaUw8ztgX85oSZpKPy+snR4r0os7pjrEWKokaibGa24c+INI2WBKUVLkn/ZopG+BdCzAJsb5AJtAxvDz5tXw3NDouG3dL0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) 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