RE: [Intel-wired-lan] [PATCH net-next v3 7/9] dpll: Add reference count tracking support
From: Loktionov, Aleksandr <hidden>
Date: 2026-01-30 17:52:12
Also in:
intel-wired-lan, linux-rdma, lkml
quoted hunk ↗ jump to hunk
-----Original Message----- From: Intel-wired-lan <redacted> On Behalf Of Ivan Vecera Sent: Friday, January 30, 2026 5:54 PM To: netdev@vger.kernel.org Cc: Eric Dumazet <edumazet@google.com>; Nguyen, Anthony L [off-list ref]; Leon Romanovsky [off-list ref]; Lobakin, Aleksander [off-list ref]; linux- rdma@vger.kernel.org; Kitszel, Przemyslaw [off-list ref]; Kubalewski, Arkadiusz [off-list ref]; intel-wired-lan@lists.osuosl.org; Jakub Kicinski [off-list ref]; Paolo Abeni [off-list ref]; Jiri Pirko [off-list ref]; Richard Cochran [off-list ref]; Prathosh Satish [off-list ref]; Vadim Fedorenko [off-list ref]; Mark Bloch [off-list ref]; linux- kernel@vger.kernel.org; Tariq Toukan [off-list ref]; Andrew Lunn [off-list ref]; Jonathan Lemon [off-list ref]; Saeed Mahameed [off-list ref]; David S. Miller [off-list ref] Subject: [Intel-wired-lan] [PATCH net-next v3 7/9] dpll: Add reference count tracking support Add support for the REF_TRACKER infrastructure to the DPLL subsystem. When enabled, this allows developers to track and debug reference counting leaks or imbalances for dpll_device and dpll_pin objects. It records stack traces for every get/put operation and exposes this information via debugfs at: /sys/kernel/debug/ref_tracker/dpll_device_* /sys/kernel/debug/ref_tracker/dpll_pin_* The following API changes are made to support this: 1. dpll_device_get() / dpll_device_put() now accept a 'dpll_tracker *' (which is a typedef to 'struct ref_tracker *' when enabled, or an empty struct otherwise). 2. dpll_pin_get() / dpll_pin_put() and fwnode_dpll_pin_find() similarly accept the tracker argument. 3. Internal registration structures now hold a tracker to associate the reference held by the registration with the specific owner. All existing in-tree drivers (ice, mlx5, ptp_ocp, zl3073x) are updated to pass NULL for the new tracker argument, maintaining current behavior while enabling future debugging capabilities. Co-developed-by: Petr Oros <redacted> Signed-off-by: Petr Oros <redacted> Signed-off-by: Ivan Vecera <ivecera@redhat.com> --- v3: * added Kconfig dependency on STACKTRACE_SUPPORT and DEBUG_KERNEL --- drivers/dpll/Kconfig | 15 +++ drivers/dpll/dpll_core.c | 98 ++++++++++++++---- - drivers/dpll/dpll_core.h | 5 + drivers/dpll/zl3073x/dpll.c | 12 +-- drivers/net/ethernet/intel/ice/ice_dpll.c | 14 +-- .../net/ethernet/mellanox/mlx5/core/dpll.c | 13 +-- drivers/ptp/ptp_ocp.c | 15 +-- include/linux/dpll.h | 19 +++- 8 files changed, 138 insertions(+), 53 deletions(-)diff --git a/drivers/dpll/Kconfig b/drivers/dpll/Kconfig indexade872c915ac6..be98969f040ab 100644--- a/drivers/dpll/Kconfig +++ b/drivers/dpll/Kconfig@@ -8,6 +8,21 @@ menu "DPLL device support" config DPLL bool +config DPLL_REFCNT_TRACKER + bool "DPLL reference count tracking" + depends on DEBUG_KERNEL && STACKTRACE_SUPPORT && DPLL + select REF_TRACKER + help + Enable reference count tracking for DPLL devices and pins. + This helps debugging reference leaks and use-after-free bugs + by recording stack traces for each get/put operation. + + The tracking information is exposed via debugfs at: + /sys/kernel/debug/ref_tracker/dpll_device_* + /sys/kernel/debug/ref_tracker/dpll_pin_* + + If unsure, say N. + source "drivers/dpll/zl3073x/Kconfig" endmenudiff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index33333bc2f0cc8..52b2398b9f3ec 100644
...
-- 2.52.0
Reviewed-by: Aleksandr Loktionov <redacted>