From patchwork Sun Feb 4 07:45:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 196450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp241077dyb; Sat, 3 Feb 2024 23:51:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxkwm1dmFI54HpSshIcqixpJqt0ThL/Sjb6v75TwkokoVeGvTNnQBFWLBWLENrzttOtXnb X-Received: by 2002:a05:690c:d8d:b0:5ff:f176:9fd3 with SMTP id da13-20020a05690c0d8d00b005fff1769fd3mr9311854ywb.4.1707033082022; Sat, 03 Feb 2024 23:51:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707033081; cv=pass; d=google.com; s=arc-20160816; b=lyRZAJp7EgPr7D1WwEPe2+povjR32T/d4DbZY6/xBvllvUR/tZJMPcdQRcVRUSuPLF RSeaqJfmt6PWNcY3lnchhjg6no1xjmVoTp2W3ePb0cdWI7IcQl04rrJQ/Gg6v5Y8jbNy kzTnMw0J6+sySMdBeqeqkRDbALCIE9sTr1ghFzVdn0sBP3Zzk6e7MdsyaEYAhFLSMJbz BMGOWiq/Ji7FLc7jfEdgQFuCNVDmKyJBcjuZrYKG7Ooooy9S8cGJm3geidmz+BPlqCNy wLnQ7tIoOiiGPtli1kMXMon7qIQL7TovNW9SV3jmyeE9byBYmbC1quJvDDLtNE1R30oH rc3Q== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=yd9LHpKxxgxQhhP4NQAWHY6FAn1Q1Z/zrmntIMfLdsI=; fh=Sg78E12B8CCjb3A8rbR1i/kR+YqRBlNvQYG1Fzoe4Pw=; b=KH+MIB2RLh+sPzgNf3bhCovmq6SGnMfWDZKeGX+5riqOxx910YHRa8OCdi23nqHyZv 488xqqpT+QZEsFClNkLHNvyOWnjU/QS+/+LKcsfso+sBFn5myvcjJhewm9GMyIIpumJa gqkfWIx0duAenogAmOyuYy1r9Bqe2d/ja9FUzwpbBPY78iM1fYrZmcgYmDayZILRZ2r6 jwzVfxNY5E3Yq0m5PCtl/KCMcIlzHdVZc+ggUKeYFXnLr3SNADpHPT8e6GwIgQUDWnJg ppWBHsHNeyx2lLdeYHsxeDtQMr9SuSUN1J/re5ynUxMaYbjeAqYStLKIIf/MIgeCQ9Uz u8Nw==; 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-51506-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51506-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCXfMZNuAzWITi6YO+Dn5/ZPEWhHyP/SbyrQnfHbSRngxY9bHty9+bBkwWGt3fWjMx8U4Xxf78n8kfb7CU1IW1D6NgTeDg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d16-20020a63fd10000000b005cd786d8e3bsi4223202pgh.249.2024.02.03.23.51.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:51:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51506-ouuuleilei=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-51506-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51506-ouuuleilei=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 661BB285066 for ; Sun, 4 Feb 2024 07:51:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 498BC14297; Sun, 4 Feb 2024 07:49:46 +0000 (UTC) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 C956D134D3 for ; Sun, 4 Feb 2024 07:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032984; cv=none; b=dIVzENyrpnq2/GcH3GFt4FDIxE4YyfIZROWO3lideCJXvwOFzzdjGk/zJJejF3yZSVnT0caOLJxIrlJz0HSMZtta11JNOQpTx2lDrKnWBl8HcIcV2V/+lHBOmQLByP1u2Zk5zeY93Y4WchSSTFsIFMcHlyOCidV/fBiBMLSubiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032984; c=relaxed/simple; bh=fXY6v3dlHX7XEig/rjz/9i1sF+CRbwLSuen9ujNtZtk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hOrqB3sM/vyaTzfxtBWu7W6+iKfQOWaSKNONnzF4d2hll6dDOzE7HYprAVfxk2pmf5pljtzltXtNREzCRzNncYCvgynMfP3C+7Mkiy1S1Ujy8ywllJfKWOj9iaQGLP4BwBQQDVAGfO6TQGh2ZLkeAQ8V6sC7I4lZLIYeEt3X9Bg= 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=45.249.212.32 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.19.163.44]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4TSM8h3fjfz1vt7q; Sun, 4 Feb 2024 15:49:08 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 4A44A1404D8; Sun, 4 Feb 2024 15:49:35 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:35 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 2/7] drivers/perf: hisi_pcie: Fix incorrect counting under metric mode Date: Sun, 4 Feb 2024 15:45:22 +0800 Message-ID: <20240204074527.47110-3-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789953921106762199 X-GMAIL-MSGID: 1789953921106762199 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 --- drivers/perf/hisilicon/hisi_pcie_pmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index 11a819cd07f2..9623bed93876 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -314,10 +314,15 @@ static bool hisi_pcie_pmu_valid_filter(struct perf_event *event, return true; } +/* + * Check Whether two events share the same config. The same config means not + * only the event code, but also the filter settings of the two events are + * the same. + */ static bool hisi_pcie_pmu_cmp_event(struct perf_event *target, struct perf_event *event) { - return hisi_pcie_get_real_event(target) == hisi_pcie_get_real_event(event); + return hisi_pcie_pmu_get_filter(target) == hisi_pcie_pmu_get_filter(event); } static bool hisi_pcie_pmu_validate_event_group(struct perf_event *event) From patchwork Sun Feb 4 07:45:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 196449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp241069dyb; Sat, 3 Feb 2024 23:51:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFG0cbr6sAzIo60EBVRm/oOFhjd27033m5+PO5+ttEWi9mQYE8D3W70yc+UHifddr9kXfvx X-Received: by 2002:a05:6808:2202:b0:3be:41c1:26d9 with SMTP id bd2-20020a056808220200b003be41c126d9mr15434040oib.31.1707033081392; Sat, 03 Feb 2024 23:51:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707033081; cv=pass; d=google.com; s=arc-20160816; b=A95zIvRaCUdr12edXJ+UwkCVOpl8FUO9pselytvATA4H/009W3BNGGpxW75gXnwHGL rRbCgIitGGzrZIF9N0o2YPVoYJC4pFuJesqnA5jIwthdNdC9STFKjSJFcQoEem+fqCrz 211XU1z8TZoq3UI/oSXRP2smtQS4ae1m+EevjEWziiXB2lUa5nKc5wXeETalk2//MSAw OQ2qp/84URTqL15+iEYJowl9s2NUm9vrapwNEldZoxWksUXyMtf2SqQBK4tJzYFFVWZC FX2AL4N7mcyBDZPLM8f1QqLjiAS8uExa4B6TT0Y5JdShnCOWhwjtSMSrMvGHLwSPV8nX XB1w== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=6L8MWuefqQj8iB/q4CJU/rs7oY4WxBXoolFWLX/VzZQ=; fh=91KvuEq5IwYiwIyXcEiMqqihebHMoWFOHbm8zTZcmy4=; b=mQrl2U6A4r/LE2UZVvWfxwtIzlM2irCOK+z5z8UOChtKrgXby+phB/3a8bjnvsdhzl Vq77ACbAJfafPPvapf7wkIk4spO5ZlcZtyFWqB85cCNIGEsVaOBDSPDCPHWvgdzEnHJZ E+AGUv+vLDlm0YXhYj5YkVMwZGkS49310YnDDdr0HWBy0C4fSu4P5u4YLVx2/Rt0zbwA b+vTNuLaXMhNtk/Wne6FIpUhewwQJwzb9l7wMPRuxKMxY3Icmi1BHUVpgS6y/kEmd/n2 eycVLa744pyee7Bu12l5gyMgCfA+PXN/cF21an0bJ/EQ0shreyHcOohYNbWdv2WlAQly nbQQ==; 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-51505-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51505-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCV+JfE3CntT/OGXe0w+pdLgGYiQcYMd3f1yNlE8iz+nVzE94CTa/W3AaT5LQScIkCHgJu8Xe89cL9LcKtz48oWLs8+2kQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u18-20020a056a00125200b006dde150522fsi4172057pfi.323.2024.02.03.23.51.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:51:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51505-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-51505-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51505-ouuuleilei=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 E8633284917 for ; Sun, 4 Feb 2024 07:51:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3968014296; Sun, 4 Feb 2024 07:49:46 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (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 E8FD213AD8 for ; Sun, 4 Feb 2024 07:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032984; cv=none; b=ZZ+TH7Y0SLRkFtHf53AkTpuCqLkp8AmoTGjiDk02VJbdfn9wXAhcr6SneT6nJ1SIqm+Twh7O85CHcxc70OcgwNB1DZgvO83U9Wng+EXgkwsYxCcwikrOT8OBVw0JXvXwlNVLQm5nKUW0UV7p0rrT+w5B17lKEnQRvhN7HOiW4lI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032984; c=relaxed/simple; bh=TKRofWhs3zGlYCdkuuvozkIm/3tjTK+ONGEbc3I8K3M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VvzFrQCUDqCt+TL1U+kh2ko8kUdw0nokS8w8Vt4A9tdXW4dpONFeQtNvIL7HRE4YFlHB8ifdYjyUCQAL6EOSKlzzSKAUT8HEjk7ge+iEekTs95Ha1bpex+PJS6Ggm184WK8Rzm4j4SA2gUf/M4MxNxv4QWlSeRZYHPdWVF4w65c= 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=45.249.212.35 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.19.163.17]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4TSM7120Rfz1Q8cR; Sun, 4 Feb 2024 15:47:41 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 75F101A0178; Sun, 4 Feb 2024 15:49:35 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:35 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 3/7] drivers/perf: hisi_pcie: Add more events for counting TLP bandwidth Date: Sun, 4 Feb 2024 15:45:23 +0800 Message-ID: <20240204074527.47110-4-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789953920709152594 X-GMAIL-MSGID: 1789953920709152594 From: Yicong Yang A typical PCIe transaction is consisted of various TLP packets in both direction. For counting bandwidth only memory read events are exported currently. Add memory write and completion counting events of both direction to complementation. Signed-off-by: Yicong Yang Reviewed-by: Jonathan Cameron --- drivers/perf/hisilicon/hisi_pcie_pmu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index 9623bed93876..83be3390686c 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -726,10 +726,18 @@ static struct attribute *hisi_pcie_pmu_events_attr[] = { HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_cnt, 0x10210), HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_latency, 0x0011), HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_cnt, 0x10011), + HISI_PCIE_PMU_EVENT_ATTR(rx_mwr_flux, 0x0104), + HISI_PCIE_PMU_EVENT_ATTR(rx_mwr_time, 0x10104), HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_flux, 0x0804), HISI_PCIE_PMU_EVENT_ATTR(rx_mrd_time, 0x10804), + HISI_PCIE_PMU_EVENT_ATTR(rx_cpl_flux, 0x2004), + HISI_PCIE_PMU_EVENT_ATTR(rx_cpl_time, 0x12004), + HISI_PCIE_PMU_EVENT_ATTR(tx_mwr_flux, 0x0105), + HISI_PCIE_PMU_EVENT_ATTR(tx_mwr_time, 0x10105), HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_flux, 0x0405), HISI_PCIE_PMU_EVENT_ATTR(tx_mrd_time, 0x10405), + HISI_PCIE_PMU_EVENT_ATTR(tx_cpl_flux, 0x1005), + HISI_PCIE_PMU_EVENT_ATTR(tx_cpl_time, 0x11005), NULL }; From patchwork Sun Feb 4 07:45:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 196446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp240916dyb; Sat, 3 Feb 2024 23:50:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUsQvagaDkhM6cdE/CpT9fcKNE+oZnzNElwmlUQ+YnLvvAWc8tBGgOA1Ab33tLhb8D0swb X-Received: by 2002:a17:907:7705:b0:a37:91f6:3cd8 with SMTP id kw5-20020a170907770500b00a3791f63cd8mr406342ejc.55.1707033045044; Sat, 03 Feb 2024 23:50:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707033045; cv=pass; d=google.com; s=arc-20160816; b=pNEZwiuB1EMWqItxniTgCX/HzqiSm7CqLNSXCEiqNcpL4tLA/5Pb7hI5T9UTOI4qiI /BNbVqrvWMvJ7d1JwM1wvDlGLsnMv2ZoQELmIzs4lylgJJI6g7YMYL7c1ddIHtkg6SkF Fw0PHnbKaNXPJLdGVpqzTyK76xlJp2cHt33Ou9fkvkI5omGXsw/AN6q4B36JjkqxrDlC pQv782qT2DrVuMML/HZ7oZAiNmzVabweKG5E5wx6WWRn5YWQ0+0dtSJ6KskH+KHvfuku PcqM9RdrZnaVx3Nom6XzPRsV5WzXumxT6amhJhoJuTGqJW7X28dv2HEqBhvvbVaa+ROL kxbg== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ys8TEnjJYSXuVe3FNV3kVNgwDzQMcPMQDDx/yJjw2uw=; fh=e6S+h4YeHdtYAdAyDuG0wlB4r6ioJt/f6NnAqVsjqpE=; b=K0iCq3IUiXNZYOHxrjIqMPv2OmuVcerCTE3rAsdy2LVEvMfWQST8KZdzz6w9FJ7ICU EJtXVGrZ+5gbIzUolKdtMFe2TSZsRO8Tl4k2QNF/Kw1XQcjovsI5G8YdW2/VfhxZmWjZ i02rhro6F7xaWrGlqXez8o15NqM909FJgvCCf4DiSLFiQLDK5+iLUycW+WWuXSs6tipK eFzZ6KkSyoIjkFhc1dBVP5lAw4oajT/Rx1NBgOSlQYrCwnLAZqlECDrVxToUlwOSvtFI lNlKJOcQFid3LkE5v1kgAJ3qVgmBsYqafpfzqAiwbBoEzhtkG2G8f4PaHfnoJUtAKRnS TCiw==; 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-51502-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51502-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCVJbgHHz4o5NQNUy3X456o4tnLEKL76qjk7TI3ol2KodzeZfXAFEgR0PfF2p4ZcAIwubUwHE2HGns14hJ6xeFlAN1G+yw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lz12-20020a170906fb0c00b00a37a2d7e997si108151ejb.95.2024.02.03.23.50.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:50:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51502-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-51502-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51502-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id A63D21F22784 for ; Sun, 4 Feb 2024 07:50:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FFBD134B1; Sun, 4 Feb 2024 07:49:42 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 0802DE570 for ; Sun, 4 Feb 2024 07:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; cv=none; b=d/050lzLU+Zzmc9Mk5lwfXVjbXbcfYI2sCUf9LjNayf10fZ+0m7KLnEm2Vjb7nvKgbTOJeJvGXJWEQEvm86UFdQ//WtrgIFaAMWckrRq3c2os3Lh4QIpJ6ysrR0sOhauXDkJRByCVrQXOOMbztj0pZcZyODcLOBsgF/spFd2eAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; c=relaxed/simple; bh=V2dplIcXwgwtYYeVnBhwj0TNKdw7NOt1svmTLt/jfe4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BjNgSkxRn8BOWhCGLxxY5qGBiv3eqKGOR4AtVBk3FvZ+En067rUJG9lCLy1VDh6K9bDMumHSNUyNMqM2FA2OD/rlrG//oXyZuilGseGX0n5Yw8xX353YBnT3hVYDm0ZOG6xDAVOa8ZuPAGjFBPyMNP2P83tz9pC5LEckUqHdiMk= 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=45.249.212.191 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.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TSM3y2rk3z1FJpd; Sun, 4 Feb 2024 15:45:02 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id A60A71A016B; Sun, 4 Feb 2024 15:49:35 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:35 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 4/7] drivers/perf: hisi_pcie: Check the target filter properly Date: Sun, 4 Feb 2024 15:45:24 +0800 Message-ID: <20240204074527.47110-5-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789953882319514467 X-GMAIL-MSGID: 1789953882319514467 From: Junhao He The PMU can monitor traffic of certain target Root Port or downstream target Endpoint. User can specify the target filter by the "port" or "bdf" option respectively. The PMU can only monitor the Root Port or Endpoint on the same PCIe core so the value of "port" or "bdf" should be valid and will be checked by the driver. Currently at least and only one of "port" and "bdf" option must be set. If "port" filter is not set or is set explicitly to zero (default), driver will regard the user specifies a "bdf" option since "port" option is a bitmask of the target Root Ports and zero is not a valid value. If user not explicitly set "port" or "bdf" filter, the driver uses "bdf" default value (zero) to set target filter, but driver will skip the check of bdf=0, although it's a valid value (meaning 0000:000:00.0). Then the user just gets zero. Therefore, we need to check if both "port" and "bdf" are invalid, then return failure and report warning. Testing: before the patch: 0 hisi_pcie0_core1/rx_mrd_flux/ 0 hisi_pcie0_core1/rx_mrd_flux,port=0/ 24,124 hisi_pcie0_core1/rx_mrd_flux,port=1/ 0 hisi_pcie0_core1/rx_mrd_flux,bdf=0/ hisi_pcie0_core1/rx_mrd_flux,bdf=1/ after the patch: hisi_pcie0_core1/rx_mrd_flux/ hisi_pcie0_core1/rx_mrd_flux,port=0/ 24,153 hisi_pcie0_core1/rx_mrd_flux,port=1/ hisi_pcie0_core1/rx_mrd_flux,bdf=0/ hisi_pcie0_core1/rx_mrd_flux,bdf=1/ Signed-off-by: Junhao He Signed-off-by: Yicong Yang --- drivers/perf/hisilicon/hisi_pcie_pmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index 83be3390686c..b91f03c02c57 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -306,10 +306,10 @@ static bool hisi_pcie_pmu_valid_filter(struct perf_event *event, if (hisi_pcie_get_trig_len(event) > HISI_PCIE_TRIG_MAX_VAL) return false; - if (requester_id) { - if (!hisi_pcie_pmu_valid_requester_id(pcie_pmu, requester_id)) - return false; - } + /* Need to explicitly set filter of "port" or "bdf" */ + if (!hisi_pcie_get_port(event) && + !hisi_pcie_pmu_valid_requester_id(pcie_pmu, requester_id)) + return false; return true; } From patchwork Sun Feb 4 07:45:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 196445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp240868dyb; Sat, 3 Feb 2024 23:50:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy9Gf20AzfdOVAHAeeXKx5XH1QWA/db3vyR+DDY2qoUnp9KZ6bj2XJwsZIIYMvnYvSegwk X-Received: by 2002:a05:6808:14d4:b0:3bf:c9ce:f844 with SMTP id f20-20020a05680814d400b003bfc9cef844mr5312790oiw.23.1707033034463; Sat, 03 Feb 2024 23:50:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707033034; cv=pass; d=google.com; s=arc-20160816; b=lyoa8GE29+kEgjG+Jc0mRY0zr6+525YAqWkEspxzHRYQLqgDSiAa7lt+aWJSJHkEE8 JEWnAqo4fqYs0AdTlR36NtHtEUL+GgbbpzA4cBy9Rwlk0lFvv6MLNtvx1kwml7peQmry 6W2JKS0MIxJawKbNrYagev+7pqKJ7JCSCQhRZH7903QTYIssTPQQg/xoCxUVDKLAG7P9 Ayb7wZxchOXs04CvX6LjwNRaztUOvMuAHenC5r0Zb70F10Tb+1uYx+VIRRVzfwgZNocy HkgWy3juqNN4yZPSL/kh3no8ERFiAgjZjHaUEzYepeVf6BvB2CkDQ3KdBr3nWSeUx1vr btCg== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=HSh5NS8xK1NH3CXyW6IyI9yXtrR4rKYWu8fVs+402L8=; fh=/DKZ8iJu5jBxC1wbTUU4XhL3CKfHaQACa7Utyf3pD+Q=; b=MFteXU9PVYaDUY3VLTP9o8B3l/68tAFIGqWh+d2pGTfbfvzIbjs+nD5bVcKNUbfI4m qOm0kLu9ZvvJN1ff7V7Z1TIbeAs+m4aS9t/0ux5yCrEvWvw/1ib/KX+SCbppDxZxmUIe MO15jr3kE3NXqqvpYCL3GBJ1PWMqEc8iQ8HGoxZaP+W1eIjKxQS3ZxCr4ZUrofVmdQVO LiX5rKM5/vA2A4ZTrI74ZWWd2sdttSTBOgC6H7rsrMH4/LRBMWZn2iMybmOO7eDoAFq6 2AkH5g9sEMfAb+5JTMjEfG0MPdgzrIZ8pXALw3jfdHbCAqTTIoa9yLU9c5f7QmWHDdfB cNxA==; 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-51501-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51501-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCVXLoz6rNsLEwEj4vZ+o+sA/muDyRUY4jvAwBMJmCgjGaCMvPj7chns5KlM59wSCnYtDnJeHxlwVq1z6eBQtnR4jlCQfA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d17-20020a630e11000000b005ced2a6b890si4162545pgl.668.2024.02.03.23.50.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:50:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51501-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-51501-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51501-ouuuleilei=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 3BC1B28487B for ; Sun, 4 Feb 2024 07:50:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2828312E6C; Sun, 4 Feb 2024 07:49:42 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 441FBE57F for ; Sun, 4 Feb 2024 07:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; cv=none; b=WHOkRuhUm5BJ9n9Bg5EJV/Quh+BNzQFq70y97UmolPm2k5v0KAx+aI+C8oXQu++FiKfEH5BlwyiiHMYcFK0PIjYZAZms9qPJ9sqEGuJyT3Kv7KEVyK9vIx30Wht139GWQ2s1K+xHQhp9Pn3KcaebLl5x5vPtR+Y6OINPSVeCyBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; c=relaxed/simple; bh=xVp6lLGeg/BVIYp5SFLX2aWAIILS7tlAKBQjN8FKhM8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AHrGIU8WJUwD2wN9rNmfc5xwJTzrjS9IXXccMTG0Q1QTzXBSSrhlk2EuJnZCF90s1vwG9bYo6Y22ieUdI2mkP8pMIrWMyn1wFN3AHy+8To7pJVuO+vp5lxHgIefic/v67AFUYERCyDJL6B5LSvWMCzRQAWd+gWJmGU6/4ryJWPg= 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=45.249.212.190 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.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TSM7z5Bgkz1xnCC; Sun, 4 Feb 2024 15:48:31 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id D72DD1404FC; Sun, 4 Feb 2024 15:49:35 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:35 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 5/7] drivers/perf: hisi_pcie: Relax the check on related events Date: Sun, 4 Feb 2024 15:45:25 +0800 Message-ID: <20240204074527.47110-6-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789953871148119392 X-GMAIL-MSGID: 1789953871148119392 From: Junhao He If we use two events with the same filter and related event type (see the following example), the driver check whether they are related events and are in the same group, otherwise the function hisi_pcie_pmu_find_related_event() return -EINVAL, then the 2nd event cannot count but the 1st event is running, although the PCIe PMU has other idle counters. In this case, The perf event scheduler will make the two events to multiplex a counter, if the user use the formula (1st event_value / 2nd event_value) to calculate the bandwidth, he/she won't get the correct value, because they are not counting at the same period. This patch tries to fix this by making the related events to use different idle counters if they are not in the same event group. And finally, I'm going to say. The related events are best used in the same group [1]. There are two ways to know if they are related events. a) By event name, such as the latency events "xxx_latency, xxx_cnt" or bandwidth events "xxx_flux, xxx_time". b) By event type, such as "event=0xXXXX, event=0x1XXXX". Use group to count the related events: [1] -e "{pmu_name/xxx_latency,port=1/,pmu_name/xxx_cnt,port=1/}" example: 1st event: hisi_pcie0_core1/event=0x804,port=1 2nd event: hisi_pcie0_core1/event=0x10804,port=1 test cmd: perf stata -e hisi_pcie0_core1/event=0x804,port=1/ \ -e hisi_pcie0_core1/event=0x10804,port=1/ before patch: 25,281 hisi_pcie0_core1/event=0x804,port=1/ (49.91%) 470,598 hisi_pcie0_core1/event=0x10804,port=1/ (50.09%) after patch: 24,147 hisi_pcie0_core1/event=0x804,port=1/ 474,558 hisi_pcie0_core1/event=0x10804,port=1/ Signed-off-by: Junhao He Signed-off-by: Yicong Yang --- drivers/perf/hisilicon/hisi_pcie_pmu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index b91f03c02c57..1b45aeb82859 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -408,14 +408,10 @@ static int hisi_pcie_pmu_find_related_event(struct hisi_pcie_pmu *pcie_pmu, if (!sibling) continue; - if (!hisi_pcie_pmu_cmp_event(sibling, event)) - continue; - /* Related events must be used in group */ - if (sibling->group_leader == event->group_leader) + if (hisi_pcie_pmu_cmp_event(sibling, event) && + sibling->group_leader == event->group_leader) return idx; - else - return -EINVAL; } return idx; From patchwork Sun Feb 4 07:45:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 196448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp240976dyb; Sat, 3 Feb 2024 23:50:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7+LXsaASikapI7l+XpVTicQjIKKmX7lE5HClw1rs1gh8x2g6+JeWLoozlg4hnvjVSN5YX X-Received: by 2002:a05:622a:81:b0:42a:6d17:7bcf with SMTP id o1-20020a05622a008100b0042a6d177bcfmr3777937qtw.63.1707033058333; Sat, 03 Feb 2024 23:50:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707033058; cv=pass; d=google.com; s=arc-20160816; b=gSw7D/C4EqhfRat0t+GL9uab2LlXcLmjQbpfhQjeebpT0r6TXCzrR9/P0dGuWK96hC ztl3yeKN81tuu/gQZ/8/EwngjC0EBO0mpsGTkafZDIi+lYPB8KWZrfrsFRE9+X4+Hy09 mDbiBj4j7W7kXdaLry+Cg+sAZQpnjgss4FUkMA2gkHXGcDGlUp9/2jNzZ1t0kqDiC+3t zcwzsUKZhkt+YMWKlg3UkzsdxS4c9Su+S8JF3x0IeLbkKD6bCJStX/6s+xG6wA6yWbR+ wDipZAX09WW8jZfJB4Mu9sx+bl7JCGJI/xak77m/xtjCCDw6ieRiTz5/px8r6oYQFVug MBFw== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=25onVGtVafuKcCwJg5IjbQI+Bs2Pk7zHB6Vj1NaEtJs=; fh=p5W4eP2tc1YXviDOgn7Ca9nlt/5G6n4ek3xNca1hYUI=; b=f2Dfm86amuR2FhNFUjRu3z0We2XnSQ2S8gUAW3/RRPgrTaI6qcybAXBiRkPyjbjRCS hkiPxxW3Et9qamq/wZ79k+HM5IfanRNW9k1vkbF/jbGf+Zdh6Wok86/dFbUZgz39t1MG p47iveVrCLulM7X3wnABC6CvWgGp1UyD9ZtZy8DKZOwAEBZAKdWx1XtXRDlmZ5kl2XEj c0dc39nuOYoIxP38OoI4qLPjFicv6g3ZVuep2BbhpZmtW8pq1rjDz59FcJtyCDuFgsZz PmEHTxMp/1wrCuRLjDs36m11i1gHULfWSwQcAXaL9CRwvai8XxMeCN9nhVtDJtHviL2i 4xtg==; 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-51504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51504-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCV1FEK+VNpDiuQz9ZLLuhdu+QuSbhCOw/PygtequUd8G8T0tAuHkvJ7X40Srb/A9G4HRPulGDS5ywTFRB4U0BLosrvJRQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d19-20020ac85ad3000000b0042a72043aa1si5820772qtd.719.2024.02.03.23.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:50:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-51504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51504-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1429A1C20A67 for ; Sun, 4 Feb 2024 07:50:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAB4D13FEA; Sun, 4 Feb 2024 07:49:43 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 D5470FBE4 for ; Sun, 4 Feb 2024 07:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032982; cv=none; b=DPiuSHdpQbMPn7yC7ZOoNthlRop0pOxDC537rCXkVbiOFZ09eoYJYxT10NUTnKxddEtSx13me+Gno3y4JBuSjDS4cPFCHFd0v0mDWS4R1kfu9QwkM1r3aJxxRD20WN/mPxPCixyFyskIfuhQkn6peY8kdySnapGkLi/zc/57LWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032982; c=relaxed/simple; bh=1UkIr5V/52bHREXY34P/myH6Vo5bhtQZ1nGTyQc/848=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LGXN//llTF4VzGbxjs19WnfQPTDRD5pku1HFqv8NrhUFikZdOGmuKR9mZaIsN3OpWnoXFY2iffapvpzeSdEclFomDx95rAXSe7xkMvR0JkB7Kr1yRxCVeMIXPaBIE4hE2sqfzHg34Bhoe9Uqw/CHxkNzsOE6/aSkKqzTwFLB0Zw= 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=45.249.212.191 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.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TSM722wJdz1gyTn; Sun, 4 Feb 2024 15:47:42 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 1507818002F; Sun, 4 Feb 2024 15:49:36 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:35 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 6/7] drivers/perf: hisi_pcie: Merge find_related_event() and get_event_idx() Date: Sun, 4 Feb 2024 15:45:26 +0800 Message-ID: <20240204074527.47110-7-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789953896200354678 X-GMAIL-MSGID: 1789953896200354678 From: Junhao He The function xxx_find_related_event() scan all working events to find related events. During this process, we also can find the idle counters. If not found related events, return the first idle counter to simplify the code. Signed-off-by: Junhao He Signed-off-by: Yicong Yang --- drivers/perf/hisilicon/hisi_pcie_pmu.c | 55 ++++++++++---------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index 1b45aeb82859..2edde66675e7 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -397,16 +397,24 @@ static u64 hisi_pcie_pmu_read_counter(struct perf_event *event) return hisi_pcie_pmu_readq(pcie_pmu, event->hw.event_base, idx); } -static int hisi_pcie_pmu_find_related_event(struct hisi_pcie_pmu *pcie_pmu, - struct perf_event *event) +/* + * Check all work events, if a relevant event is found then we return it + * first, otherwise return the first idle counter (need to reset). + */ +static int hisi_pcie_pmu_get_event_idx(struct hisi_pcie_pmu *pcie_pmu, + struct perf_event *event) { + int first_idle = HISI_PCIE_MAX_COUNTERS; struct perf_event *sibling; int idx; for (idx = 0; idx < HISI_PCIE_MAX_COUNTERS; idx++) { sibling = pcie_pmu->hw_events[idx]; - if (!sibling) + if (!sibling) { + if (first_idle == HISI_PCIE_MAX_COUNTERS) + first_idle = idx; continue; + } /* Related events must be used in group */ if (hisi_pcie_pmu_cmp_event(sibling, event) && @@ -414,19 +422,7 @@ static int hisi_pcie_pmu_find_related_event(struct hisi_pcie_pmu *pcie_pmu, return idx; } - return idx; -} - -static int hisi_pcie_pmu_get_event_idx(struct hisi_pcie_pmu *pcie_pmu) -{ - int idx; - - for (idx = 0; idx < HISI_PCIE_MAX_COUNTERS; idx++) { - if (!pcie_pmu->hw_events[idx]) - return idx; - } - - return -EINVAL; + return first_idle; } static void hisi_pcie_pmu_event_update(struct perf_event *event) @@ -552,27 +548,18 @@ static int hisi_pcie_pmu_add(struct perf_event *event, int flags) hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; - /* Check all working events to find a related event. */ - idx = hisi_pcie_pmu_find_related_event(pcie_pmu, event); - if (idx < 0) - return idx; - - /* Current event shares an enabled counter with the related event */ - if (idx < HISI_PCIE_MAX_COUNTERS) { - hwc->idx = idx; - goto start_count; - } - - idx = hisi_pcie_pmu_get_event_idx(pcie_pmu); - if (idx < 0) - return idx; + idx = hisi_pcie_pmu_get_event_idx(pcie_pmu, event); + if (idx == HISI_PCIE_MAX_COUNTERS) + return -EAGAIN; hwc->idx = idx; - pcie_pmu->hw_events[idx] = event; - /* Reset Counter to avoid previous statistic interference. */ - hisi_pcie_pmu_reset_counter(pcie_pmu, idx); -start_count: + /* No enabled counter found with related event, reset it */ + if (!pcie_pmu->hw_events[idx]) { + hisi_pcie_pmu_reset_counter(pcie_pmu, idx); + pcie_pmu->hw_events[idx] = event; + } + if (flags & PERF_EF_START) hisi_pcie_pmu_start(event, PERF_EF_RELOAD); From patchwork Sun Feb 4 07:45:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 196447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp240925dyb; Sat, 3 Feb 2024 23:50:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQn3ZpRX4xyiJsl6FzkWEIa6ScuPq8cI9rDqi73F6xQ7krG5iB8KjAbrx3m91eubGlMY0l X-Received: by 2002:a17:906:c7d4:b0:a37:3831:67d5 with SMTP id dc20-20020a170906c7d400b00a37383167d5mr3369863ejb.22.1707033046885; Sat, 03 Feb 2024 23:50:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707033046; cv=pass; d=google.com; s=arc-20160816; b=RahS/T6RM3dUijnV0m1YHx5oZzk96bsi5dhsDN92Pwe77cUMja/h5VM9Sy9rFCw/zP NiQi2do7cAVqxmxTBExyL4Xkt3SV3MODawXtWniNrVcX4H3ADeY6MalKfNksuo1R32tn fwMVWB/+35UrTMBtsvd7KqNHVeqO3JSrI0T73fwWBaLO8XAJDDok/0CEQBAM9rKus+vF AN97dZfGOOedV1Sja592av5meXxpBD0UO9CfpYblusKtf7YDyUh5IaeRpUWrU3CFjoTF jtcK7N/cWcbzMU2FGtl2bOCZdACvLlZCFUU4ZFNw3iUxaO5smwlUsosebU1wHaYz/WB3 2aAQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Dp8iXeiJP9T/3BqKwCxANWbH0ajI2GEEO4PD80roO4I=; fh=SkyvzWTbOY2LLDYwUzmo/g80dFf4aqC2Io4/0+u/CDQ=; b=bchPscIDJbvuPbJXWGKehJf2T+VgvEG2KfYweU8W3nqI65hamAUzJhbOFeAsISEpyM L0PvGLa0zG5Pr47BPZjXfUrWiiuyT8UYPt3udzd0Pb6X5pVCJOoeh6d9TP4dUnkBaAbv mjDGMnFplfa8f308KwvGW2jtLolJpUlMPDFdHifD43iTDIAK14478MYgd28A4cXOVpMp Cf0VpcuBICnNi9DWdOvggu22tRbQzN4gVNth9/Un1Z2LgbX5l8XSVAZrXoaURf7qoLCg uYX8LVUHWJhVnB+KXrk5ZoVtTcLYP1XPXnrnpGynpV3qqgmLeXm9BXY9siFziYrgfFb7 I3UQ==; 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-51503-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCWrKWaw2h9yw1qQp96YtunFrVkDXozE68+cysXiDMoARtN1tHD8sltIxHEdNDBCw7dVdiNwyLdT1y8GXbEAuCv4rv9IAg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e24-20020a1709062c1800b00a37972dd1a1si296203ejh.121.2024.02.03.23.50.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:50:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51503-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-51503-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51503-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7D2771F22588 for ; Sun, 4 Feb 2024 07:50:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85400134BD; Sun, 4 Feb 2024 07:49:42 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 0C3FAE578 for ; Sun, 4 Feb 2024 07:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; cv=none; b=QkiTBZYoBQzOIFsreVOVSPWd1Z8SUqIAFlzxdbdo9aDKWd+P/7MeoYa8xx4SBX4F8wI1OvYJCmLNnSq1qukjmr9YYaptTfBXLMRewOIgTRB95swLpNqTpeUhp8RymYG2aHle7ybCmN6eONBzvqo+8AtP5mN3QQTLUkqpS4n104g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; c=relaxed/simple; bh=sjrcDCbhSwKtcGnasHHrnMOZkhXGt64pWlRqOR6tDZA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iQZrKuqJpLC5tNOJdiTu7U1GGpIeoz+XR3Khm23ZaQkk3I3JWYJUTRXtPSRXaG31Vko5H/TVUdDT6ZdBW1mZkHeuFFgLo7dNerQm8F0TYuOLqWC2nqLzYqGh8ovM0yibm2JRtaJteQx3aHTStVVUu9SAWPLkd98fObfdKQVCwWQ= 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=45.249.212.190 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.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TSM800v2Mz1xnBQ; Sun, 4 Feb 2024 15:48:32 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 479921A0178; Sun, 4 Feb 2024 15:49:36 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:36 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 7/7] docs: perf: Update usage for target filter of hisi-pcie-pmu Date: Sun, 4 Feb 2024 15:45:27 +0800 Message-ID: <20240204074527.47110-8-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789953883871459166 X-GMAIL-MSGID: 1789953883871459166 From: Junhao He One of the "port" and "bdf" target filter interface must be set, and the related events should preferably used in the same group. Update the usage in the documentation. Signed-off-by: Junhao He Signed-off-by: Yicong Yang --- .../admin-guide/perf/hisi-pcie-pmu.rst | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/perf/hisi-pcie-pmu.rst b/Documentation/admin-guide/perf/hisi-pcie-pmu.rst index 7e863662e2d4..c98ea4b0f0d4 100644 --- a/Documentation/admin-guide/perf/hisi-pcie-pmu.rst +++ b/Documentation/admin-guide/perf/hisi-pcie-pmu.rst @@ -37,9 +37,20 @@ Example usage of perf:: hisi_pcie0_core0/rx_mwr_cnt/ [kernel PMU event] ------------------------------------------ - $# perf stat -e hisi_pcie0_core0/rx_mwr_latency/ - $# perf stat -e hisi_pcie0_core0/rx_mwr_cnt/ - $# perf stat -g -e hisi_pcie0_core0/rx_mwr_latency/ -e hisi_pcie0_core0/rx_mwr_cnt/ + $# perf stat -e hisi_pcie0_core0/rx_mwr_latency,port=0xffff/ + $# perf stat -e hisi_pcie0_core0/rx_mwr_cnt,port=0xffff/ + +The related events usually used to calculate the bandwidth, latency or others. +They need to start and end counting at the same time, therefore related events +are best used in the same event group to get the expected value. There are two +ways to know if they are related events: +a) By event name, such as the latency events "xxx_latency, xxx_cnt" or + bandwidth events "xxx_flux, xxx_time". +b) By event type, such as "event=0xXXXX, event=0x1XXXX". + +Example usage of perf group:: + + $# perf stat -e "{hisi_pcie0_core0/rx_mwr_latency,port=0xffff/,hisi_pcie0_core0/rx_mwr_cnt,port=0xffff/}" The current driver does not support sampling. So "perf record" is unsupported. Also attach to a task is unsupported for PCIe PMU. @@ -51,8 +62,12 @@ Filter options PMU could only monitor the performance of traffic downstream target Root Ports or downstream target Endpoint. PCIe PMU driver support "port" and - "bdf" interfaces for users, and these two interfaces aren't supported at the - same time. + "bdf" interfaces for users. + Please notice that, one of these two interfaces must be set, and can not + be supported at the same time. If they are both set, only "port" filter is + valid. + If "port" filter not being set or is set explicitly to zero (default), the + "bdf" filter will be in effect, because "bdf=0" meaning 0000:000:00.0. - port @@ -95,7 +110,7 @@ Filter options Example usage of perf:: - $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,trig_len=0x4,trig_mode=1/ sleep 5 + $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,port=0xffff,trig_len=0x4,trig_mode=1/ sleep 5 3. Threshold filter @@ -109,7 +124,7 @@ Filter options Example usage of perf:: - $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,thr_len=0x4,thr_mode=1/ sleep 5 + $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,port=0xffff,thr_len=0x4,thr_mode=1/ sleep 5 4. TLP Length filter @@ -127,4 +142,4 @@ Filter options Example usage of perf:: - $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,len_mode=0x1/ sleep 5 + $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,port=0xffff,len_mode=0x1/ sleep 5