platform/x86/amd/hsmp: Unify per-socket sysfs metrics
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest5 patches 0 repliesNew
- v14 patches 8 repliesSuperseded
Changes in v2 from the cover letter
- Replace the separate /sys/devices/amd_hsmp tree, its root device and its hand-rolled refcount by an amd_hsmp class, as suggested by Carlos. The kref.h remark from Ilpo no longer applies, as there is no shared object to refcount anymore.
- Platform driver: the socket devices replace the bare socketN attribute groups. As class devices land in an amd_hsmp glue directory below their parent, a socketN symlink keeps the existing /sys/devices/platform/amd_hsmp/socketN/metrics_bin path working.
- New patch 5: Documentation/ABI/testing/sysfs-class-amd_hsmp. Its content depends on the AMDI0097:0X ABI discussion with Carlos in the v1 thread, and can be dropped or reworked accordingly.
- Collected Acked-by from Carlos on patches 1 and 4.
- Rebased on v7.4-rc3.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | platform/x86/amd/hsmp: Move per-socket sysfs attributes to common codedrivers/ drivers/ drivers/ +1 more | +351 | 0 replies | |
| 2/5 | platform/x86/amd/hsmp: Add amd_hsmp class with per-socket devicesDocumentation/ drivers/ drivers/ +2 more | +120 | 0 replies | |
| 3/5 | platform/x86/amd/hsmp: Expose socket attributes from the platform driverDocumentation/ drivers/ | +67 | 0 replies | |
| 4/5 | platform/x86/amd/hsmp: Add pwr_current_active_freq_limit_source_rawDocumentation/ drivers/ | +22 | 0 replies | |
| 5/5 | Documentation/ABI: Add sysfs-class-amd_hsmpDocumentation/ MAINTAINERS | +121 | 0 replies |
Reviews trailers per patch
2 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Carlos Bilbao |
|---|---|
| 1/5 | A-b |
| 2/5 | |
| 3/5 | |
| 4/5 | A-b |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/5] platform/x86/amd/hsmp: Unify per-socket sysfs metrics
From: Erwan Velu <[email protected]>
The goal of this series is to ease server monitoring, by exposing the HSMP metrics the same way whatever the driver, in a format that is straightforward to integrate in metrics exporters.
The per-socket HSMP telemetry attributes (c0_residency_input, ddr_max_bw, pwr_current_active_freq_limit, ...) are only implemented by the ACPI driver, although they are plain HSMP messages the platform driver can send as well. Systems probed by the platform driver therefore only get metrics_bin.
Their location also depends on the driver: AMDI0097:0X with the ACPI driver, amd_hsmp/socketN with the platform one. "modprobe amd_hsmp" picks the right driver, but userspace cannot know in advance which tree it has to read.
This series moves the attributes to common code and adds an amd_hsmp class with one socketN device per socket, registered by both drivers. /sys/class/amd_hsmp/socketN/ is then the same path whichever driver probed. The existing ACPI and platform sysfs paths keep working.
Patch 1 is a pure code move. Patch 2 adds the class and wires it in the ACPI driver, patch 3 does the same for the platform driver. Patch 4 exposes the pwr_current_active_freq_limit_source bitmask as a single hexadecimal value, whose interpretation can be centralized in the monitoring stack (e.g. Grafana value mappings). Patch 5 documents /sys/class/amd_hsmp in Documentation/ABI/testing.
This v2 reworks patches 2 and 3 following Carlos' review of v1, and is meant as a basis for discussion: I would rather know early whether this is heading in the right direction, in particular for the class approach and the AMDI0097:0X ABI question raised in the v1 thread, before polishing it further.
Changes in v2:
- Replace the separate /sys/devices/amd_hsmp tree, its root device and its hand-rolled refcount by an amd_hsmp class, as suggested by Carlos. The kref.h remark from Ilpo no longer applies, as there is no shared object to refcount anymore.
- Platform driver: the socket devices replace the bare socketN attribute groups. As class devices land in an amd_hsmp glue directory below their parent, a socketN symlink keeps the existing /sys/devices/platform/amd_hsmp/socketN/metrics_bin path working.
- New patch 5: Documentation/ABI/testing/sysfs-class-amd_hsmp. Its content depends on the AMDI0097:0X ABI discussion with Carlos in the v1 thread, and can be dropped or reworked accordingly.
- Collected Acked-by from Carlos on patches 1 and 4.
- Rebased on v7.4-rc3.
Tested on a Zen4 (Family 19h, HSMP protocol 5) server with the platform driver, and on a dual socket Zen5 (Family 1Ah) server with the ACPI
driver: attributes read through /sys/class/amd_hsmp, legacy paths still working, and 20 unload/reload cycles of the driver while reading the attributes in a loop.
v1: https://lore.kernel.org/platform-driver-x86/[email protected]/
Erwan Velu (5):
platform/x86/amd/hsmp: Move per-socket sysfs attributes to common code platform/x86/amd/hsmp: Add amd_hsmp class with per-socket devices platform/x86/amd/hsmp: Expose socket attributes from the platform
driver
platform/x86/amd/hsmp: Add pwr_current_active_freq_limit_source_raw Documentation/ABI: Add sysfs-class-amd_hsmp
.../ABI/testing/sysfs-class-amd_hsmp | 120 +++++ Documentation/arch/x86/amd_hsmp.rst | 24 +- MAINTAINERS | 1 + drivers/platform/x86/amd/hsmp/Makefile | 2 +- drivers/platform/x86/amd/hsmp/acpi.c | 345 +------------- drivers/platform/x86/amd/hsmp/hsmp.c | 19 + drivers/platform/x86/amd/hsmp/hsmp.h | 8 + drivers/platform/x86/amd/hsmp/plat.c | 155 +++---- drivers/platform/x86/amd/hsmp/sysfs.c | 435 ++++++++++++++++++ 9 files changed, 681 insertions(+), 428 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-amd_hsmp create mode 100644 drivers/platform/x86/amd/hsmp/sysfs.c
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
Signature · 1 line
2.53.0