aboutsummaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2023-09-29selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and ↵Juntong Deng2-4/+4
hugetlb_reparenting_test.sh that may cause error According to the awk manual, the -e option does not need to be specified in front of 'program' (unless you need to mix program-file). The redundant -e option can cause error when users use awk tools other than gawk (for example, mawk does not support the -e option). Error Example: awk: not an option: -e Link: https://lkml.kernel.org/r/VI1P193MB075228810591AF2FDD7D42C599C3A@VI1P193MB0752.EURP193.PROD.OUTLOOK.COM Signed-off-by: Juntong Deng <[email protected]> Cc: Shuah Khan <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
2023-09-29selftest/bpf: Add various selftests for program limitsDaniel Borkmann1-0/+84
Add various tests to check maximum number of supported programs being attached: # ./vmtest.sh -- ./test_progs -t tc_opts [...] ./test_progs -t tc_opts [ 1.185325] bpf_testmod: loading out-of-tree module taints kernel. [ 1.186826] bpf_testmod: module verification failed: signature and/or required key missing - tainting kernel [ 1.270123] tsc: Refined TSC clocksource calibration: 3407.988 MHz [ 1.272428] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x311fc932722, max_idle_ns: 440795381586 ns [ 1.276408] clocksource: Switched to clocksource tsc #252 tc_opts_after:OK #253 tc_opts_append:OK #254 tc_opts_basic:OK #255 tc_opts_before:OK #256 tc_opts_chain_classic:OK #257 tc_opts_chain_mixed:OK #258 tc_opts_delete_empty:OK #259 tc_opts_demixed:OK #260 tc_opts_detach:OK #261 tc_opts_detach_after:OK #262 tc_opts_detach_before:OK #263 tc_opts_dev_cleanup:OK #264 tc_opts_invalid:OK #265 tc_opts_max:OK <--- (new test) #266 tc_opts_mixed:OK #267 tc_opts_prepend:OK #268 tc_opts_replace:OK #269 tc_opts_revision:OK Summary: 18/0 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
2023-09-29libbpf: Allow Golang symbols in uprobe secdefHengqi Chen1-6/+16
Golang symbols in ELF files are different from C/C++ which contains special characters like '*', '(' and ')'. With generics, things get more complicated, there are symbols like: github.com/cilium/ebpf/internal.(*Deque[go.shape.interface { Format(fmt.State, int32); TypeName() string;github.com/cilium/ebpf/btf.copy() github.com/cilium/ebpf/btf.Type}]).Grow Matching such symbols using `%m[^\n]` in sscanf, this excludes newline which typically does not appear in ELF symbols. This should work in most use-cases and also work for unicode letters in identifiers. If newline do show up in ELF symbols, users can still attach to such symbol by specifying bpf_uprobe_opts::func_name. A working example can be found at this repo ([0]). [0]: https://github.com/chenhengqi/libbpf-go-symbols Suggested-by: Andrii Nakryiko <[email protected]> Signed-off-by: Hengqi Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
2023-09-29bpf, sockmap: Add tests for MSG_F_PEEKJohn Fastabend1-0/+51
Test that we can read with MSG_F_PEEK and then still get correct number of available bytes through FIONREAD. The recv() (without PEEK) then returns the bytes as expected. The recv() always worked though because it was just the available byte reporting that was broke before latest fixes. Signed-off-by: John Fastabend <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Reviewed-by: Jakub Sitnicki <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
2023-09-29kselftest/arm64: Verify HWCAP2_SVE_B16B16Mark Brown1-0/+13
Validate that SVE B16B16 support is reported correctly and consistently to userspace. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
2023-09-28selftests/lkdtm: Disable CONFIG_UBSAN_TRAP in test configRicardo Cañuelo2-2/+1
The lkdtm selftest config fragment enables CONFIG_UBSAN_TRAP to make the ARRAY_BOUNDS test kill the calling process when an out-of-bound access is detected by UBSAN. However, after this [1] commit, UBSAN is triggered under many new scenarios that weren't detected before, such as in struct definitions with fixed-size trailing arrays used as flexible arrays. As a result, CONFIG_UBSAN_TRAP=y has become a very aggressive option to enable except for specific situations. `make kselftest-merge` applies CONFIG_UBSAN_TRAP=y to the kernel config for all selftests, which makes many of them fail because of system hangs during boot. This change removes the config option from the lkdtm kselftest and configures the ARRAY_BOUNDS test to look for UBSAN reports rather than relying on the calling process being killed. [1] commit 2d47c6956ab3 ("ubsan: Tighten UBSAN_BOUNDS on GCC")' Signed-off-by: Ricardo Cañuelo <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2023-09-28lkdtm/bugs: add test for panic() with stuck secondary CPUsMark Rutland1-0/+1
Upon a panic() the kernel will use either smp_send_stop() or crash_smp_send_stop() to attempt to stop secondary CPUs via an IPI, which may or may not be an NMI. Generally it's preferable that this is an NMI so that CPUs can be stopped in as many situations as possible, but it's not always possible to provide an NMI, and there are cases where CPUs may be unable to handle the NMI regardless. This patch adds a test for panic() where all other CPUs are stuck with interrupts disabled, which can be used to check whether the kernel gracefully handles CPUs failing to respond to a stop, and whether NMIs actually work to stop CPUs. For example, on arm64 *without* an NMI, this results in: | # echo PANIC_STOP_IRQOFF > /sys/kernel/debug/provoke-crash/DIRECT | lkdtm: Performing direct entry PANIC_STOP_IRQOFF | Kernel panic - not syncing: panic stop irqoff test | CPU: 2 PID: 24 Comm: migration/2 Not tainted 6.5.0-rc3-00077-ge6c782389895-dirty #4 | Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 | Stopper: multi_cpu_stop+0x0/0x1a0 <- stop_machine_cpuslocked+0x158/0x1a4 | Call trace: | dump_backtrace+0x94/0xec | show_stack+0x18/0x24 | dump_stack_lvl+0x74/0xc0 | dump_stack+0x18/0x24 | panic+0x358/0x3e8 | lkdtm_PANIC+0x0/0x18 | multi_cpu_stop+0x9c/0x1a0 | cpu_stopper_thread+0x84/0x118 | smpboot_thread_fn+0x224/0x248 | kthread+0x114/0x118 | ret_from_fork+0x10/0x20 | SMP: stopping secondary CPUs | SMP: failed to stop secondary CPUs 0-3 | Kernel Offset: 0x401cf3490000 from 0xffff80008000000c0 | PHYS_OFFSET: 0x40000000 | CPU features: 0x00000000,68c167a1,cce6773f | Memory Limit: none | ---[ end Kernel panic - not syncing: panic stop irqoff test ]--- Note the "failed to stop secondary CPUs 0-3" message. On arm64 *with* an NMI, this results in: | # echo PANIC_STOP_IRQOFF > /sys/kernel/debug/provoke-crash/DIRECT | lkdtm: Performing direct entry PANIC_STOP_IRQOFF | Kernel panic - not syncing: panic stop irqoff test | CPU: 1 PID: 19 Comm: migration/1 Not tainted 6.5.0-rc3-00077-ge6c782389895-dirty #4 | Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 | Stopper: multi_cpu_stop+0x0/0x1a0 <- stop_machine_cpuslocked+0x158/0x1a4 | Call trace: | dump_backtrace+0x94/0xec | show_stack+0x18/0x24 | dump_stack_lvl+0x74/0xc0 | dump_stack+0x18/0x24 | panic+0x358/0x3e8 | lkdtm_PANIC+0x0/0x18 | multi_cpu_stop+0x9c/0x1a0 | cpu_stopper_thread+0x84/0x118 | smpboot_thread_fn+0x224/0x248 | kthread+0x114/0x118 | ret_from_fork+0x10/0x20 | SMP: stopping secondary CPUs | Kernel Offset: 0x55a9c0bc0000 from 0xffff800080000000 | PHYS_OFFSET: 0x40000000 | CPU features: 0x00000000,68c167a1,fce6773f | Memory Limit: none | ---[ end Kernel panic - not syncing: panic stop irqoff test ]--- Note the absence of a "failed to stop secondary CPUs" message, since we don't log anything when secondary CPUs are successfully stopped. Signed-off-by: Mark Rutland <[email protected]> Cc: Douglas Anderson <[email protected]> Cc: Kees Cook <[email protected]> Cc: Stephen Boyd <[email protected]> Cc: Sumit Garg <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2023-09-28selftests: netfilter: test nat source port clash resolution interaction with ↵Florian Westphal1-9/+37
tcp early demux Test that nat engine resolves the source port clash and tcp packet is passed to the correct socket. While at it, get rid of the iperf3 dependency, just use socat for listener side too. Signed-off-by: Florian Westphal <[email protected]>
2023-09-28selftests/tc-testing: update tdc documentationPedro Tammela1-55/+10
Update the documentation to reflect the changes made to tdc with regards to minimal requirements and test definitions expectations. Tested-by: Davide Caratti <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2023-09-28selftests/tc-testing: implement tdc parallel test runPedro Tammela3-57/+148
Use a Python process pool to run the tests in parallel. Not all tests can run in parallel, for instance tests that are not namespaced and tests that use netdevsim, as they can conflict with one another. The code logic will split the tests into serial and parallel. For the parallel tests, we build batches of 32 tests and queue each batch on the process pool. For the serial tests, they are queued as a whole into the process pool, which in turn executes them concurrently with the parallel tests. Even though the tests serialize on rtnl_lock in the kernel, this feature showed results with a ~3x speedup on the wall time for the entire test suite running in a VM: Before - 4m32.502s After - 1m19.202s Examples: In order to run tdc using 4 processes: ./tdc.py -J4 <...> In order to run tdc using 1 process: ./tdc.py -J1 <...> || ./tdc.py <...> Note that the kernel configuration will affect the speed of the tests, especially if such configuration slows down process creation and/or fork(). Tested-by: Davide Caratti <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2023-09-28selftests/tc-testing: update test definitions for local resourcesPedro Tammela51-1114/+2369
With resources localized on a per test basis, some tests definitions either contain redundant commands, were wrong or could be simplified. Update all of them to match the new requirements. Tested-by: Davide Caratti <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2023-09-28selftests/tc-testing: localize test resourcesPedro Tammela5-98/+229
As of today, the current tdc architecture creates one netns and uses it to run all tests. This assumption was embedded into the nsPlugin which carried over as how the tests were written. The tdc tests are by definition self contained and can, theoretically, run in parallel. Even though in the kernel they will serialize over the rtnl lock, we should expect a significant speedup of the total wall time for the entire test suite, which is hitting close to 1100 tests at this point. A first step to achieve this goal is to remove sharing of global resources like veth/dummy interfaces and the netns. In this patch we 'localize' these resources on a per test basis. Each test gets it's own netns, VETH/dummy interfaces. The resources are spawned in the pre_suite phase, where tdc will prepare all netns and interfaces for all tests. This is done in order to avoid concurrency issues with netns / interfaces spawning and commands using them. As tdc progresses, the resources are deleted after each test finishes executing. Tests that don't use the nsPlugin still run under the root namespace, but are now required to manage any external resources like interfaces. These cannot be parallelized as their definition doesn't allow it. On the other hand, when using the nsPlugin, tests don't need to create dummy/veth interfaces as these are handled already. Tested-by: Davide Caratti <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2023-09-27perf test: Fix parse-events tests to skip parametrized eventsAthira Rajeev1-0/+39
Testcase "Parsing of all PMU events from sysfs" parse events for all PMUs, and not just cpu. In case of powerpc, the PowerVM environment supports events from hv_24x7 and hv_gpci PMU which is of example format like below: - hv_24x7/CPM_ADJUNCT_INST,domain=?,core=?/ - hv_gpci/event,partition_id=?/ The value for "?" needs to be filled in depending on system configuration. It is better to skip these parametrized events in this test as it is done in: 'commit b50d691e50e6 ("perf test: Fix "all PMU test" to skip parametrized events")' which handled a simialr instance with "all PMU test". Fix parse-events test to skip parametrized events since it needs proper setup of the parameters. Signed-off-by: Athira Rajeev <[email protected]> Tested-by: Ian Rogers <[email protected]> Tested-by: Sachin Sant <[email protected]> Reviewed-by: Kajol Jain <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf vendor events: Add JSON metrics for Arm CMNJing Zhang1-0/+74
Add JSON metrics for Arm CMN. Currently just add part of CMN PMU metrics which are general and compatible for any SoC with CMN-ANY. Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf jevents: Add support for Arm CMN PMU aliasingJing Zhang2-0/+267
Currently just add aliases for part of Arm CMN PMU events which are general and compatible for any SoC and CMN-ANY. "Compat" value "(434|436|43c|43a).*" means it is compatible with all CMN600/CMN650/CMN700/Ci700, which can be obtained from commit 7819e05a0dce ("perf/arm-cmn: Revamp model detection"). The arm-cmn PMU events got from: [0] https://developer.arm.com/documentation/100180/0302/?lang=en [1] https://developer.arm.com/documentation/101408/0100/?lang=en [2] https://developer.arm.com/documentation/102308/0302/?lang=en [3] https://developer.arm.com/documentation/101569/0300/?lang=en Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf test: Add pmu-event test for "Compat" and new event_field.Jing Zhang3-0/+71
Add new event test for uncore system event which is used to verify the functionality of "Compat" matching multiple identifiers and the new event fields "EventidCode" and "NodeType". Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: John Garry <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf test: Make matching_pmu effectiveJing Zhang1-2/+8
The perf_pmu_test_event.matching_pmu didn't work. No matter what its value is, it does not affect the test results. So let matching_pmu be used for matching perf_pmu_test_pmu.pmu.name. Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf jevents: Support EventidCode and NodeTypeJing Zhang1-1/+9
The previous code assumes an event has either an "event=" or "config" field at the beginning. For CMN neither of these may be present, as an event is typically "type=xx,eventid=xxx". So add EventidCode and NodeType to support CMN event description. I compared pmu_event.c before and after compiling with JEVENT_ARCH=all, they are consistent. Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: John Garry <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf metric: "Compat" supports regular expression matching identifiersJing Zhang1-1/+1
The jevent "Compat" is used for uncore PMU alias or metric definitions. The same PMU driver has different PMU identifiers due to different hardware versions and types, but they may have some common PMU metric. Since a Compat value can only match one identifier, when adding the same metric to PMUs with different identifiers, each identifier needs to be defined once, which is not streamlined enough. So let "Compat" support using regular expression to match multiple identifiers for uncore PMU metric. Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf pmu: "Compat" supports regular expression matching identifiersJing Zhang2-2/+26
The jevent "Compat" is used for uncore PMU alias or metric definitions. The same PMU driver has different PMU identifiers due to different hardware versions and types, but they may have some common PMU event. Since a Compat value can only match one identifier, when adding the same event alias to PMUs with different identifiers, each identifier needs to be defined once, which is not streamlined enough. So let "Compat" support using regular expression to match identifiers for uncore PMU alias. For example, if the "Compat" value is set to "43401|43c01", it would be able to match PMU identifiers such as "43401" or "43c01", which correspond to CMN600_r0p0 or CMN700_r0p0. Signed-off-by: Jing Zhang <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: James Clark <[email protected]> Cc: Will Deacon <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mike Leach <[email protected]> Cc: Shuai Xue <[email protected]> Cc: Zhuo Song <[email protected]> Cc: John Garry <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27perf record: Fix BTF type checks in the off-cpu profilingNamhyung Kim1-2/+3
The BTF func proto for a tracepoint has one more argument than the actual tracepoint function since it has a context argument at the begining. So it should compare to 5 when the tracepoint has 4 arguments. typedef void (*btf_trace_sched_switch)(void *, bool, struct task_struct *, struct task_struct *, unsigned int); Also, recent change in the perf tool would use a hand-written minimal vmlinux.h to generate BTF in the skeleton. So it won't have the info of the tracepoint. Anyway it should use the kernel's vmlinux BTF to check the type in the kernel. Fixes: b36888f71c85 ("perf record: Handle argument change in sched_switch") Reviewed-by: Ian Rogers <[email protected]> Acked-by: Song Liu <[email protected]> Cc: Hao Luo <[email protected]> CC: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
2023-09-27tools/power/turbostat: Remove PC7/PC9 support on ADL/RPLZhang Rui1-6/+23
Compared with other platforms that share cnl_features, ADL/RPL don't have PC7/PC9. Clone a new platform feature set from cnl_features for ADL/RPL, with PC7/PC9 removed. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Enable MSR_CORE_C1_RES on recent Intel client platformsZhang Rui1-0/+1
All recent Intel client platforms have MSR_CORE_C1_RES. Enable the support on these platforms, including CNL/ICL/LKF/RKL/TGL/ADL/RPL/MTL. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Introduce probe_pm_features()Zhang Rui1-2/+4
Feature probe has nothing to do with CPUID, thus it should not be in process_cpuids(). Introduce probe_pm_features() and move all feature probing functions into it. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Relocate more probing related codeZhang Rui1-20/+17
Relocate more feature probing code outside of process_cpuids() into the corresponding probing functions. This improves the readability of code and the turbostat output. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Reorder some functionsZhang Rui1-107/+107
Reorder some functions to solve code depdency introduced by next patch. No functional change. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Relocate thermal probing codeZhang Rui1-5/+10
Introduce probe_thermal(), and move all thermal probing related code into it. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Relocate lpi probing codeZhang Rui1-16/+22
Introduce probe_lpi(), and move all lpi probing related code into it. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Relocate graphics probing codeZhang Rui1-11/+16
Introduce probe_graphics(), and move all graphics probing related code into it. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Rename rapl probing functionZhang Rui1-4/+4
Rename rapl_probe() to probe_rapl() to be consistent with other probing function names. Probe rapl after probing uncore frequency. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Rename uncore probing functionZhang Rui1-3/+3
Rename intel_uncore_frequency_probe() to probe_intel_uncore_frequency() to be consistent with other probing function names. Probe uncore frequency right after probing cstates. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Relocate pstate probing codeZhang Rui1-18/+21
Introduce probe_pstates() and move all pstate probing related code into it. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Relocate cstate probing codeZhang Rui1-19/+31
Move all cstate probing related code into probe_cstates(). Note that dump_platform_info() actually dumps both MSR_PLATFORM_INFO and MSR_IA32_POWER_CTL. MSR_PLATFORM_INFO is for pstate and MSR_IA32_POWER_CTL is for cstate. So split dump_platform_info() and dump MSR_IA32_POWER_CTL in probe_cstates(). Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Improve probe_platform_features() logicZhang Rui1-7/+2
AMD/Hygon platforms that don't have RAPL use 'amd_features' to describe the platform features. Unknown Intel platforms use 'default_features' to describe the platform features. As none of the platform feature is set for 'amd_features' or 'default_features', there is no need to maintain both of them. Remove 'amd_features' structure and improve the logic in probe_platform_features(). Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Delete intel_model_duplicates()Zhang Rui1-59/+0
Now CPU model checks have been cleaned up, no code depends on the duplicated CPU model value. Delete intel_model_duplicates(). Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract cstate prewake bit supportZhang Rui1-43/+4
Abstract cstate prewake bit support. Delete is_icx()/is_spr() CPU model checks. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract aperf/mperf multiplier supportZhang Rui1-23/+3
Abstract aperf/mperf multiplier support. Delete is_knl() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract extended cstate MSRs supportZhang Rui1-25/+4
Abstract the support for MSR_PKG_WEIGHTED_CORE_C0_RES, MSR_PKG_ANY_CORE_C0_RES, MSR_PKG_ANY_GFXE_C0_RES and MSR_PKG_BOTH_CORE_GFXE_C0_RES. Delete has_skl_msrs() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract MSR_KNL_CORE_C6_RESIDENCY supportZhang Rui1-4/+4
Abstract the support for MSR_KNL_CORE_C6_RESIDENCY. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract MSR_ATOM_PKG_C6_RESIDENCY supportZhang Rui1-19/+4
Abstract the support for MSR_ATOM_PKG_C6_RESIDENCY. Delete is_slm() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract MSR_CC6/MC6_DEMOTION_POLICY_CONFIG supportZhang Rui1-23/+6
Abstract the support for MSR_CC6/MC6_DEMOTION_POLICY_CONFIG. Delete has_slv_msrs() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract MSR_MODULE_C6_RES_MS supportZhang Rui1-2/+4
Abstract MSR_MODULE_C6_RES_MS support. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract MSR_CORE_C1_RES supportZhang Rui1-24/+6
Abstract the support for MSR_CORE_C1_RES. Delete is_dnv() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Abstract IRTL supportZhang Rui1-46/+26
Abstract the support for MSR_PKGC3/PKGC6/PKGC7/PKGC8/PKGC9/PKGC10_IRTL. Delete has_snb_msrs() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Use fine grained IRTL outputZhang Rui1-63/+36
It is pointless to dump the IRTL register for a package cstate that is not supported by the platform. Print IRTL only for states that are available in platform->supported_cstates. Delete has_c8910_msrs() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Adjust cstate for is_slm()/is_knl()/is_cnl()/is_ehl() ↵Zhang Rui1-39/+5
models Disable CC3 for is_slm()/is_knl()/is_cnl()/is_ehl() models. Delete is_cnl()/is_ehl() CPU model checks. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Adjust cstate for has_c8910_msrs() modelsZhang Rui1-15/+7
Enable PC8/PC9/PC10 for has_c8910_msrs() models. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Adjust cstate for is_bdx() modelsZhang Rui1-21/+1
Disable CC7/PC7 for is_bdx() models. Delete is_bdx() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Adjust cstate for is_skx()/is_icx()/is_spr() modelsZhang Rui1-25/+3
Disable CC3/CC7/PC3/PC7 for is_skx()/is_icx()/is_spr() models. Delete is_skx() CPU model check. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>
2023-09-27tools/power/turbostat: Adjust cstate for is_dnv() modelsZhang Rui1-6/+1
Enable CC1 and disable CC3/CC7/PC3/PC7 for is_dnv() models. Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Len Brown <[email protected]>