[wperf-driver,wperf] WPERF-728: Add DT basic capabilities to HW_CFG IOCTL
Introduction
In this patch I've added simple capabilities DT will yield via driver(s) to tell wperf
app what can be done:
"Device_ID" string with capabilities example below, see :
PMU_CTL_QUERY_HW_CFG [device_id_str] core.stat=core;core.sample=core;dsu.stat=dsu;dmc.stat=dmc_clk,dmc_clkdiv2
I've also updated Device Tree Feature (aka DT) Support Wiki page.
Device_ID string pattern
<dev_type>.<dev_func>=<event_prefix_list>
- separated with semicolon ;
for each supported "capabilities".
Where:
-
<dev_type>
- E.g. supported type such as:-
core
(Arm PMU), dsu
-
dmc
(Arm DDR controller), and -
spe
(Arm Statistical Profiling Extension).
-
-
<dev_func>
-
stat
for counting withwperf stat
(also timelines) -
sample
orrecord
for sampling withwperf sample
/wperf record
.
-
-
<event_prefix_list>
- list of event prefixes supported (withwperf ... -e <events>
) that will indicate which device to select for the events.
Examples
-
core.stat=core
- events starting with/core/
(or no prefix!) selected with:wperf stat -e <event>
-
wperf stat -e /core/<event>
or - will be used to count events over time.
-
core.sample=core
- events starting with/core/
(or no prefix!) selected withwperf sample -e <event>
-
wperf sample -e /core/<event>
or - will be used to sample events over time.
-
dmc.stat=dmc_clk,dmc_clkdiv2 - events starting with
/dmc_clk/or
/dmc_clkdiv2/ ` selected with:-
wperf stat -e /dmc_clk/<event>
or -
wperf stat -e /dmc_clkdiv2/<events
will be used to count events over time.
-
Assumptions:
- One driver can have many capabilities in their Device_ID string.
- Driver yields data for each capability information in Device_ID string.
I've defined these strings:
#define WPERF_HW_CFG_CAPS_CORE_STAT "core.stat=core"
#define WPERF_HW_CFG_CAPS_CORE_SAMPLE "core.sample=core"
#define WPERF_HW_CFG_CAPS_CORE_DSU "dsu.stat=dsu"
#define WPERF_HW_CFG_CAPS_CORE_DMC "dmc.stat=dmc_clk,dmc_clkdiv2"
Output for current driver:
>wperf test
>wperf test
Test Name Result
========= ======
request.ioctl_events [EVT_CORE] False
request.ioctl_events [EVT_DSU] False
request.ioctl_events [EVT_DMC_CLK/EVT_DMC_CLKDIV2] False
pmu_device.vendor_name Arm Limited
pmu_device.product_name neoverse-n1
pmu_device.product_name(extended) Neoverse N1 (neoverse-n1), armv8.1, pmu_v3
pmu_device.product [] armv8-a,armv9-a,neoverse-n1,neoverse-n2,neoverse-n2-r0p0,neoverse-n2-r0p1,neoverse-n2-r0p3,neoverse-v1
pmu_device.m_product_alias (neoverse-n2-r0p0:neoverse-n2),(neoverse-n2-r0p1:neoverse-n2)
pmu_device.events_query(events) [EVT_CORE] 110
pmu_device.events_query(events) [EVT_DSU] 9
pmu_device.events_query(events) [EVT_DMC_CLK] 3
pmu_device.events_query(events) [EVT_DMC_CLKDIV2] 26
pmu_device.sampling.INTERVAL_DEFAULT 0x4000000
pmu_device.version_name FEAT_PMUv3p1
PMU_CTL_QUERY_HW_CFG [arch_id] 0x000f
PMU_CTL_QUERY_HW_CFG [core_num] 0x0050
PMU_CTL_QUERY_HW_CFG [fpc_num] 0x0001
PMU_CTL_QUERY_HW_CFG [gpc_num] 0x0006
PMU_CTL_QUERY_HW_CFG [total_gpc_num] 0x0006
PMU_CTL_QUERY_HW_CFG [part_id] 0x0d0c
PMU_CTL_QUERY_HW_CFG [pmu_ver] 0x0004
PMU_CTL_QUERY_HW_CFG [rev_id] 0x0001
PMU_CTL_QUERY_HW_CFG [variant_id] 0x0003
PMU_CTL_QUERY_HW_CFG [vendor_id] 0x0041
PMU_CTL_QUERY_HW_CFG [midr_value] 0x000000000000413fd0c1
PMU_CTL_QUERY_HW_CFG [id_aa64dfr0_value] 0x00000000000110305408
PMU_CTL_QUERY_HW_CFG [counter_idx_map] 0,1,2,3,4,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31
PMU_CTL_QUERY_HW_CFG [device_id_str] core.stat=core;core.sample=core;dsu.stat=dsu;dmc.stat=dmc_clk,dmc_clkdiv2
gpc_nums[EVT_CORE] 6
gpc_nums[EVT_DSU] 6
gpc_nums[EVT_DMC_CLK] 2
gpc_nums[EVT_DMC_CLKDIV2] 8
fpc_nums[EVT_CORE] 1
fpc_nums[EVT_DSU] 1
fpc_nums[EVT_DMC_CLK] 0
fpc_nums[EVT_DMC_CLKDIV2] 0
In this patch:
- wperf-scripts: fix event name to include some extra characters
- wperf-scripts: add smoke tests for PMU_CTL_QUERY_HW_CFG [device_id_str]
- wperf: print hw_cfg::device_id_str in 'wperf test'
- wperf-driver: fill hw_cfg::device_id_str with data
- wperf-common: use wchar_t for wide-string
- wperf-common: add device_id_str[MAX_DEVICE_ID_STR_SIZE] to HW_CFG iorequest
- wperf-driver: make WPERF_HW_CFG_CAPS_ wide-strings
- wperf-driver: add descriptors to the driver
Testing on Ampere
>pytest
=================================================================================== test session starts ===================================================================================
platform win32 -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\Users\przemek\Desktop\wperf\merge-request\3.4.2, configfile: pytest.ini
collected 422 items / 1 skipped
wperf_cli_common_test.py .... [ 0%]
wperf_cli_config_test.py ..... [ 2%]
wperf_cli_cpython_bench_test.py .s [ 2%]
wperf_cli_cpython_dep_record_test.py . [ 2%]
wperf_cli_dmc_test.py . [ 3%]
wperf_cli_extra_events_test.py .... [ 4%]
wperf_cli_hammer_core_test.py .................. [ 8%]
wperf_cli_info_str_test.py . [ 8%]
wperf_cli_json_validator_test.py ........... [ 11%]
wperf_cli_list_test.py ..... [ 12%]
wperf_cli_lock_test.py ..... [ 13%]
wperf_cli_metrics_test.py ................ [ 17%]
wperf_cli_padding_test.py .............. [ 20%]
wperf_cli_prettytable_test.py ..... [ 21%]
wperf_cli_record_test.py ................s [ 25%]
wperf_cli_sample_test.py .. [ 26%]
wperf_cli_stat_test.py .................................................... [ 38%]
wperf_cli_stat_value_test.py ....................................................................................................................................................... [ 74%]
............................. [ 81%]
wperf_cli_test_test.py ........... [ 83%]
wperf_cli_timeline_test.py .................................. [ 91%]
wperf_cli_ustress_bench_test.py ...... [ 93%]
wperf_cli_ustress_dep_record_test.py .. [ 93%]
wperf_cli_ustress_dep_wperf_test.py ....... [ 95%]
wperf_cli_ustress_timeline_test.py .................. [ 99%]
wperf_lib_app_test.py s [100%]
============================================================================= WindowsPerf Test Configuration ==============================================================================
OS: Windows-10-10.0.25217-SP0, ARM64
CPU: 80 x ARMv8 (64-bit) Family 8 Model D0C Revision 301, Ampere(R)
Python: 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:44:02) [MSC v.1934 64 bit (ARM64)]
Time: 04/03/2024, 07:08:14
wperf: 3.4.2.16694c4a
wperf-driver: 3.4.2.16694c4a
================================================================================= short test summary info =================================================================================
SKIPPED [1] wperf_cli_ustress_dep_wperf_lib_timeline_test.py:110: Can not find wperf-lib-timeline.exe
SKIPPED [1] wperf_cli_cpython_bench_test.py:80: skipping CPython rebuild procedure (already built), cleanup CPython build with 'cpython\PCbuild\clean.bat'
SKIPPED [1] wperf_cli_record_test.py:154: this test is applicable only if `gpc_num` < `total_gpc_num`, now: gpc_num=6 and total_gpc_num=6
SKIPPED [1] wperf_lib_app_test.py:44: Can not run wperf-lib-app.exe
======================================================================= 419 passed, 4 skipped in 1554.85s (0:25:54) =======================================================================
Edited by Przemyslaw Wirkus