From: Erwan Velu <erwanaliasr1@gmail.com>
To: Carlos Bilbao <carlos.bilbao.osdev@gmail.com>
Cc: platform-driver-x86@vger.kernel.org,
"Naveen Krishna Chatradhi" <naveenkrishna.chatradhi@amd.com>,
"Carlos Bilbao" <carlos.bilbao@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] platform/x86/amd/hsmp: Add /sys/devices/amd_hsmp socket devices
Date: Mon, 16 Nov 2026 15:11:50 +0100 [thread overview]
Message-ID: <20261116141150.667950-1-erwanaliasr1@gmail.com> (raw)
In-Reply-To: <73b9c9a8-479d-4a5f-9321-2e095f11951d@gmail.com>
On 11/1/26 18:57, Carlos Bilbao wrote:
> Is this over-engineering it? The platform driver already creates
> /sys/devices/platform/amd_hsmp/socket0/, socket1/, etc. they're just dumb
> dirs with only metrics_bin inside. This patch series ignores those and
> builds a whole new /sys/devices/amd_hsmp/socket0/ tree from scratch with
> root_device_register(), manual refcounting, etc. instead of building a
> parallel tree, upgrade what's already there. Turn those existing socketN
> directories from bare sysfs dirs into proper struct device objects?
Hi Carlos,
Thanks for the review and the acks on 1/4 and 4/4.
I think the commit message did not explain the goal well enough, so let
me clarify it first. The goal is not only to get more attributes on the
platform driver. It is to give userspace a single path to the per-socket
metrics, whichever driver probed.
Today the same metrics are found in different places depending on the
platform:
- Zen5 (ACPI probe):
/sys/devices/platform/AMDI0097:00/
/sys/devices/platform/AMDI0097:01/
- Zen3/4 (legacy platform probe):
/sys/devices/platform/amd_hsmp/socket0/
/sys/devices/platform/amd_hsmp/socket1/
"modprobe amd_hsmp" does the right thing and probes the platform or the
ACPI driver depending on the system, which is good. But as a
consequence, userspace cannot know in advance which of the two trees it
has to read, unless it walks sysfs to find out.
On a Zen5 system there is no amd_hsmp platform device at all, so
upgrading the existing amd_hsmp/socketN directories only covers one of
the two cases. A monitoring agent running on a mixed fleet (our case)
still has to find out which driver probed and use a different layout
for each.
That said, I agree with your point on the implementation. The separate
root device and the hand-rolled refcount were the wrong tool. Ilpo also
pointed out that kref.h was the right helper there. For v2 I would like
to propose the following:
- Add a device class (e.g. "amd_hsmp") and create one socketN device
per socket in it, with hsmp_sock_groups.
- Platform driver: the socketN device is parented to the amd_hsmp
platform device and replaces the current named attribute group, as
you suggested. /sys/devices/platform/amd_hsmp/socketN/metrics_bin
keeps the same path, so nothing changes for existing users.
- ACPI driver: the socketN device is parented to AMDI0097:0X, and the
attributes already on AMDI0097:0X are left in place.
- Userspace gets /sys/class/amd_hsmp/socketN/ on both drivers.
This removes root_device_register() and the manual refcounting, and it
lets us use device_create_with_groups() instead of building the device
by hand.
Before working on it, I have a question about the AMDI0097:0X path,
which I think needs a maintainer decision:
The telemetry files on /sys/devices/platform/AMDI0097:0X/ are
documented in Documentation/arch/x86/amd_hsmp.rst (since 511a4a5ea2b6),
but there is no entry in Documentation/ABI/. They are tied to the ACPI
device name, not to the socket. As far as I understand, the :0X suffix
is the ACPI instance number, while the socket index comes from _UID, so
nothing guarantees that the two match.
What is your view for this path?
a) It is stable ABI and stays as is forever. The class path is only
added next to it.
b) It stays, but the class path becomes the documented interface,
with a Documentation/ABI/testing entry. The AMDI0097:0X files are
documented as kept for compatibility only, and we would propose a
progressive deprecation of them (e.g. a Documentation/ABI/obsolete
entry first), so they can eventually be removed once userspace has
moved to the class path.
c) Something else you have in mind.
My preference would be b), as it doesn't break anyone today, gives new
users one documented place to look at, and leaves a clean path to a
single interface in the long run. But I would rather align with you and
Naveen on this before sending v2.
Thanks,
Erwan
next prev parent reply other threads:[~2026-11-16 14:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 12:59 [PATCH 0/4] platform/x86/amd/hsmp: Unify per-socket sysfs metrics Erwan Velu
2026-10-07 12:59 ` [PATCH 1/4] platform/x86/amd/hsmp: Move per-socket sysfs attributes to common code Erwan Velu
2026-11-02 2:38 ` Carlos Bilbao
2026-10-07 12:59 ` [PATCH 2/4] platform/x86/amd/hsmp: Add /sys/devices/amd_hsmp socket devices Erwan Velu
2026-10-16 11:02 ` Ilpo Järvinen
2026-11-02 2:57 ` Carlos Bilbao
2026-11-16 14:11 ` Erwan Velu [this message]
2026-11-16 14:23 ` Ilpo Järvinen
2026-11-16 14:43 ` Erwan Velu
2026-10-07 12:59 ` [PATCH 3/4] platform/x86/amd/hsmp: Expose socket attributes from the platform driver Erwan Velu
2026-10-07 12:59 ` [PATCH 4/4] platform/x86/amd/hsmp: Add pwr_current_active_freq_limit_source_raw Erwan Velu
2026-11-02 2:41 ` Carlos Bilbao
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=20261116141150.667950-1-erwanaliasr1@gmail.com \
--to=erwanaliasr1@gmail.com \
--cc=carlos.bilbao.osdev@gmail.com \
--cc=carlos.bilbao@kernel.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
/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®