RE: [Intel-wired-lan] [PATCH net-next v3 7/9] dpll: Add reference count tracking support

From: Loktionov, Aleksandr

Date: Fri Jan 30 2026 - 12:53:06 EST




> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of Ivan Vecera
> Sent: Friday, January 30, 2026 5:54 PM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: Eric Dumazet <edumazet@xxxxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Leon Romanovsky <leon@xxxxxxxxxx>;
> Lobakin, Aleksander <aleksander.lobakin@xxxxxxxxx>; linux-
> rdma@xxxxxxxxxxxxxxx; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Kubalewski, Arkadiusz
> <arkadiusz.kubalewski@xxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx;
> Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>;
> Jiri Pirko <jiri@xxxxxxxxxxx>; Richard Cochran
> <richardcochran@xxxxxxxxx>; Prathosh Satish
> <Prathosh.Satish@xxxxxxxxxxxxx>; Vadim Fedorenko
> <vadim.fedorenko@xxxxxxxxx>; Mark Bloch <mbloch@xxxxxxxxxx>; linux-
> kernel@xxxxxxxxxxxxxxx; Tariq Toukan <tariqt@xxxxxxxxxx>; Andrew Lunn
> <andrew+netdev@xxxxxxx>; Jonathan Lemon <jonathan.lemon@xxxxxxxxx>;
> Saeed Mahameed <saeedm@xxxxxxxxxx>; David S. Miller
> <davem@xxxxxxxxxxxxx>
> 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 <poros@xxxxxxxxxx>
> Signed-off-by: Petr Oros <poros@xxxxxxxxxx>
> Signed-off-by: Ivan Vecera <ivecera@xxxxxxxxxx>
> ---
> 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 index
> ade872c915ac6..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"
>
> endmenu
> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index
> 33333bc2f0cc8..52b2398b9f3ec 100644

...

> --
> 2.52.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>