From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (unknown [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81944460A7; Fri, 17 Jan 2025 10:01:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5CE5427A2; Fri, 17 Jan 2025 10:01:00 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1345142798 for ; Fri, 17 Jan 2025 10:00:58 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50H8QiCN009788; Fri, 17 Jan 2025 01:00:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=p OOMFkTzRsR8FMFnxylKWdniFtI/XW9zNsWXWQ6dXf0=; b=ctI2rNLqygBgZArzE zn6YGqTMTucbkuOXCWrhxL8yJzHlcKykxE58py/ccEl4A7TinLW2VvhbdqbdU6YN olifCYCPL7mMYwN54jd/CWO+xuoa70+GdrXALlya/Jnhqvnk2hYYN/A8173Acc2o MJYo9opI/I2fsuk2Da01CPbCmbfs2VDe9U4WEEqiXiMqyvAJ+tfQCiVoViQBtVLd SCdvt+YJwSyPqjz/99NjbRb1FvdWCPWUjzKMOQB2jDWf/cbhg4ENfmL/hsQ51xMI Xn60xw9sWOaSRjubUzATkpwrfzGVcEojjFlsnLRTflpg0YGDWSlkAbM5jSPAmTsC E6nSA== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 447kps81w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jan 2025 01:00:51 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 17 Jan 2025 01:00:50 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 17 Jan 2025 01:00:50 -0800 Received: from cavium-optiplex-3070-BM15.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id A42863F707D; Fri, 17 Jan 2025 01:00:46 -0800 (PST) From: Tomasz Duszynski To: CC: , , , , , , , , , , , Tomasz Duszynski Subject: [PATCH v17 0/4] add support for self monitoring Date: Fri, 17 Jan 2025 10:00:29 +0100 Message-ID: <20250117090033.2807073-1-tduszynski@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241118073706.3129423-1-tduszynski@marvell.com> References: <20241118073706.3129423-1-tduszynski@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: rLa3ogb7an5Yddd9MtFQsGjmVb3UvwFW X-Proofpoint-GUID: rLa3ogb7an5Yddd9MtFQsGjmVb3UvwFW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-17_03,2025-01-16_01,2024-11-22_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. v17: - improve docs - use safer strtok_r() v16: - fix build issue related to ALLOW_EXPERIMENTAL_API not always defined - rename tracepoints upfront to make it easier to decouple for tracing - minor doc improvements - make sure non EAL threads can't read PMU v15: - add some basic logs related to API failures - get rid of thread-local-storage - do not support MT-safety (which was buggy anyway) in management APIs (rte_pmu_init(), rte_pmu_fini(), rte_pmu_add_{event,events_by_pattern}() as it impacts rte_pmu_read() performance because more logic needs to be incorporated to handle all corner cases - improve documentation slightly - various other improvements here and there v14: - replace __atomic_xxx with rte_atomic_xxx - rebase to dpdk/main since that's a new feature v13: - allow init/fini calling from multiple contexts - get rid of conditional compilation and return erors in case APIs are used on unsupported OS v12: - rebase old series - slightly refresh existing documentation - make sure compiler won't optimize accesses to certain variables during event readout - drop previous Acked-by to respin a fresh review cycle v11: - skip fast test in case init fails 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 | 1 + app/test/test_pmu.c | 55 +++ 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/glossary.rst | 3 + doc/guides/prog_guide/profile_app.rst | 38 ++ doc/guides/prog_guide/trace_lib.rst | 32 ++ doc/guides/rel_notes/release_25_03.rst | 7 + lib/eal/common/eal_common_trace.c | 5 +- lib/eal/common/eal_common_trace_pmu.c | 38 ++ lib/eal/common/eal_common_trace_points.c | 5 + lib/eal/common/eal_trace.h | 4 + lib/eal/common/meson.build | 1 + lib/eal/include/rte_eal_trace.h | 11 + lib/eal/meson.build | 3 + lib/eal/version.map | 1 + lib/meson.build | 1 + lib/pmu/meson.build | 22 + lib/pmu/pmu_arm64.c | 94 ++++ lib/pmu/pmu_private.h | 32 ++ lib/pmu/rte_pmu.c | 537 +++++++++++++++++++++++ lib/pmu/rte_pmu.h | 251 +++++++++++ lib/pmu/rte_pmu_pmc_arm64.h | 30 ++ lib/pmu/rte_pmu_pmc_x86_64.h | 24 + lib/pmu/version.map | 15 + 27 files changed, 1227 insertions(+), 2 deletions(-) create mode 100644 app/test/test_pmu.c create mode 100644 lib/eal/common/eal_common_trace_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