From: "M K, Muralidhara" <muralimk@amd.com>
To: Muralidhara M K <muralidhara.mk@amd.com>,
ilpo.jarvinen@linux.intel.com, gregkh@linuxfoundation.org,
rafael@kernel.org
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, driver-core@lists.linux.dev
Subject: Re: [PATCH v2 0/7] AMD HSMP: metrics table improvements and Family 1Ah Model 50h-5Fh support
Date: Mon, 11 May 2026 16:50:22 +0530 [thread overview]
Message-ID: <0fbf4355-4ba0-4cc9-908d-001747bcfc67@amd.com> (raw)
In-Reply-To: <20260427155129.545327-1-muralidhara.mk@amd.com>
Hi ilpo,
I submitted this patch series and wanted to check if you had
a chance to review it. Please let me know if there's anything I can
do to help move this forward.
On 4/27/2026 9:21 PM, Muralidhara M K wrote:
> This series adds HSMP protocol version 7 support for AMD Family 1Ah
> Model 50h-5Fh processors and replaces offset-based chunked reading
> with a single read method for variable-sized metrics data larger than
> 4 KB, and addresses locking to allow concurrent reads safely.
>
> The zen6 metric table (~13 KB) exceeds the PAGE_SIZE (4096 bytes) read
> cap imposed by kernfs_file_read_iter(). Commit 3124eb1679b2 ("sysfs:
> remove bin_attribute.size") cleared i_size for sysfs binary files,
> which made kernfs_file_read_iter() fall back to PAGE_SIZE as the
> maximum single-read length. This means userspace gets a silently
> truncated snapshot when reading the metric table via sysfs.
>
> To solve this, the series introduces SYSFS_HUGE_BIN_FILE, a new sysfs
> mode flag that routes binary attribute reads through the seq_file path
> (seq_read_iter) instead of kernfs_file_read_iter(). The seq_file
> buffer grows dynamically (doubling from PAGE_SIZE) and has no built-in
> size cap, so it can serve arbitrarily large binary attributes in a
> single read.
>
> Additionally, the series retrieves the actual metric table size from
> the SMU at init time (via args[2] of HSMP_GET_METRIC_TABLE_DRAM_ADDR)
> rather than relying on a compiled-in sizeof(), and adds per-socket
> mutex serialization for metric table reads using the scoped guard(mutex)
> API.
>
> Link: https://lore.kernel.org/platform-driver-x86/81915669-87e0-f06d-7a91-eaec41ecc0e1@linux.intel.com/T/#m28341c51bcf27862ef6615414b1970d3db279fd7
>
> Patch breakdown:
>
> 1/7 HSMP messages - Define HSMP protocol v7 message IDs and
> response sizes in the UAPI header.
> 2/7 UAPI structs - Add hsmp_metric_table_zen6 UAPI structures
> and widen acpi.c proto_ver checks to >= VER6.
> 3/7 response_sz - Unify response_sz validation to an upper-bound
> check, allowing HSMP_GET_METRIC_TABLE_DRAM_ADDR
> to return 3 dwords (including table size).
> 4/7 SYSFS_HUGE_BIN_FILE - Add the sysfs infrastructure: new flag,
> seq_show callback, and kernfs_ops for binary
> files larger than PAGE_SIZE.
> 5/7 Dynamic size - Read actual table size from SMU args[2] at
> init time; use bin_size callback to report it
> to sysfs.
> 6/7 Read locking - Add per-socket guard(mutex) serialization for
> metric table reads to prevent torn snapshots.
> 7/7 Wire it up - Set SYSFS_HUGE_BIN_FILE mode on metric table
> bin_attributes in both acpi.c and plat.c.
>
> Build-tested each patch individually with W=1, zero warnings.
> Tested on AMD Family 1Ah Model 50h platform with HSMP protocol v7.
>
> Muralidhara M K (6):
> platform/x86/amd/hsmp: Add metrics table support for Family 1Ah Model
> 50h-5Fh
> platform/x86/amd/hsmp: Unify response_sz validation to an upper-bound
> check
> sysfs: Add SYSFS_HUGE_BIN_FILE flag for binary attributes larger than
> PAGE_SIZE
> platform/x86/amd/hsmp: Add dynamic table size for metric table
> platform/x86/amd/hsmp: Make metric table read locking use guard(mutex)
> platform/x86/amd/hsmp: Support SYSFS_HUGE_BIN_FILE for metric table
> reads
>
> Suma Hegde (1):
> platform/x86/amd/hsmp: Add new HSMP messages for Family 1Ah, Model
> 50h-5Fh
>
> arch/x86/include/uapi/asm/amd_hsmp.h | 235 ++++++++++++++++++++++++---
> drivers/platform/x86/amd/hsmp/acpi.c | 14 +-
> drivers/platform/x86/amd/hsmp/hsmp.c | 36 ++--
> drivers/platform/x86/amd/hsmp/hsmp.h | 6 +-
> drivers/platform/x86/amd/hsmp/plat.c | 13 +-
> fs/sysfs/file.c | 45 +++++
> fs/sysfs/group.c | 8 +-
> include/linux/sysfs.h | 1 +
> 8 files changed, 312 insertions(+), 46 deletions(-)
>
next prev parent reply other threads:[~2026-05-11 11:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260427155129.545327-1-muralidhara.mk@amd.com>
[not found] ` <20260427155129.545327-3-muralidhara.mk@amd.com>
2026-05-08 5:12 ` [PATCH v2 2/7] platform/x86/amd/hsmp: Add metrics table support for Family 1Ah Model 50h-5Fh Suma Hegde
2026-05-11 17:38 ` Ilpo Järvinen
[not found] ` <20260427155129.545327-4-muralidhara.mk@amd.com>
2026-05-08 5:13 ` [PATCH v2 3/7] platform/x86/amd/hsmp: Unify response_sz validation to an upper-bound check Suma Hegde
2026-05-11 11:20 ` M K, Muralidhara [this message]
[not found] ` <20260427155129.545327-7-muralidhara.mk@amd.com>
2026-05-11 17:27 ` [PATCH v2 6/7] platform/x86/amd/hsmp: Make metric table read locking use guard(mutex) Ilpo Järvinen
[not found] ` <20260427155129.545327-2-muralidhara.mk@amd.com>
2026-05-11 17:35 ` [PATCH v2 1/7] platform/x86/amd/hsmp: Add new HSMP messages for Family 1Ah, Model 50h-5Fh Ilpo Järvinen
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=0fbf4355-4ba0-4cc9-908d-001747bcfc67@amd.com \
--to=muralimk@amd.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@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