From: Erwan Velu <erwanaliasr1@gmail.com>
To: "Naveen Krishna Chatradhi" <naveenkrishna.chatradhi@amd.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>
Cc: Carlos Bilbao <carlos.bilbao@kernel.org>,
Muralidhara M K <muralidhara.mk@amd.com>,
Suma Hegde <suma.hegde@amd.com>,
Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Erwan Velu <e.velu@criteo.com>
Subject: [PATCH v2 0/5] platform/x86/amd/hsmp: Unify per-socket sysfs metrics
Date: Mon, 16 Nov 2026 16:51:42 +0100 [thread overview]
Message-ID: <20261116155147.769630-1-erwanaliasr1@gmail.com> (raw)
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
next reply other threads:[~2026-11-16 15:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 15:51 Erwan Velu [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116155147.769630-1-erwanaliasr1@gmail.com \
--to=erwanaliasr1@gmail.com \
--cc=carlos.bilbao@kernel.org \
--cc=e.velu@criteo.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=muthusamy.ramalingam@amd.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=suma.hegde@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®