mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown
@ 2026-06-13 19:17 Muralidhara M K
  2026-06-13 19:17 ` [PATCH 1/3] platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe mutex Muralidhara M K
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Muralidhara M K @ 2026-06-13 19:17 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, Muralidhara M K

This series tightens concurrency and lifetime management in the ACPI-backed
AMD HSMP platform path so probe/remove races cannot corrupt global probe state,
leak metric-table DRAM mappings, or tear down shared resources while readers
might still be active.

Patch 1 introduces a dedicated probe mutex around ACPI probe, remove, and
init_acpi(), replacing ad-hoc synchronization on the global is_probed handshake.
lockdep_assert_held() documents the locking contract for init_acpi().

Patch 2 switches metric table DRAM from devm_ioremap() to ioremap() with
explicit init/teardown helpers, and embeds a per-socket mutex for metric reads.
The legacy platform driver wires the same helpers so non-ACPI builds stay
consistent.

Patch 3 replaces the global is_probed flag with miscdevice registration state,
refcounts ACPI socket platform devices with kref, and runs coordinated release
on the final put: misc deregistration when appropriate, metric unmap, and socket
array free. Socket storage uses kcalloc() with careful failure cleanup before
any kref is published.

Muralidhara M K (3):
  platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe
    mutex
  platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket
    mutexes
  platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated
    release

 drivers/platform/x86/amd/hsmp/acpi.c | 87 +++++++++++++++++++++++-----
 drivers/platform/x86/amd/hsmp/hsmp.c | 38 +++++++++++-
 drivers/platform/x86/amd/hsmp/hsmp.h |  9 ++-
 drivers/platform/x86/amd/hsmp/plat.c |  3 +
 4 files changed, 119 insertions(+), 18 deletions(-)

-- 
2.34.1

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

* [PATCH 1/3] platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe mutex
  2026-06-13 19:17 [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown Muralidhara M K
@ 2026-06-13 19:17 ` Muralidhara M K
  2026-06-13 19:17 ` [PATCH 2/3] platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket mutexes Muralidhara M K
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Muralidhara M K @ 2026-06-13 19:17 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, Muralidhara M K

Add hsmp_acpi_probe_mutex and hold it across ACPI probe, remove, and
init_acpi() so concurrent platform probes cannot race the global is_probed
handshake or the one-time socket allocation.  Use lockdep_assert_held() in
init_acpi() to catch incorrect locking under lockdep.

Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
---
 drivers/platform/x86/amd/hsmp/acpi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
index 97ed71593bdf..696884a91c22 100644
--- a/drivers/platform/x86/amd/hsmp/acpi.c
+++ b/drivers/platform/x86/amd/hsmp/acpi.c
@@ -18,8 +18,11 @@
 #include <linux/device.h>
 #include <linux/dev_printk.h>
 #include <linux/ioport.h>
+#include <linux/cleanup.h>
+#include <linux/lockdep.h>
 #include <linux/kstrtox.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/platform_device.h>
 #include <linux/sysfs.h>
 #include <linux/topology.h>
@@ -38,6 +41,8 @@
 
 static struct hsmp_plat_device *hsmp_pdev;
 
+static DEFINE_MUTEX(hsmp_acpi_probe_mutex);
+
 struct hsmp_sys_attr {
 	struct device_attribute dattr;
 	u32 msg_id;
@@ -459,11 +464,17 @@ static ssize_t hsmp_freq_limit_source_show(struct device *dev, struct device_att
 	return len;
 }
 
+/**
+ * init_acpi() - Parse ACPI mailbox resources for one socket and validate HSMP.
+ * @dev: ACPI companion device for this socket.
+ */
 static int init_acpi(struct device *dev)
 {
 	u16 sock_ind;
 	int ret;
 
+	lockdep_assert_held(&hsmp_acpi_probe_mutex);
+
 	ret = hsmp_get_uid(dev, &sock_ind);
 	if (ret)
 		return ret;
@@ -584,6 +595,8 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
 	if (!hsmp_pdev)
 		return -ENOMEM;
 
+	guard(mutex)(&hsmp_acpi_probe_mutex);
+
 	if (!hsmp_pdev->is_probed) {
 		hsmp_pdev->num_sockets = topology_max_packages();
 		if (!hsmp_pdev->num_sockets) {
@@ -619,6 +632,7 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
 
 static void hsmp_acpi_remove(struct platform_device *pdev)
 {
+	mutex_lock(&hsmp_acpi_probe_mutex);
 	/*
 	 * We register only one misc_device even on multi-socket system.
 	 * So, deregister should happen only once.
@@ -627,6 +641,7 @@ static void hsmp_acpi_remove(struct platform_device *pdev)
 		hsmp_misc_deregister();
 		hsmp_pdev->is_probed = false;
 	}
+	mutex_unlock(&hsmp_acpi_probe_mutex);
 }
 
 static struct platform_driver amd_hsmp_driver = {
-- 
2.34.1


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

* [PATCH 2/3] platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket mutexes
  2026-06-13 19:17 [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown Muralidhara M K
  2026-06-13 19:17 ` [PATCH 1/3] platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe mutex Muralidhara M K
@ 2026-06-13 19:17 ` Muralidhara M K
  2026-06-13 19:17 ` [PATCH 3/3] platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated release Muralidhara M K
  2026-06-16  8:28 ` [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown M K, Muralidhara
  3 siblings, 0 replies; 6+ messages in thread
From: Muralidhara M K @ 2026-06-13 19:17 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, Muralidhara M K

Add hsmp_destroy_metric_read_locks(), hsmp_init_metric_read_locks(), and
switch metric table DRAM from devm_ioremap() to ioremap() so ACPI can
coordinate teardown.  Embed struct mutex metric_read_lock in each
hsmp_socket for later serialization of metric table reads.

Call the new helpers from the platform driver probe and remove paths
so non-ACPI builds initialize and tear down metric_read_lock consistently
with the ACPI driver.

Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
---
 drivers/platform/x86/amd/hsmp/hsmp.c | 38 ++++++++++++++++++++++++++--
 drivers/platform/x86/amd/hsmp/hsmp.h |  5 ++++
 drivers/platform/x86/amd/hsmp/plat.c |  3 +++
 3 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/amd/hsmp/hsmp.c
index 631ffc0978d1..81b6c24c3d3a 100644
--- a/drivers/platform/x86/amd/hsmp/hsmp.c
+++ b/drivers/platform/x86/amd/hsmp/hsmp.c
@@ -12,7 +12,11 @@
 #include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/io.h>
+#include <linux/mutex.h>
+#include <linux/nospec.h>
 #include <linux/semaphore.h>
+#include <linux/slab.h>
 #include <linux/sysfs.h>
 
 #include "hsmp.h"
@@ -379,6 +383,37 @@ ssize_t hsmp_metric_tbl_read(struct hsmp_socket *sock, char *buf, size_t size)
 }
 EXPORT_SYMBOL_NS_GPL(hsmp_metric_tbl_read, "AMD_HSMP");
 
+void hsmp_init_metric_read_locks(struct hsmp_plat_device *pdev, u16 num_sockets)
+{
+	u16 i;
+
+	if (!pdev->sock || !num_sockets)
+		return;
+
+	for (i = 0; i < num_sockets; i++)
+		mutex_init(&pdev->sock[i].metric_read_lock);
+}
+EXPORT_SYMBOL_NS_GPL(hsmp_init_metric_read_locks, "AMD_HSMP");
+
+void hsmp_destroy_metric_read_locks(struct hsmp_plat_device *pdev, u16 num_sockets)
+{
+	u16 i;
+
+	if (!pdev->sock || !num_sockets)
+		return;
+
+	for (i = 0; i < num_sockets; i++) {
+		struct hsmp_socket *s = &pdev->sock[i];
+
+		if (s->metric_tbl_addr) {
+			iounmap(s->metric_tbl_addr);
+			s->metric_tbl_addr = NULL;
+		}
+		mutex_destroy(&s->metric_read_lock);
+	}
+}
+EXPORT_SYMBOL_NS_GPL(hsmp_destroy_metric_read_locks, "AMD_HSMP");
+
 int hsmp_get_tbl_dram_base(u16 sock_ind)
 {
 	struct hsmp_socket *sock = &hsmp_pdev.sock[sock_ind];
@@ -403,8 +438,7 @@ int hsmp_get_tbl_dram_base(u16 sock_ind)
 		dev_err(sock->dev, "Invalid DRAM address for metric table\n");
 		return -ENOMEM;
 	}
-	sock->metric_tbl_addr = devm_ioremap(sock->dev, dram_addr,
-					     sizeof(struct hsmp_metric_table));
+	sock->metric_tbl_addr = ioremap(dram_addr, sizeof(struct hsmp_metric_table));
 	if (!sock->metric_tbl_addr) {
 		dev_err(sock->dev, "Failed to ioremap metric table addr\n");
 		return -ENOMEM;
diff --git a/drivers/platform/x86/amd/hsmp/hsmp.h b/drivers/platform/x86/amd/hsmp/hsmp.h
index 0509a442eaae..91bc21232646 100644
--- a/drivers/platform/x86/amd/hsmp/hsmp.h
+++ b/drivers/platform/x86/amd/hsmp/hsmp.h
@@ -15,6 +15,7 @@
 #include <linux/hwmon.h>
 #include <linux/kconfig.h>
 #include <linux/miscdevice.h>
+#include <linux/mutex.h>
 #include <linux/pci.h>
 #include <linux/semaphore.h>
 #include <linux/sysfs.h>
@@ -41,6 +42,8 @@ struct hsmp_socket {
 	struct bin_attribute hsmp_attr;
 	struct hsmp_mbaddr_info mbinfo;
 	void __iomem *metric_tbl_addr;
+	/* Protects metric table snapshot reads for this socket */
+	struct mutex metric_read_lock;
 	void __iomem *virt_base_addr;
 	struct semaphore hsmp_sem;
 	char name[HSMP_ATTR_GRP_NAME_SIZE];
@@ -63,7 +66,9 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
 void hsmp_misc_deregister(void);
 int hsmp_misc_register(struct device *dev);
 int hsmp_get_tbl_dram_base(u16 sock_ind);
+void hsmp_init_metric_read_locks(struct hsmp_plat_device *pdev, u16 num_sockets);
 ssize_t hsmp_metric_tbl_read(struct hsmp_socket *sock, char *buf, size_t size);
+void hsmp_destroy_metric_read_locks(struct hsmp_plat_device *pdev, u16 num_sockets);
 struct hsmp_plat_device *get_hsmp_pdev(void);
 #if IS_ENABLED(CONFIG_HWMON)
 int hsmp_create_sensor(struct device *dev, u16 sock_ind);
diff --git a/drivers/platform/x86/amd/hsmp/plat.c b/drivers/platform/x86/amd/hsmp/plat.c
index e07f68575055..f61d6cd13e3b 100644
--- a/drivers/platform/x86/amd/hsmp/plat.c
+++ b/drivers/platform/x86/amd/hsmp/plat.c
@@ -211,6 +211,8 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev)
 	if (!hsmp_pdev->sock)
 		return -ENOMEM;
 
+	hsmp_init_metric_read_locks(hsmp_pdev, hsmp_pdev->num_sockets);
+
 	ret = init_platform_device(&pdev->dev);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to init HSMP mailbox\n");
@@ -230,6 +232,7 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev)
 static void hsmp_pltdrv_remove(struct platform_device *pdev)
 {
 	hsmp_misc_deregister();
+	hsmp_destroy_metric_read_locks(hsmp_pdev, hsmp_pdev->num_sockets);
 }
 
 static struct platform_driver amd_hsmp_driver = {
-- 
2.34.1


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

* [PATCH 3/3] platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated release
  2026-06-13 19:17 [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown Muralidhara M K
  2026-06-13 19:17 ` [PATCH 1/3] platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe mutex Muralidhara M K
  2026-06-13 19:17 ` [PATCH 2/3] platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket mutexes Muralidhara M K
@ 2026-06-13 19:17 ` Muralidhara M K
  2026-06-16  8:28 ` [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown M K, Muralidhara
  3 siblings, 0 replies; 6+ messages in thread
From: Muralidhara M K @ 2026-06-13 19:17 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, Muralidhara M K

Replace the global is_probed flag with miscdevice.this_device for misc
registration state, count ACPI socket platform devices with struct kref,
and run hsmp_acpi_sock_release() on the final put to deregister /dev/hsmp
when needed, unmap metric DRAM, and free the socket array.

Extend struct hsmp_plat_device with acpi_sock_kref and
acpi_sock_kref_started in this change so ACPI teardown can coordinate
with the refcount.

Switch ACPI socket storage to kcalloc(), initialize per-socket metric
mutexes once the array exists, and free the allocation on early probe
failures before any kref reference is handed out.

Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
---
 drivers/platform/x86/amd/hsmp/acpi.c | 76 +++++++++++++++++++++-------
 drivers/platform/x86/amd/hsmp/hsmp.h |  4 +-
 2 files changed, 62 insertions(+), 18 deletions(-)

diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
index 696884a91c22..c6840f6e15b7 100644
--- a/drivers/platform/x86/amd/hsmp/acpi.c
+++ b/drivers/platform/x86/amd/hsmp/acpi.c
@@ -587,6 +587,47 @@ static const struct acpi_device_id amd_hsmp_acpi_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, amd_hsmp_acpi_ids);
 
+static void hsmp_acpi_sock_release(struct kref *kref)
+{
+	struct hsmp_plat_device *pdev = container_of(kref, struct hsmp_plat_device,
+						     acpi_sock_kref);
+
+	mutex_lock(&hsmp_acpi_probe_mutex);
+	if (pdev->mdev.this_device)
+		hsmp_misc_deregister();
+	hsmp_destroy_metric_read_locks(pdev, pdev->num_sockets);
+	kfree(pdev->sock);
+	pdev->sock = NULL;
+	pdev->num_sockets = 0;
+	pdev->proto_ver = 0;
+	pdev->acpi_sock_kref_started = false;
+	mutex_unlock(&hsmp_acpi_probe_mutex);
+}
+
+/**
+ * hsmp_acpi_free_sock_array_early() - Drop the global socket array on early probe failure.
+ *
+ * When init_acpi() or misc_register() fails before any ACPI socket reference
+ * is handed out via kref, free the array and destroy per-socket mutexes.
+ */
+static void hsmp_acpi_free_sock_array_early(void)
+{
+	u16 i;
+
+	lockdep_assert_held(&hsmp_acpi_probe_mutex);
+
+	if (hsmp_pdev->acpi_sock_kref_started)
+		return;
+	if (!hsmp_pdev->sock)
+		return;
+
+	for (i = 0; i < hsmp_pdev->num_sockets; i++)
+		mutex_destroy(&hsmp_pdev->sock[i].metric_read_lock);
+	kfree(hsmp_pdev->sock);
+	hsmp_pdev->sock = NULL;
+	hsmp_pdev->num_sockets = 0;
+}
+
 static int hsmp_acpi_probe(struct platform_device *pdev)
 {
 	int ret;
@@ -597,34 +638,44 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
 
 	guard(mutex)(&hsmp_acpi_probe_mutex);
 
-	if (!hsmp_pdev->is_probed) {
+	if (!hsmp_pdev->sock) {
 		hsmp_pdev->num_sockets = topology_max_packages();
 		if (!hsmp_pdev->num_sockets) {
 			dev_err(&pdev->dev, "No CPU sockets detected\n");
 			return -ENODEV;
 		}
 
-		hsmp_pdev->sock = devm_kcalloc(&pdev->dev, hsmp_pdev->num_sockets,
-					       sizeof(*hsmp_pdev->sock),
-					       GFP_KERNEL);
+		hsmp_pdev->sock = kcalloc(hsmp_pdev->num_sockets,
+					  sizeof(*hsmp_pdev->sock),
+					  GFP_KERNEL);
 		if (!hsmp_pdev->sock)
 			return -ENOMEM;
+
+		hsmp_init_metric_read_locks(hsmp_pdev, hsmp_pdev->num_sockets);
 	}
 
 	ret = init_acpi(&pdev->dev);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to initialize HSMP interface.\n");
+		hsmp_acpi_free_sock_array_early();
 		return ret;
 	}
 
-	if (!hsmp_pdev->is_probed) {
+	if (!hsmp_pdev->mdev.this_device) {
 		ret = hsmp_misc_register(&pdev->dev);
 		if (ret) {
 			dev_err(&pdev->dev, "Failed to register misc device\n");
+			hsmp_acpi_free_sock_array_early();
 			return ret;
 		}
-		hsmp_pdev->is_probed = true;
-		dev_dbg(&pdev->dev, "AMD HSMP ACPI is probed successfully\n");
+		dev_dbg(&pdev->dev, "AMD HSMP ACPI misc device registered\n");
+	}
+
+	if (!hsmp_pdev->acpi_sock_kref_started) {
+		kref_init(&hsmp_pdev->acpi_sock_kref);
+		hsmp_pdev->acpi_sock_kref_started = true;
+	} else {
+		kref_get(&hsmp_pdev->acpi_sock_kref);
 	}
 
 	return 0;
@@ -632,16 +683,7 @@ static int hsmp_acpi_probe(struct platform_device *pdev)
 
 static void hsmp_acpi_remove(struct platform_device *pdev)
 {
-	mutex_lock(&hsmp_acpi_probe_mutex);
-	/*
-	 * We register only one misc_device even on multi-socket system.
-	 * So, deregister should happen only once.
-	 */
-	if (hsmp_pdev->is_probed) {
-		hsmp_misc_deregister();
-		hsmp_pdev->is_probed = false;
-	}
-	mutex_unlock(&hsmp_acpi_probe_mutex);
+	kref_put(&hsmp_pdev->acpi_sock_kref, hsmp_acpi_sock_release);
 }
 
 static struct platform_driver amd_hsmp_driver = {
diff --git a/drivers/platform/x86/amd/hsmp/hsmp.h b/drivers/platform/x86/amd/hsmp/hsmp.h
index 91bc21232646..5fcc7400cacc 100644
--- a/drivers/platform/x86/amd/hsmp/hsmp.h
+++ b/drivers/platform/x86/amd/hsmp/hsmp.h
@@ -14,6 +14,7 @@
 #include <linux/device.h>
 #include <linux/hwmon.h>
 #include <linux/kconfig.h>
+#include <linux/kref.h>
 #include <linux/miscdevice.h>
 #include <linux/mutex.h>
 #include <linux/pci.h>
@@ -57,7 +58,8 @@ struct hsmp_plat_device {
 	struct hsmp_socket *sock;
 	u32 proto_ver;
 	u16 num_sockets;
-	bool is_probed;
+	struct kref acpi_sock_kref;
+	bool acpi_sock_kref_started;
 };
 
 int hsmp_cache_proto_ver(u16 sock_ind);
-- 
2.34.1


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

* Re: [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown
  2026-06-13 19:17 [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown Muralidhara M K
                   ` (2 preceding siblings ...)
  2026-06-13 19:17 ` [PATCH 3/3] platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated release Muralidhara M K
@ 2026-06-16  8:28 ` M K, Muralidhara
  2026-06-16 12:19   ` Ilpo Järvinen
  3 siblings, 1 reply; 6+ messages in thread
From: M K, Muralidhara @ 2026-06-16  8:28 UTC (permalink / raw)
  To: Muralidhara M K, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel

Hi Ilpo,
Could you please check and review.

On 6/14/2026 12:47 AM, Muralidhara M K wrote:
> This series tightens concurrency and lifetime management in the ACPI-backed
> AMD HSMP platform path so probe/remove races cannot corrupt global probe state,
> leak metric-table DRAM mappings, or tear down shared resources while readers
> might still be active.
> 
> Patch 1 introduces a dedicated probe mutex around ACPI probe, remove, and
> init_acpi(), replacing ad-hoc synchronization on the global is_probed handshake.
> lockdep_assert_held() documents the locking contract for init_acpi().
> 
> Patch 2 switches metric table DRAM from devm_ioremap() to ioremap() with
> explicit init/teardown helpers, and embeds a per-socket mutex for metric reads.
> The legacy platform driver wires the same helpers so non-ACPI builds stay
> consistent.
> 
> Patch 3 replaces the global is_probed flag with miscdevice registration state,
> refcounts ACPI socket platform devices with kref, and runs coordinated release
> on the final put: misc deregistration when appropriate, metric unmap, and socket
> array free. Socket storage uses kcalloc() with careful failure cleanup before
> any kref is published.
> 
> Muralidhara M K (3):
>    platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe
>      mutex
>    platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket
>      mutexes
>    platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated
>      release
> 
>   drivers/platform/x86/amd/hsmp/acpi.c | 87 +++++++++++++++++++++++-----
>   drivers/platform/x86/amd/hsmp/hsmp.c | 38 +++++++++++-
>   drivers/platform/x86/amd/hsmp/hsmp.h |  9 ++-
>   drivers/platform/x86/amd/hsmp/plat.c |  3 +
>   4 files changed, 119 insertions(+), 18 deletions(-)
> 


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

* Re: [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown
  2026-06-16  8:28 ` [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown M K, Muralidhara
@ 2026-06-16 12:19   ` Ilpo Järvinen
  0 siblings, 0 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2026-06-16 12:19 UTC (permalink / raw)
  To: M K, Muralidhara; +Cc: Muralidhara M K, platform-driver-x86, LKML

On Tue, 16 Jun 2026, M K, Muralidhara wrote:

> Hi Ilpo,
> Could you please check and review.

Hi,

Please wait at least 2 weeks before inquiring about any series. And in 
any case, if the series is still listed in the platform drivers patchwork 
queue I'll eventually get to it (it won't be forgotten as long as it
appears in the patchwork).

In the meantime, you may want to check if sashiko.dev has found something 
that should be corrected. As sashiko is AI, it isn't always right so keep 
that in mind while reading it's findings. You don't need to address 
"pre-existing issue" reports sashiko gives nor defend against any of its 
findings unless a seasoned reviewer agrees with sashiko.

-- 
 i.

> On 6/14/2026 12:47 AM, Muralidhara M K wrote:
> > This series tightens concurrency and lifetime management in the ACPI-backed
> > AMD HSMP platform path so probe/remove races cannot corrupt global probe
> > state,
> > leak metric-table DRAM mappings, or tear down shared resources while readers
> > might still be active.
> > 
> > Patch 1 introduces a dedicated probe mutex around ACPI probe, remove, and
> > init_acpi(), replacing ad-hoc synchronization on the global is_probed
> > handshake.
> > lockdep_assert_held() documents the locking contract for init_acpi().
> > 
> > Patch 2 switches metric table DRAM from devm_ioremap() to ioremap() with
> > explicit init/teardown helpers, and embeds a per-socket mutex for metric
> > reads.
> > The legacy platform driver wires the same helpers so non-ACPI builds stay
> > consistent.
> > 
> > Patch 3 replaces the global is_probed flag with miscdevice registration
> > state,
> > refcounts ACPI socket platform devices with kref, and runs coordinated
> > release
> > on the final put: misc deregistration when appropriate, metric unmap, and
> > socket
> > array free. Socket storage uses kcalloc() with careful failure cleanup
> > before
> > any kref is published.
> > 
> > Muralidhara M K (3):
> >    platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe
> >      mutex
> >    platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket
> >      mutexes
> >    platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated
> >      release
> > 
> >   drivers/platform/x86/amd/hsmp/acpi.c | 87 +++++++++++++++++++++++-----
> >   drivers/platform/x86/amd/hsmp/hsmp.c | 38 +++++++++++-
> >   drivers/platform/x86/amd/hsmp/hsmp.h |  9 ++-
> >   drivers/platform/x86/amd/hsmp/plat.c |  3 +
> >   4 files changed, 119 insertions(+), 18 deletions(-)
> > 
> 

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

end of thread, other threads:[~2026-06-16 12:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-13 19:17 [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown Muralidhara M K
2026-06-13 19:17 ` [PATCH 1/3] platform/x86/amd/hsmp: Serialize ACPI HSMP is_probed with a probe mutex Muralidhara M K
2026-06-13 19:17 ` [PATCH 2/3] platform/x86/amd/hsmp: Add explicit metric DRAM mapping and per-socket mutexes Muralidhara M K
2026-06-13 19:17 ` [PATCH 3/3] platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated release Muralidhara M K
2026-06-16  8:28 ` [PATCH 0/3] platform/x86/amd/hsmp: Harden ACPI probe, metric DRAM, and socket teardown M K, Muralidhara
2026-06-16 12:19   ` Ilpo Järvinen

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®