summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/stackcollapse-record
diff options
context:
space:
mode:
authorMuralidhara M K <muralidhara.mk@amd.com>2026-07-23 15:16:55 +0530
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2026-07-24 19:12:18 +0300
commit9b2895edb2b3ec1fb8a5adadb5305f6459151d38 (patch)
tree7a3c4f93ebeedd527b864eb1fda0e79a8fd4a11e /tools/perf/scripts/python/bin/stackcollapse-record
parent6bd243d5abd91ee7d7fa58a9ed60381da49b4b0a (diff)
platform/x86/amd/hsmp: ACPI HSMP refcounted sockets and coordinated release
The ACPI driver binds one platform device per socket but shares a single socket array and a single /dev/hsmp misc device across them. Replace the is_probed flag with state that tracks this shared ownership: - miscdevice.this_device tells whether /dev/hsmp is registered, so the misc device is registered on the first socket and torn down last. A preceding change clears mdev.this_device on deregister so this gate stays reliable across a re-probe. - a kref tracks the sockets that share the array. The first probe initializes it, each further probe takes a reference and every remove (or probe failure) drops one; the last put runs the release callback. All get/put happen under hsmp_sock_rwsem held for write, so the counting is already serialized and kref's atomic is not strictly needed, but kref gives the clearer get/put interface and a release callback. The shared socket array is allocated with kcalloc() on the first probe and freed by the release callback once the last reference is dropped. hsmp_acpi_sock_release() is the single teardown helper, run from kref_put(): it deregisters /dev/hsmp if registered, unmaps any metric-table DRAM, destroys the per-socket mutexes and frees the array. The remove path and the probe-failure path both reach it through the last put, so the teardown lives in one place. Both paths also clear this socket's dev, so a message issued after a non-final unbind (or to a socket that failed to probe on a multi-socket system, whose array stays alive and whose remove() is never called) cannot reach the mailbox that devres is about to unmap. Two lifetime fixes fall out of the array persisting across a non-final unbind: - hsmp_get_tbl_dram_base() iounmap()s any stale metric_tbl_addr before remapping, so a rebind does not leak one mapping per cycle. It runs during (re)probe before the metric sysfs attribute is exposed, so no reader can be using the old mapping. - The ACPI path registers /dev/hsmp unparented by passing NULL to hsmp_misc_register(). Its per-socket devices can be unbound individually and out of order and the misc device outlives all but the last of them, so parenting it to one socket's device would leave a dangling parent. hsmp_misc_register() now takes the parent from its caller, so the platform driver keeps parenting /dev/hsmp to its single device. hsmp_sock_rwsem is held for write across probe and remove, so the release and probe-failure cleanup run with it already held; an upcoming change adds its read side so the same lock also drains the data plane. Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com> Link: https://patch.msgid.link/20260723094656.3806028-6-muralidhara.mk@amd.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions