Commit Graph

1269 Commits

Author SHA1 Message Date
Linus Torvalds
a90f1cd105 Turbostat 2024.05.10 update since 2024.04.08:
Survive sparse die id's seen in Linux-6.9.
 
 Handle clustered-uncore topology in new/upcoming hardware.
 
 For non-root use, add ability to see software C-state counters.
 
 Enable reading core and package hardware cstate via perf,
 and prefer perf over the MSR driver access for these counters.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmZFaXAUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3NheYUQ//TwXL3Tc0LzontUz478jyPskHwylv
 cXk7eGrdQthYQhPUvY8BWei9j8RBZBIke8n1GE7oHH7BHuGbn68BkH+QOqN4B+sA
 n4uJ8JUJYXlfFrcUDGJoHXZn5AWhSKlJUV7jcZXijyuEdZsqisJf4kubSeBlzJRg
 hLFk9uDh+m3+WTiQZliY7Kfx8TRVnXlqHTodB3behmE9Q8NmRVZ0xxAiS129giLk
 t/nI5j/EP5tDRLZDn//ozrkQydRa8Oxp82pOwo2cUkKGMfwV3Ee9b959laQ1omEO
 lfZxEJI0Tw5v0R6wejrZPZhv/p9yH8vspCNf7zaKgiFwjmhg+Afjv8R7eH6FwGOY
 cr4KlzjIcYM8ZWHyz5pttHo2hOZnTxDHdXHXXXXZ0do5+f4+onyyUqRvdslZST/b
 z+4+FBIQGkt0m9ToONvZuNuqBepNhd4Sh4aV2sNpT8zvmS1aSWw77Ts7apefCthI
 +/HU8HYd5/+8pg5vsBxFM6i39ekV3TPftjfrT7hbYFab8VFehXeC2rmUotwkZlWq
 CYyCVl3IvaVNlw23fib+uMpjrEL+gotOT1Ol130/ahIfb0hD5clkPD6X1D5hOkhX
 5jZ9EizmXi4Mwqsdep513vCsfqT9M0FCG3f+gIQcYiW4GpuGAj8PFGMbWIaqwL77
 6PLw9rdlIkDVDMw=
 =7ZNt
 -----END PGP SIGNATURE-----

Merge tag 'turbostat-for-Linux-6.10-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:

 - Survive sparse die id's seen in Linux-6.9

 - Handle clustered-uncore topology in new/upcoming hardware

 - For non-root use, add ability to see software C-state counters

 - Enable reading core and package hardware cstate via perf, and prefer
   perf over the MSR driver access for these counters

* tag 'turbostat-for-Linux-6.10-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: version 2024.05.10
  tools/power turbostat: Ignore pkg_cstate_limit when it is not available
  tools/power turbostat: Fix order of strings in pkg_cstate_limit_strings
  tools/power turbostat: Read Package-cstates via perf
  tools/power turbostat: Read Core-cstates via perf
  tools/power turbostat: Avoid possible memory corruption due to sparse topology IDs
  tools/power turbostat: Add columns for clustered uncore frequency
  tools/power turbostat: Enable non-privileged users to read sysfs counters
  tools/power turbostat: Replace _Static_assert with BUILD_BUG_ON
  tools/power turbostat: Add ARL-H support
  tools/power turbostat: Enhance ARL/LNL support
  tools/power turbostat: Survive sparse die_id
  tools/power turbostat: Remember global max_die_id
  tools/power turbostat: Harden probe_intel_uncore_frequency()
  tools/power turbostat: Add "snapshot:" Makefile target
2024-05-19 12:33:28 -07:00
Linus Torvalds
ea5f6ad9ad platform-drivers-x86 for v6.10-1
Highlights:
  - New drivers/platform/arm64 directory for arm64 embedded-controller drivers
  - New drivers for:
    - Acer Aspire 1 embedded controllers (for arm64 models)
    - ACPI quickstart PNP0C32 buttons
    - Dell All-In-One backlight support (dell-uart-backlight)
    - Lenovo WMI camera buttons
    - Lenovo Yoga Tablet 2 Pro 1380F/L fast charging
    - MeeGoPad ANX7428 Type-C Cross Switch (power sequencing only)
    - MSI WMI sensors (fan speed sensors only for now)
  - Asus WMI:
    - 2024 ROG Mini-LED support
    - MCU powersave support
    - Vivobook GPU MUX support
    - Misc. other improvements
  - Ideapad laptop:
    - Export FnLock LED as LED class device
    - Switch platform profiles using thermal management key
  - Intel drivers:
    - IFS: various improvements
    - PMC: Lunar Lake support
    - SDSI: various improvements
    - TPMI/ISST: various improvements
    - tools: intel-speed-select: various improvements
  - MS Surface drivers:
    - Fan profile switching support
    - Surface Pro thermal sensors support
  - ThinkPad ACPI:
    - Reworked hotkey support to use sparse keymaps
    - Add support for new trackpoint-doubletap, Fn+N and Fn+G hotkeys
  - WMI core:
    - New WMI driver development guide
  - x86 Android tablets:
    - Lenovo Yoga Tablet 2 Pro 1380F/L support
    - Xiaomi MiPad 2 status LED and bezel touch buttons backlight support
  - Miscellaneous cleanups / fixes / improvements
 
 The following is an automated git shortlog grouped by driver:
 
 ACPI:
  -  platform-profile: add platform_profile_cycle()
 
 Add ACPI quickstart button (PNP0C32) driver:
  - Add ACPI quickstart button (PNP0C32) driver
 
 Add lenovo-yoga-tab2-pro-1380-fastcharger driver:
  - Add lenovo-yoga-tab2-pro-1380-fastcharger driver
 
 Add new Dell UART backlight driver:
  - Add new Dell UART backlight driver
 
 Add lenovo WMI camera button driver:
  - Add lenovo WMI camera button driver
 
 Add new MeeGoPad ANX7428 Type-C Cross Switch driver:
  - Add new MeeGoPad ANX7428 Type-C Cross Switch driver
 
 ISST:
  -  Support SST-BF and SST-TF per level
  -  Add missing MODULE_DESCRIPTION
  -  Add dev_fmt
  -  Use in_range() to check package ID validity
  -  Support partitioned systems
  -  Shorten the assignments for power_domain_info
  -  Use local variable for auxdev->dev
 
 MAINTAINERS:
  -  drop Daniel Oliveira Nascimento
 
 arm64:
  -  dts: qcom: acer-aspire1: Add embedded controller
 
 asus-laptop:
  -  Use sysfs_emit() and sysfs_emit_at() to replace sprintf()
 
 asus-wmi:
  -  cleanup main struct to avoid some holes
  -  Add support for MCU powersave
  -  ROG Ally increase wait time, allow MCU powersave
  -  adjust formatting of ppt-<name>() functions
  -  store a min default for ppt options
  -  support toggling POST sound
  -  add support variant of TUF RGB
  -  add support for Vivobook GPU MUX
  -  add support for 2024 ROG Mini-LED
  -  use sysfs_emit() instead of sprintf()
 
 classmate-laptop:
  -  Add missing MODULE_DESCRIPTION()
 
 devm-helpers:
  -  Fix a misspelled cancellation in the comments
 
 dt-bindings:
  -  leds: Add LED_FUNCTION_FNLOCK
  -  platform: Add Acer Aspire 1 EC
 
 hp-wmi:
  -  use sysfs_emit() instead of sprintf()
 
 huawei-wmi:
  -  use sysfs_emit() instead of sprintf()
 
 ideapad-laptop:
  -  switch platform profiles using thermal management key
  -  add FnLock LED class device
  -  add fn_lock_get/set functions
 
 intel-vbtn:
  -  Log event code on unexpected button events
 
 intel/pmc:
  -  Enable S0ix blocker show in Lunar Lake
  -  Add support to show S0ix blocker counter
  -  Update LNL signal status map
 
 msi-laptop:
  -  Use sysfs_emit() to replace sprintf()
 
 p2sb:
  -  Don't init until unassigned resources have been assigned
  -  Make p2sb_get_devfn() return void
 
 platform:
  -  arm64: Add Acer Aspire 1 embedded controller driver
  -  Add ARM64 platform directory
 
 platform/surface:
  -  aggregator: Log critical errors during SAM probing
  -  aggregator_registry: Add support for thermal sensors on the Surface Pro 9
  -  platform_profile: add fan profile switching
 
 platform/x86/amd:
  -  pmc: Add new ACPI ID AMDI000B
  -  pmf: Add new ACPI ID AMDI0105
 
 platform/x86/amd/hsmp:
  -  switch to use device_add_groups()
 
 platform/x86/amd/pmc:
  -  Fix implicit declaration error on i386
  -  Add AMD MP2 STB functionality
 
 platform/x86/fujitsu-laptop:
  -  Replace sprintf() with sysfs_emit()
 
 platform/x86/intel-uncore-freq:
  -  Don't present root domain on error
 
 platform/x86/intel/ifs:
  -  Disable irq during one load stage
  -  trace: display batch num in hex
  -  Classify error scenarios correctly
 
 platform/x86/intel/pmc:
  -  Fix PCH names in comments
 
 platform/x86/intel/sdsi:
  -  Add attribute to read the current meter state
  -  Add in-band BIOS lock support
  -  Combine read and write mailbox flows
  -  Set message size during writes
 
 platform/x86/intel/tpmi:
  -  Add additional TPMI header fields
  -  Align comments in kernel-doc
  -  Check major version change for TPMI Information
  -  Handle error from tpmi_process_info()
 
 quickstart:
  -  Fix race condition when reporting input event
  -  fix Kconfig selects
  -  Miscellaneous improvements
 
 samsung-laptop:
  -  Use sysfs_emit() to replace the old interface sprintf()
 
 think-lmi:
  -  Convert container_of() macros to static inline
 
 thinkpad_acpi:
  -  Use false to set acpi_send_ev to false
  -  Support hotkey to disable trackpoint doubletap
  -  Support for system debug info hotkey
  -  Support for trackpoint doubletap
  -  Simplify known_ev handling
  -  Add mappings for adaptive kbd clipping-tool and cloud keys
  -  Switch to using sparse-keymap helpers
  -  Drop KEY_RESERVED special handling
  -  Use correct keycodes for volume and brightness keys
  -  Change hotkey_reserved_mask initialization
  -  Do not send ACPI netlink events for unknown hotkeys
  -  Move tpacpi_driver_event() call to tpacpi_input_send_key()
  -  Move hkey > scancode mapping to tpacpi_input_send_key()
  -  Drop tpacpi_input_send_key_masked() and hotkey_driver_event()
  -  Always call tpacpi_driver_event() for hotkeys
  -  Move hotkey_user_mask check to tpacpi_input_send_key()
  -  Move special original hotkeys handling out of switch-case
  -  Move adaptive kbd event handling to tpacpi_driver_event()
  -  Make tpacpi_driver_event() return if it handled the event
  -  Do hkey to scancode translation later
  -  Use tpacpi_input_send_key() in adaptive kbd code
  -  Drop ignore_acpi_ev
  -  Drop setting send_/ignore_acpi_ev defaults twice
  -  Provide hotkey_poll_stop_sync() dummy
  -  Take hotkey_mutex during hotkey_exit()
  -  change sprintf() to sysfs_emit()
  -  use platform_profile_cycle()
 
 tools arch x86:
  -  Add dell-uart-backlight-emulator
 
 tools/arch/x86/intel_sdsi:
  -  Add current meter support
  -  Simplify ascii printing
  -  Fix meter_certificate decoding
  -  Fix meter_show display
  -  Fix maximum meter bundle length
 
 tools/power/x86/intel-speed-select:
  -  v1.19 release
  -  Display CPU as None for -1
  -  SST BF/TF support per level
  -  Increase number of CPUs displayed
  -  Present all TRL levels for turbo-freq
  -  Fix display for unsupported levels
  -  Support multiple dies
  -  Increase die count
 
 toshiba_acpi:
  -  Add quirk for buttons on Z830
 
 uv_sysfs:
  -  use sysfs_emit() instead of sprintf()
 
 wmi:
  -  Add MSI WMI Platform driver
  -  Add driver development guide
  -  Mark simple WMI drivers as legacy-free
  -  Avoid returning AE_OK upon unknown error
  -  Support reading/writing 16 bit EC values
 
 x86-android-tablets:
  -  Create LED device for Xiaomi Pad 2 bottom bezel touch buttons
  -  Xiaomi pad2 RGB LED fwnode updates
  -  Pass struct device to init()
  -  Add Lenovo Yoga Tablet 2 Pro 1380F/L data
  -  Unregister devices in reverse order
  -  Add swnode for Xiaomi pad2 indicator LED
  -  Use GPIO_LOOKUP() macro
 
 xiaomi-wmi:
  -  Drop unnecessary NULL checks
  -  Fix race condition when reporting key events
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEEuvA7XScYQRpenhd+kuxHeUQDJ9wFAmZF1kwUHGhkZWdvZWRl
 QHJlZGhhdC5jb20ACgkQkuxHeUQDJ9wSXwgAsaSH6Sawn5sHOj52lQY7gNI0uf3V
 YfZFawRpreCrlwLPU2f7SX0mLW+hh+ekQ2C1NvaUUVqQwzONELh0DWSYJpzz/v1r
 jD14EcY2dnTv+FVyvCj5jZsiYxo/ViTvthMduiO7rrJKN7aOej9iNn68P0lvcY8s
 HDJ2lPFNGnY01snz3C1NyjyIWw8YsfwqXEqOmhrDyyoKLXpsDs8H/Jqq5yXfeLax
 hSpjbGB85EGJPXna6Ux5TziPh/MYMtF1+8R4Fn0sGvfcZO6/H1fDne0uI9UwrKnN
 d2g4VHXU2DIhTshUc14YT2AU27eQiZVN+J3VpuYIbC9cmlQ2F6bjN3uxoQ==
 =UWbu
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver updates from Hans de Goede:

 - New drivers/platform/arm64 directory for arm64 embedded-controller
   drivers

 - New drivers:
    - Acer Aspire 1 embedded controllers (for arm64 models)
    - ACPI quickstart PNP0C32 buttons
    - Dell All-In-One backlight support (dell-uart-backlight)
    - Lenovo WMI camera buttons
    - Lenovo Yoga Tablet 2 Pro 1380F/L fast charging
    - MeeGoPad ANX7428 Type-C Cross Switch (power sequencing only)
    - MSI WMI sensors (fan speed sensors only for now)

 - Asus WMI:
    - 2024 ROG Mini-LED support
    - MCU powersave support
    - Vivobook GPU MUX support
    - Misc. other improvements

 - Ideapad laptop:
    - Export FnLock LED as LED class device
    - Switch platform profiles using thermal management key

 - Intel drivers:
    - IFS: various improvements
    - PMC: Lunar Lake support
    - SDSI: various improvements
    - TPMI/ISST: various improvements
    - tools: intel-speed-select: various improvements

 - MS Surface drivers:
    - Fan profile switching support
    - Surface Pro thermal sensors support

 - ThinkPad ACPI:
    - Reworked hotkey support to use sparse keymaps
    - Add support for new trackpoint-doubletap, Fn+N and Fn+G hotkeys

 - WMI core:
    - New WMI driver development guide

 - x86 Android tablets:
    - Lenovo Yoga Tablet 2 Pro 1380F/L support
    - Xiaomi MiPad 2 status LED and bezel touch buttons backlight
      support

 - Miscellaneous cleanups / fixes / improvements

* tag 'platform-drivers-x86-v6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (128 commits)
  platform/x86: Add new MeeGoPad ANX7428 Type-C Cross Switch driver
  devm-helpers: Fix a misspelled cancellation in the comments
  tools arch x86: Add dell-uart-backlight-emulator
  platform/x86: Add new Dell UART backlight driver
  platform/x86: x86-android-tablets: Create LED device for Xiaomi Pad 2 bottom bezel touch buttons
  platform/x86: x86-android-tablets: Xiaomi pad2 RGB LED fwnode updates
  platform/x86: x86-android-tablets: Pass struct device to init()
  platform/x86/amd: pmc: Add new ACPI ID AMDI000B
  platform/x86/amd: pmf: Add new ACPI ID AMDI0105
  platform/x86: p2sb: Don't init until unassigned resources have been assigned
  platform/surface: aggregator: Log critical errors during SAM probing
  platform/x86: ISST: Support SST-BF and SST-TF per level
  platform/x86/fujitsu-laptop: Replace sprintf() with sysfs_emit()
  tools/power/x86/intel-speed-select: v1.19 release
  tools/power/x86/intel-speed-select: Display CPU as None for -1
  tools/power/x86/intel-speed-select: SST BF/TF support per level
  tools/power/x86/intel-speed-select: Increase number of CPUs displayed
  tools/power/x86/intel-speed-select: Present all TRL levels for turbo-freq
  tools/power/x86/intel-speed-select: Fix display for unsupported levels
  tools/power/x86/intel-speed-select: Support multiple dies
  ...
2024-05-16 09:14:50 -07:00
Len Brown
256d218ec6 tools/power turbostat: version 2024.05.10
New since 2024.04.08:

Len Brown (6):
      tools/power turbostat: Add "snapshot:" Makefile target
      tools/power turbostat: Harden probe_intel_uncore_frequency()
      tools/power turbostat: Remember global max_die_id
      tools/power turbostat: Survive sparse die_id
      tools/power turbostat: Add columns for clustered uncore frequency
      tools/power turbostat: version 2024.05.10

Patryk Wlazlyn (7):
      tools/power turbostat: Replace _Static_assert with BUILD_BUG_ON
      tools/power turbostat: Enable non-privileged users to read sysfs counters
      tools/power turbostat: Avoid possible memory corruption due to sparse topology IDs
      tools/power turbostat: Read Core-cstates via perf
      tools/power turbostat: Read Package-cstates via perf
      tools/power turbostat: Fix order of strings in pkg_cstate_limit_strings
      tools/power turbostat: Ignore pkg_cstate_limit when it is not available

Zhang Rui (2):
      tools/power turbostat: Enhance ARL/LNL support
      tools/power turbostat: Add ARL-H support

Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:17 -04:00
Patryk Wlazlyn
29fea61cd8 tools/power turbostat: Ignore pkg_cstate_limit when it is not available
When running in no-msr mode, the pkg_cstate_limit is not populated, thus
we use perf to determine if given pcstate counter is present on the
platform.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:16 -04:00
Patryk Wlazlyn
4e7ee02300 tools/power turbostat: Fix order of strings in pkg_cstate_limit_strings
Change the order so that it matches the indexes defined in:

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:16 -04:00
Patryk Wlazlyn
0451adf4d4 tools/power turbostat: Read Package-cstates via perf
Reading the counters via perf can be done in bulk with a single syscall,
making the counter values more accurate with respect to one another by
minimizing the time gap between individual counter reads.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:16 -04:00
Patryk Wlazlyn
1f9e46da9c tools/power turbostat: Read Core-cstates via perf
Reading the counters via perf can be done in bulk with a single syscall,
making the counter values more accurate with respect to one another by
minimizing the time gap between individual counter reads.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:16 -04:00
Patryk Wlazlyn
3559ea813a tools/power turbostat: Avoid possible memory corruption due to sparse topology IDs
Save the highest core and package id when parsing topology to
allocate enough memory when get_rapl_counters() is called with a core or
a package id as a domain.

Note that RAPL domains are per-package on Intel, but per-core on AMD.
Thus, the RAPL code effectively runs in different modes on those two
product lines.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:16 -04:00
Len Brown
78464d7681 tools/power turbostat: Add columns for clustered uncore frequency
New machines have multiple uncore frequencies per package,
visible in /sys/devices/system/cpu/intel_uncore_frequency/uncore##/

turbostat now samples these frequencies each measurement interval.

For each package, turbostat now prints "UMHzX.Y" columns,
where X = domain_id, and Y = fabric_cluster_id.

The system summary for each UMHzX.Y column is the average value
for across all of the packages in the system.

Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-15 21:50:06 -04:00
Patryk Wlazlyn
0e39702fbb tools/power turbostat: Enable non-privileged users to read sysfs counters
A group of counters called "sysfs" displays software
C-state request counts and resulting perceived C-state residency.

They are not built-in counters that turbostat knows about ahead of time,
rather they are discovered in sysfs when turbostat starts.

Thus, they are added dynamically, using the same interface
as user-added MSR counters.

When turbostat enters "no-msr" mode, such as when running as a
non-privileged user, it clears all added counters.

Updating that to clear only actual MSR added counters
allows regular users to see the sysfs counters.

[lenb: commit message]

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-01 00:04:25 -04:00
Patryk Wlazlyn
d3e6f62538 tools/power turbostat: Replace _Static_assert with BUILD_BUG_ON
So it compiles on GCC older than 9.0.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-01 00:04:24 -04:00
Zhang Rui
f04fcc7ac8 tools/power turbostat: Add ARL-H support
Add turbostat support for ARL-H, which behaves the same as ARL.

[lenb: also add ARL-U]

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-01 00:04:19 -04:00
Zhang Rui
196eca0206 tools/power turbostat: Enhance ARL/LNL support
ARL/LNL don't have PC8, other than that, it behaves the same as CNL.
Copy cnl_features for ARL/LNL, except that PC8 support is removed.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-05-01 00:04:12 -04:00
Srinivas Pandruvada
5cfac5abb6 tools/power/x86/intel-speed-select: v1.19 release
This version addresses issues with:
- Support of SST BF/TF support per level
- Increase number of CPUs displayed
- Present all TRL levels for turbo-freq
- Fix display for unsupported levels
- Support multiple dies
- Increase die count
- Change CPU display for non compute domain

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:50 +02:00
Srinivas Pandruvada
8ebc39ace3 tools/power/x86/intel-speed-select: Display CPU as None for -1
When there is no CPU in a power domain, display "None" instead of -1.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:50 +02:00
Srinivas Pandruvada
1fcf670e50 tools/power/x86/intel-speed-select: SST BF/TF support per level
SST BF and TF can be enabled/disabled per level. So check the current
level support from the mask of supported levels.

This change from a single level to mask for info.sst_tf_support and
info.sst_tf_support is indicated by API version change. Use as mask for
API version above 2. In this way there is no change in behavior when
running on older kernel with API version 2.

Since the tool can support now API version 3, update the supported API
version.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:50 +02:00
Srinivas Pandruvada
80a513e3f7 tools/power/x86/intel-speed-select: Increase number of CPUs displayed
Currently max 128 CPUs can be displayed in the enable CPU list. Double
the range. Since the size is big for stack allocation, change to static.
Here changing to static is fine as these functions are called in serial.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:50 +02:00
Srinivas Pandruvada
38fa152b3d tools/power/x86/intel-speed-select: Present all TRL levels for turbo-freq
For turbo-freq feature, only 3 levels of frequencies are displayed even
if platform support more. Present all levels based on the CPU model.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:50 +02:00
Srinivas Pandruvada
55d5639bda tools/power/x86/intel-speed-select: Fix display for unsupported levels
During call to "intel-speed-select turbo-freq info" some junk values are
reported for unsupported levels. Initialize the structure fact_info with
0s, so that isst_fact_display_information() will skip "0" values in the
frequency.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:50 +02:00
Srinivas Pandruvada
f926447133 tools/power/x86/intel-speed-select: Support multiple dies
When the die id is same as punit compute die ID, treat them same. In this
case, when for_each_online_power_domain_in_set() is called, then don't
loop for each punit in a die. Just loop for all punits in a package.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:49 +02:00
Srinivas Pandruvada
9ea48bdfd5 tools/power/x86/intel-speed-select: Increase die count
TPMI platform information supports up to 16 compute dies. So increase the
range.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29 13:31:49 +02:00
Chen Yu
d7bd0aeb5a ACPI: tools: pfrut: Print the update_cap field during capability query
There is request from the end user to print this field to better
query what type of update capability is supported on this platform.

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-04-26 19:27:34 +02:00
Len Brown
c8b246ea2e tools/power turbostat: Survive sparse die_id
Turbostat assumed that every package had a die_id = 0.
When this assumption was violated, it exited
when looking for the package uncore frequency:

turbostat: /sys/.../intel_uncore_frequency/package_01_die_00/current_freq_khz: open failed: No such file or directory

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-21 17:05:55 -04:00
Len Brown
cda2033886 tools/power turbostat: Remember global max_die_id
This is necessary to gracefully handle sparse die_id's.

no functional change

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-21 17:05:55 -04:00
Len Brown
ae3326ac57 tools/power turbostat: Harden probe_intel_uncore_frequency()
If sysfs directory "intel_uncore_frequency/cluster00/" exists,
then use uncore cluster code (now its own routine).

The previous check for
"intel_uncore_frequency/package_00_die_00/current_freq_khz",
could be unreliable in the face of sparse die id's.

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-21 17:05:55 -04:00
Len Brown
231ce08b66 tools/power turbostat: Add "snapshot:" Makefile target
Kernel developers often need to diagnose remote customer systems
with the latest turbostat, yet customers are running binary distros
with out-dated turbostat and the customer has no experience
cloning linux kernel trees.

Add a turbostat "snapshot" makefile target to create a standalone
source snapshot from the developer's git tree, appropriately hacked
so that the customer can build turbostat without a kernel tree.

Include the turbostat binary in the snapshot, for convenience in
those situations where the source and destination are trusted,
(and have new enough glibc to execute).

The snapshot is named with the date it was taken rather than
the turbostat VERSION, as it could occur between VERSIONS...

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-21 17:05:55 -04:00
Linus Torvalds
a6189a7407 Turbostat version 2024.04.10
Use of the CPU MSR driver is now optional.
 Perf is now preferred for many counters.
 
 Non-root users can now execute turbostat, though with limited function.
 
 Add counters for some new GFX hardware.
 
 Minor fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEE67dNfPFP+XUaA73mB9BFOha3NhcFAmYWj4MUHGxlbi5icm93
 bkBpbnRlbC5jb20ACgkQB9BFOha3NhdH+RAArg3G1VJz2+wQGVyLqjSt4waz7nR4
 3wc0BNYCZOnInvLqWRoWjs7w2e8CzfdVHYEAFc9N3mM2FVU+LlSJuEf78if8BWZ4
 2ROXCKs2X9I4MMFFvGy4ugOsjSs9jIvYjiWUgaFNL79Fvgi4xZCIPs5cg0j4EOU9
 P2N2z3YMiO88wcGwzaH1v/hODSJ2hRhQ38KSmeIzVv64727OqLo/TIWrGMIUedBT
 sliYrojz202IoArbejfCqP7VtZhnLml6Rln+n8/X3rg3n25RYbaZnwYugkR8WmhZ
 stC0CmB6Rz9IN9yeucq+BlXDOUUUvLQwat3OHw7oZ6zg0+Uu1yD0aPXoqreiZvC3
 iJUr+Qy++NFYmMPRDTWZubdPDAcwuv+PWud2VDfqY8Jgld2GzhucBBmGA+z1NMAl
 gRXFnaUc9R7c/+ubh+R7mrlQxiRk2Jt4VduJ9wdufEWKIaIGDh/1qyFLFKOP32Ko
 zviEOV3WAJHbAGYZUUIzlKmhyQFafuyKbb/o0AO3VvqhCO0vGkzA4yauzkSYGpqo
 8IlNgJxBs0dQqTXOw5ubgnazfjvHB//kBYfvJL9Sg2nuHdQV8+0X/DfYsxvRNo/i
 9khvJF5MPnzb/sgIRXQphWxL6hwZYcx4LfRv6PQD8g7aKwAcs0D/VzcB5fZ+KM+a
 TViqVjUkJ4LSaJ0=
 =oucB
 -----END PGP SIGNATURE-----

Merge tag 'turbostat-2024.04.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux

Pull turbostat updates from Len Brown:

 - Use of the CPU MSR driver is now optional

 - Perf is now preferred for many counters

 - Non-root users can now execute turbostat, though with limited
   functionality

 - Add counters for some new GFX hardware

 - Minor fixes

* tag 'turbostat-2024.04.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (26 commits)
  tools/power turbostat: v2024.04.10
  tools/power/turbostat: Add support for Xe sysfs knobs
  tools/power/turbostat: Add support for new i915 sysfs knobs
  tools/power/turbostat: Introduce BIC_SAM_mc6/BIC_SAMMHz/BIC_SAMACTMHz
  tools/power/turbostat: Fix uncore frequency file string
  tools/power/turbostat: Unify graphics sysfs snapshots
  tools/power/turbostat: Cache graphics sysfs path
  tools/power/turbostat: Enable MSR_CORE_C1_RES support for ICX
  tools/power turbostat: Add selftests
  tools/power turbostat: read RAPL counters via perf
  tools/power turbostat: Add proper re-initialization for perf file descriptors
  tools/power turbostat: Clear added counters when in no-msr mode
  tools/power turbostat: add early exits for permission checks
  tools/power turbostat: detect and disable unavailable BICs at runtime
  tools/power turbostat: Add reading aperf and mperf via perf API
  tools/power turbostat: Add --no-perf option
  tools/power turbostat: Add --no-msr option
  tools/power turbostat: enhance -D (debug counter dump) output
  tools/power turbostat: Fix warning upon failed /dev/cpu_dma_latency read
  tools/power turbostat: Read base_hz and bclk from CPUID.16H if available
  ...
2024-04-10 13:13:27 -07:00
Len Brown
3ab7296a7e tools/power turbostat: v2024.04.10
Much of turbostat can now run with perf, rather than using the MSR driver

Some of turbostat can now run as a regular non-root user.

Add some new output columns for some new GFX hardware.

[This patch updates the version, but otherwise changes no function;
 it touches up some checkpatch issues from previous patches]

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-10 09:07:57 -04:00
Zhang Rui
91a91d3895 tools/power/turbostat: Add support for Xe sysfs knobs
Xe graphics driver uses different graphics sysfs knobs including
   /sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms
   /sys/class/drm/card0/device/tile0/gt0/freq0/cur_freq
   /sys/class/drm/card0/device/tile0/gt0/freq0/act_freq
   /sys/class/drm/card0/device/tile0/gt1/gtidle/idle_residency_ms
   /sys/class/drm/card0/device/tile0/gt1/freq0/cur_freq
   /sys/class/drm/card0/device/tile0/gt1/freq0/act_freq

Plus that,
   /sys/class/drm/card0/device/tile0/gt<n>/gtidle/name
returns either gt<n>-rc or gt<n>-mc. rc is for GFX and mc is SA Media.

Enhance turbostat to prefer the Xe sysfs knobs when they are available.
Export gt<n>-rc via BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz.
Export gt<n>-mc via BIC_SMA_mc6/BIC_SMAMHz/BIC_SMAACTMHz.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2024-04-10 09:02:58 -04:00
Zhang Rui
dc02dc937a tools/power/turbostat: Add support for new i915 sysfs knobs
On Meteorlake platform, i915 driver supports the traditional graphics
sysfs knobs including
   /sys/class/drm/card0/power/rc6_residency_ms
   /sys/class/drm/card0/gt_cur_freq_mhz
   /sys/class/drm/card0/gt_act_freq_mhz

At the same time, it also supports
   /sys/class/drm/card0/gt/gt0/rc6_residency_ms
   /sys/class/drm/card0/gt/gt0/rps_cur_freq_mhz
   /sys/class/drm/card0/gt/gt0/rps_act_freq_mhz
   /sys/class/drm/card0/gt/gt1/rc6_residency_ms
   /sys/class/drm/card0/gt/gt1/rps_cur_freq_mhz
   /sys/class/drm/card0/gt/gt1/rps_act_freq_mhz
gt0 is for GFX and gt1 is for SA Media.

Enhance turbostat to prefer the i915 new sysfs knobs.
Export gt0 via BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz.
Export gt1 via BIC_SMA_mc6/BIC_SMAMHz/BIC_SMAACTMHz.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2024-04-10 09:02:58 -04:00
Zhang Rui
3bbb331c1d tools/power/turbostat: Introduce BIC_SAM_mc6/BIC_SAMMHz/BIC_SAMACTMHz
Graphics driver (i915/Xe) on mordern platforms splits GFX and SA Media
information via different sysfs knobs.

Existing BIC_GFX_rc6/BIC_GFXMHz/BIC_GFXACTMHz columns can be reused for
GFX.

Introduce BIC_SAM_mc6/BIC_SAMMHz/BIC_SAMACTMHz columns for SA Media.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2024-04-10 09:02:44 -04:00
Justin Ernst
60add818ab tools/power/turbostat: Fix uncore frequency file string
Running turbostat on a 16 socket HPE Scale-up Compute 3200 (SapphireRapids) fails with:
turbostat: /sys/devices/system/cpu/intel_uncore_frequency/package_010_die_00/current_freq_khz: open failed: No such file or directory

We observe the sysfs uncore frequency directories named:
...
package_09_die_00/
package_10_die_00/
package_11_die_00/
...
package_15_die_00/

The culprit is an incorrect sprintf format string "package_0%d_die_0%d" used
with each instance of reading uncore frequency files. uncore-frequency-common.c
creates the sysfs directory with the format "package_%02d_die_%02d". Once the
package value reaches double digits, the formats diverge.

Change each instance of "package_0%d_die_0%d" to "package_%02d_die_%02d".

[lenb: deleted the probe part of this patch, as it was already fixed]

Signed-off-by: Justin Ernst <justin.ernst@hpe.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-09 14:04:23 -04:00
Zhang Rui
de39d38c06 tools/power/turbostat: Unify graphics sysfs snapshots
Graphics sysfs snapshots share similar logic.
Combine them into one function to avoid code duplication.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-09 14:04:23 -04:00
Zhang Rui
4e2bbbf78c tools/power/turbostat: Cache graphics sysfs path
Graphics drivers (i915/Xe) have different sysfs knobs on different
platforms, and it is possible that different sysfs knobs fit into the
same turbostat columns.

Instead of specifying different sysfs knobs every time, detect them
once and cache the path for future use.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-09 14:04:23 -04:00
Zhang Rui
bb5db22c13 tools/power/turbostat: Enable MSR_CORE_C1_RES support for ICX
Enable Core C1 hardware residency counter (MSR_CORE_C1_RES) on ICX.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-09 14:04:23 -04:00
Patryk Wlazlyn
05a2f07db8 tools/power turbostat: read RAPL counters via perf
Some of the future Intel platforms will require reading the RAPL
counters via perf and not MSR. On current platforms we can still read
them using both ways.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-09 14:04:05 -04:00
Patryk Wlazlyn
ebf8449cab tools/power turbostat: Add proper re-initialization for perf file descriptors
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:17 -04:00
Patryk Wlazlyn
4a1bb4dad5 tools/power turbostat: Clear added counters when in no-msr mode
If user request --no-msr or is not able to access the MSRs,
turbostat should clear all the counters added with --add.
Because MSR access permission checks are done after the cmdline is
parsed, the decision has to be defered up until the transition into
no-msr mode happen.

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:15 -04:00
Patryk Wlazlyn
aed48c48fa tools/power turbostat: add early exits for permission checks
Checking early if the permissions are even needed gets rid of the
warnings about some of them missing. Earlier we issued a warning in case
of missing MSR and/or perf permissions, even when user never asked for
counters that require those.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:14 -04:00
Patryk Wlazlyn
5088741ec8 tools/power turbostat: detect and disable unavailable BICs at runtime
To allow unprivileged user to run turbostat seamlessly.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:13 -04:00
Patryk Wlazlyn
e48934c9f1 tools/power turbostat: Add reading aperf and mperf via perf API
By using the perf API we spend less time in between the reads of the
counters, resulting in more accurate calculations of the dependent
metrics.

Using perf API is also usually faster overall, although cache miss, if
we get one, is more costly when using perf vs MSR driver.

We would fallback to the msr reads if the sysfs isn't there or when in
--no-perf mode.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:11 -04:00
Patryk Wlazlyn
a0e86c90b8 tools/power turbostat: Add --no-perf option
Add the --no-perf option to allow users to run turbostat without
accessing perf.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Reviewed-by: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:09 -04:00
Patryk Wlazlyn
3e4048466c tools/power turbostat: Add --no-msr option
Add --no-msr option to allow users to run turbostat without
accessing MSRs via the MSR driver.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Reviewed-by: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:08 -04:00
Len Brown
2d2ccd5733 tools/power turbostat: enhance -D (debug counter dump) output
Eliminate redundant debug output for core and package scope counters.

Include name and path for all "ADDED" counters.

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:06 -04:00
Len Brown
b6fe938317 tools/power turbostat: Fix warning upon failed /dev/cpu_dma_latency read
Previously a failed read of /dev/cpu_dma_latency erroneously complained
turbostat: capget(CAP_SYS_ADMIN) failed, try "# setcap cap_sys_admin=ep ./turbostat

This went unnoticed because this file is typically visible to root,
and turbostat was typically run as root.

Going forward, when a non-root user can run turbostat...
Complain about failed read access to this file only if --debug is used.

Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:04 -04:00
Patryk Wlazlyn
538d505fde tools/power turbostat: Read base_hz and bclk from CPUID.16H if available
If MSRs cannot be read, values can be obtained from cpuid.

Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2024-04-02 12:50:02 -04:00
Rafael J. Wysocki
3208a9a07b linux-cpupower-6.9-rc1
This cpupower update for Linux 6.9-rc1 consists of a single fix
 to a typo in cpupower-frequency-info.1 man page.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmXo1MUACgkQCwJExA0N
 QxyT/w/8CNGTh2cZuR3JGPQuU/aRmqJEzKE6WPcQH4yCXWTu8icOkm0j6W5VSq/I
 7wzoUMuUcXBTAP1DCJwTSXVcfxE9bHPKR2TTcoAzSzatOWtL6yVmPVOB5utW3I2c
 DQKkN7BbxZV1zzIDmw3bgLbh+MZjzQwawdpIb0w9KgIKD6ItDFC6LqfH01o9HfGt
 Lvp5Qy0d2qc+9rHJsRPgUyTPeDo4EtndG2/eW6ukMj7oB84jLY5x3SpeEHGQnByV
 j+5dpzCVWorWHqvyq1qO5Yeayc6llvhEZFk9DSg78q75amLBAnRk7q5B1kl7TIQb
 N9nICol4hV2wHonv7yP9rsVooGsT/7m41gBkXCX+yh/aFwQWPMXDq2nTo6J1OlkO
 Tu0kCsGX2RrsooyiRPT/siypLXjjf+BiA+WRgur7iZCp+IBsBVBiS88bKJe+IlVV
 AZpsoqwiOHDQBV9Geg2MsTz0goHvbIU9OmQM7Gg9reGq0XvqBYvgxM0AFmIA/30I
 9KYjusU6ZWHDccCcMvBlukjz2upzn9dS0nRIXloNXby5FKpmm2ejiiLCJVVo0yoI
 0yfDkGakX2mai2G7Kj8s+Uv428MJw7SXVloGo2pWg0WBYXn4f0QAlC7c5M7PW30y
 0Nj+h5K6J2T1+dPVwBw2zFh/V97t14ztHiMisKVlPiv0c6ejHi8=
 =oaz3
 -----END PGP SIGNATURE-----

Merge tag 'linux-cpupower-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux

Merge a cpupower utility documentation update for 6.9-rc1 from Shuah Khan:

"This cpupower update for Linux 6.9-rc1 consists of a single fix
 to a typo in cpupower-frequency-info.1 man page."

* tag 'linux-cpupower-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
  Fix cpupower-frequency-info.1 man page typo
2024-03-07 21:02:51 +01:00
Jan Kratochvil
a114d9f1f2 Fix cpupower-frequency-info.1 man page typo
cpupower-frequency-info.1 man page type is incorrect for
related-cpus. Fix it.

utils/cpufreq-info.c
        {"related-cpus",  no_argument,   NULL,   'r'},
        {"affected-cpus", no_argument,   NULL,   'a'},

Fixed changelog before applying:
Shuah Khan <skhan@linuxfoundation.org>

Signed-off-by: Jan Kratochvil <jan@jankratochvil.net>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-03-06 09:27:57 -07:00
Samasth Norway Ananda
f85450f134 tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num()
In function get_pkg_num() if fopen_or_die() succeeds it returns a file
pointer to be used. But fclose() is never called before returning from
the function.

Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-02-22 20:05:28 +01:00
Stanley Chan
0086ffec76 tools cpupower bench: Override CFLAGS assignments
Allow user to specify outside CFLAGS values as make argument

Corrects an issue where CFLAGS is passed as a make argument for
cpupower, but bench's makefile does not inherit and append to them.

Signed-off-by: Stanley Chan <schan@cloudflare.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2024-01-21 16:57:51 -07:00