From patchwork Mon Feb 13 11:31:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 123784 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4B3B41C88; Mon, 13 Feb 2023 12:32:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B58D40A81; Mon, 13 Feb 2023 12:32:28 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0EA65400D6 for ; Mon, 13 Feb 2023 12:32:26 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31D8HZ81031402; Mon, 13 Feb 2023 03:32:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0220; bh=xw+LtTor40Fk4Np7WK1TjYNua3TQLClURwiXV/MN1X4=; b=jyu59tVfkQVayUsrHKCmxFTINfoMRhJHPTm8RPyVj9lEo+E+ZVOHGSX2n2vISmUG7h4f 0jk8GaaPc6qFLf/jbE8SPKa6pWVRd4h/m0Hg7FlYwwheQ5ycRbbLBJnazeIVAW/4YMTB /HX3VlEYv4dKaSiXW/lHPK7lFpequOaEZacx4qD9c9CJ5imV9VbB5XrfCuxK2uZpg39M y6vE76SVr+SYwQF38DFegV9eeAVJFjOzSLwmLxI/37R57Cd20e3niuhQkT5VjEl4C623 dCFnpXUJP3ol9Z/w1+SApX7cJpeqegPxrca4HjvmPoYFmuejP6kYAdmH+U46iCx16Lz6 uA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3npbe1y5nc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 03:32:23 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 13 Feb 2023 03:32:21 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Mon, 13 Feb 2023 03:32:21 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id B20043F7070; Mon, 13 Feb 2023 03:32:18 -0800 (PST) From: Tomasz Duszynski To: CC: , , , , , , , , , Tomasz Duszynski Subject: [PATCH v10 0/4] add support for self monitoring Date: Mon, 13 Feb 2023 12:31:52 +0100 Message-ID: <20230213113156.385482-1-tduszynski@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202124951.2915770-1-tduszynski@marvell.com> References: <20230202124951.2915770-1-tduszynski@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Zp34_IVwW-0DqsAnhOS2aVlsUz3M0G_m X-Proofpoint-ORIG-GUID: Zp34_IVwW-0DqsAnhOS2aVlsUz3M0G_m X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-13_06,2023-02-13_01,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This series adds self monitoring support i.e allows to configure and read performance measurement unit (PMU) counters in runtime without using perf utility. This has certain advantages when application runs on isolated cores running dedicated tasks. Events can be read directly using rte_pmu_read() or using dedicated tracepoint rte_eal_trace_pmu_read(). The latter will cause events to be stored inside CTF file. By design, all enabled events are grouped together and the same group is attached to lcores that use self monitoring funtionality. Events are enabled by names, which need to be read from standard location under sysfs i.e /sys/bus/event_source/devices/PMU/events where PMU is a core pmu i.e one measuring cpu events. As of today raw events are not supported. v10: - check permissions before using counters - do not use internal symbols in exported functions - address review comments v9: - fix 'maybe-uninitialized' warning reported by CI v8: - just rebase series v7: - use per-lcore event group instead of global table index by lcore-id - don't add pmu_autotest to fast tests because due to lack of suported on every arch v6: - move codebase to the separate library - address review comments v5: - address review comments - fix sign extension while reading pmu on x86 - fix regex mentioned in doc - various minor changes/improvements here and there v4: - fix freeing mem detected by debug_autotest v3: - fix shared build v2: - fix problems reported by test build infra Tomasz Duszynski (4): lib: add generic support for reading PMU events pmu: support reading ARM PMU events in runtime pmu: support reading Intel x86_64 PMU events in runtime eal: add PMU support to tracing library MAINTAINERS | 5 + app/test/meson.build | 2 + app/test/test_pmu.c | 68 +++ app/test/test_trace_perf.c | 10 + doc/api/doxy-api-index.md | 3 +- doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/profile_app.rst | 17 + doc/guides/prog_guide/trace_lib.rst | 32 ++ doc/guides/rel_notes/release_23_03.rst | 7 + lib/eal/common/eal_common_trace.c | 13 +- lib/eal/common/eal_common_trace_points.c | 5 + lib/eal/include/rte_eal_trace.h | 13 + lib/eal/meson.build | 3 + lib/eal/version.map | 1 + lib/meson.build | 1 + lib/pmu/meson.build | 21 + lib/pmu/pmu_arm64.c | 94 ++++ lib/pmu/pmu_private.h | 32 ++ lib/pmu/rte_pmu.c | 521 +++++++++++++++++++++++ lib/pmu/rte_pmu.h | 232 ++++++++++ lib/pmu/rte_pmu_pmc_arm64.h | 30 ++ lib/pmu/rte_pmu_pmc_x86_64.h | 24 ++ lib/pmu/version.map | 16 + 23 files changed, 1149 insertions(+), 2 deletions(-) create mode 100644 app/test/test_pmu.c create mode 100644 lib/pmu/meson.build create mode 100644 lib/pmu/pmu_arm64.c create mode 100644 lib/pmu/pmu_private.h create mode 100644 lib/pmu/rte_pmu.c create mode 100644 lib/pmu/rte_pmu.h create mode 100644 lib/pmu/rte_pmu_pmc_arm64.h create mode 100644 lib/pmu/rte_pmu_pmc_x86_64.h create mode 100644 lib/pmu/version.map --- 2.34.1