From: "M K, Muralidhara" <muralimk@amd.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Muralidhara M K" <muralidhara.mk@amd.com>
Cc: platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
Subject: Re: [PATCH v3 6/7] platform/x86/amd/hsmp: Drop ACPI sysfs metrics_bin in favour of the IOCTL
Date: Tue, 26 May 2026 15:29:26 +0530 [thread overview]
Message-ID: <23d24aff-a18b-4b77-8035-b875a186d981@amd.com> (raw)
In-Reply-To: <a290bd3e-365f-8fd4-239c-846197a03853@linux.intel.com>
On 5/22/2026 5:14 PM, Ilpo Järvinen wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Sun, 17 May 2026, Muralidhara M K wrote:
>
>> The HSMP_IOCTL_GET_TELEMETRY_DATA character-device ioctl introduced in
>> the previous patch is now the canonical interface for reading the
>> metric table on the ACPI driver path. Unlike the metrics_bin sysfs
>> binary attribute, the ioctl is not constrained by PAGE_SIZE, so it
>> works for the ~13 KB hsmp_metric_table_zen6 layout
>
> This was only a secondary reason from moving away from sysfs files? The
> main cause for moving to misc device according to my impression was that
> you wanted to prevent partial reads which are always possible with files.
>
Sure I will update the changelog to document the rationale for moving
away from sysfs files.
>> used on Family 1Ah
>> Model 50h-5Fh as well as for the existing hsmp_metric_table layout
>> used on protocol version 6.
>
>
>
>> Drop the metrics_bin bin_attribute from the ACPI hsmp_attr_grp.
>
>> Widen the remaining proto_ver gate in init_acpi() from
>> '== HSMP_PROTO_VER6' to '>= HSMP_PROTO_VER6' so
>> hsmp_get_tbl_dram_base() is invoked on protocol version 7
>> (Family 1Ah Model 50h-5Fh) and any future protocol version that
>> retains a compatible per-socket metric table. This populates
>> sock->metric_tbl_addr and hsmp_pdev.hsmp_table_size, which the ioctl
>> handler requires.
>
> These are two logically separate changes so they should not be in the same
> patch (but you'll likely need to alter the drop patch anyway, see below).
>
Ya Understood. I will make this change as a separate patch.
>> This is an ABI change for users of the ACPI driver:
>> /sys/bus/platform/devices/AMDI0097:*/metrics_bin no longer exists.
>> Userspace must read telemetry through the HSMP_IOCTL_GET_TELEMETRY_DATA
>> ioctl on /dev/hsmp instead, sizing its buffer using the matching UAPI
>> metric table struct.
>
> I might not be entirely following what's the extent of removal here but it
> looks too extensive to me. The number 1 rule is that we cannot take away
> existing and working ABI without properly deprecating it first.
>
> You don't have to make it work with version 7 and can return error in
> that case as it has never worked. But with version 6, things shouls be
> left as is until properly deprecated. You may consider adding a warning
> print too to warn about the deprecation and point towards the new way.
>
I will review and ensure that an appropriate error is returned if sysfs
is not supported for a particular version.
> This interface probably never was documented in Documentation/ABI where
> such deprecations are usually marked... oh well, maybe we need to add
> a simple entry for this ABI there to follow the usual deprecation path.
>
> --
> i.
>
>> The non-ACPI plat.c path is intentionally left
>> unchanged: it covers Family 1Ah Model 0h-Fh hardware that is fixed at
>> protocol version 6, and its per-socket metrics_bin remains available
>> for existing userspace tooling on those systems.
>>
>> Co-developed-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
>> Signed-off-by: Muthusamy Ramalingam <muthusamy.ramalingam@amd.com>
>> Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
>> ---
>> Changes:
>> v1->v3: Remove bin attributes
>>
>> drivers/platform/x86/amd/hsmp/acpi.c | 34 +---------------------------
>> 1 file changed, 1 insertion(+), 33 deletions(-)
>>
>> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
>> index 97ed71593bdf..49765fefe1fb 100644
>> --- a/drivers/platform/x86/amd/hsmp/acpi.c
>> +++ b/drivers/platform/x86/amd/hsmp/acpi.c
>> @@ -231,25 +231,6 @@ static int hsmp_parse_acpi_table(struct device *dev, u16 sock_ind)
>> return hsmp_read_acpi_dsd(sock);
>> }
>>
>> -static ssize_t hsmp_metric_tbl_acpi_read(struct file *filp, struct kobject *kobj,
>> - const struct bin_attribute *bin_attr, char *buf,
>> - loff_t off, size_t count)
>> -{
>> - struct device *dev = container_of(kobj, struct device, kobj);
>> - struct hsmp_socket *sock = dev_get_drvdata(dev);
>> -
>> - return hsmp_metric_tbl_read(sock, buf, count);
>> -}
>> -
>> -static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
>> - const struct bin_attribute *battr, int id)
>> -{
>> - if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6)
>> - return battr->attr.mode;
>> -
>> - return 0;
>> -}
>> -
>> static umode_t hsmp_is_sock_dev_attr_visible(struct kobject *kobj,
>> struct attribute *attr, int id)
>> {
>> @@ -491,7 +472,7 @@ static int init_acpi(struct device *dev)
>> return ret;
>> }
>>
>> - if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6) {
>> + if (hsmp_pdev->proto_ver >= HSMP_PROTO_VER6) {
>> ret = hsmp_get_tbl_dram_base(sock_ind);
>> if (ret)
>> dev_info(dev, "Failed to init metric table\n");
>> @@ -506,17 +487,6 @@ static int init_acpi(struct device *dev)
>> return 0;
>> }
>>
>> -static const struct bin_attribute hsmp_metric_tbl_attr = {
>> - .attr = { .name = HSMP_METRICS_TABLE_NAME, .mode = 0444},
>> - .read = hsmp_metric_tbl_acpi_read,
>> - .size = sizeof(struct hsmp_metric_table),
>> -};
>> -
>> -static const struct bin_attribute *hsmp_attr_list[] = {
>> - &hsmp_metric_tbl_attr,
>> - NULL
>> -};
>> -
>> #define HSMP_DEV_ATTR(_name, _msg_id, _show, _mode) \
>> static struct hsmp_sys_attr hattr_##_name = { \
>> .dattr = __ATTR(_name, _mode, _show, NULL), \
>> @@ -559,9 +529,7 @@ static struct attribute *hsmp_dev_attr_list[] = {
>> };
>>
>> static const struct attribute_group hsmp_attr_grp = {
>> - .bin_attrs = hsmp_attr_list,
>> .attrs = hsmp_dev_attr_list,
>> - .is_bin_visible = hsmp_is_sock_attr_visible,
>> .is_visible = hsmp_is_sock_dev_attr_visible,
>> };
>>
>>
next prev parent reply other threads:[~2026-05-26 9:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 15:12 [PATCH v3 0/7] platform/x86/amd/hsmp: Add support for Family 1Ah, Model 50h-5Fh Muralidhara M K
2026-05-17 15:12 ` [PATCH v3 1/7] platform/x86/amd/hsmp: Add new HSMP messages " Muralidhara M K
2026-05-22 11:49 ` Ilpo Järvinen
2026-05-26 9:21 ` M K, Muralidhara
2026-05-17 15:12 ` [PATCH v3 2/7] platform/x86/amd/hsmp: Add UAPI structures for Family 1Ah Model 50h-5Fh metrics table Muralidhara M K
2026-05-22 11:09 ` Ilpo Järvinen
2026-05-26 9:36 ` M K, Muralidhara
2026-05-17 15:12 ` [PATCH v3 3/7] platform/x86/amd/hsmp: Unify response_sz validation to an upper-bound check Muralidhara M K
2026-05-17 15:12 ` [PATCH v3 4/7] platform/x86/amd/hsmp: Source metric-table size from firmware Muralidhara M K
2026-05-17 15:12 ` [PATCH v3 5/7] platform/x86/amd/hsmp: Add IOCTL_GET_TELEMETRY_DATA for metric table reads Muralidhara M K
2026-05-22 11:04 ` Ilpo Järvinen
2026-05-22 11:27 ` Ilpo Järvinen
2026-05-26 9:43 ` M K, Muralidhara
2026-05-17 15:12 ` [PATCH v3 6/7] platform/x86/amd/hsmp: Drop ACPI sysfs metrics_bin in favour of the IOCTL Muralidhara M K
2026-05-22 11:44 ` Ilpo Järvinen
2026-05-26 9:59 ` M K, Muralidhara [this message]
2026-05-17 15:12 ` [PATCH v3 7/7] platform/x86/amd/hsmp: Make metric table read locking use guard(mutex) Muralidhara M K
2026-05-22 10:55 ` Ilpo Järvinen
2026-05-26 10:02 ` M K, Muralidhara
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=23d24aff-a18b-4b77-8035-b875a186d981@amd.com \
--to=muralimk@amd.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=muthusamy.ramalingam@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