mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/5] platform/x86/amd/hsmp: Unify per-socket sysfs metrics
@ 2026-11-16 15:51 Erwan Velu
  2026-11-16 15:51 ` [PATCH v2 1/5] platform/x86/amd/hsmp: Move per-socket sysfs attributes to common code Erwan Velu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Erwan Velu @ 2026-11-16 15:51 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi, Ilpo Järvinen, Hans de Goede
  Cc: Carlos Bilbao, Muralidhara M K, Suma Hegde, Muthusamy Ramalingam,
	platform-driver-x86, linux-kernel, Erwan Velu

From: Erwan Velu <e.velu@criteo.com>

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/20261007125908.321186-1-erwanaliasr1@gmail.com/

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
-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-16 15:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 15:51 [PATCH v2 0/5] platform/x86/amd/hsmp: Unify per-socket sysfs metrics Erwan Velu
2026-11-16 15:51 ` [PATCH v2 1/5] platform/x86/amd/hsmp: Move per-socket sysfs attributes to common code Erwan Velu
2026-11-16 15:51 ` [PATCH v2 2/5] platform/x86/amd/hsmp: Add amd_hsmp class with per-socket devices Erwan Velu
2026-11-16 15:51 ` [PATCH v2 3/5] platform/x86/amd/hsmp: Expose socket attributes from the platform driver Erwan Velu
2026-11-16 15:51 ` [PATCH v2 4/5] platform/x86/amd/hsmp: Add pwr_current_active_freq_limit_source_raw Erwan Velu
2026-11-16 15:51 ` [PATCH v2 5/5] Documentation/ABI: Add sysfs-class-amd_hsmp Erwan Velu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®