From: Ivan Vecera <ivecera@redhat.com>
To: Petr Oros <poros@redhat.com>, netdev@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Shuah Khan <shuah@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>,
Jani Nikula <jani.nikula@intel.com>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
Jiri Pirko <jiri@resnulli.us>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v2 14/14] selftests: dpll: add reference leak tests
Date: Fri, 6 Nov 2026 11:47:05 +0100 [thread overview]
Message-ID: <308681fb-2c07-472f-ac96-dcb70816285f@redhat.com> (raw)
In-Reply-To: <20261105151852.1844305-15-poros@redhat.com>
On 11/5/26 16:18, Petr Oros wrote:
> With CONFIG_DPLL_REFCNT_TRACKER the DPLL core keeps the stack traces of
> unreleased device and pin references in debugfs. The entries do not
> name their owner, so add library helpers that snapshot the entries
> present before a test creates its devices and fail when an entry that
> is not in the snapshot still holds references afterwards. An entry in
> the snapshot belongs to an object of another driver and is ignored
> even when its content changed, since other drivers take and drop
> references while the tests run. A concurrent dump holds references for
> a moment, so the check waits for the candidates to drain. Attributing
> by name means that a leak of an earlier run goes unnoticed and that an
> object reusing the address of a freed one from the snapshot can hide a
> leak, which is accepted, the entries carry nothing better to go by. A
> second run alongside would have its devices attributed to this one,
> which is one more reason for the lock every script takes.
>
> Whether the tracker works is probed with a throwaway device, which has
> to show entries while it is live and to drain them once it is deleted,
> so that a kernel without the tracker is told apart from a broken
> simulator and from a leak. The probe runs as the first test of the
> stress script, which gains a final leak check, and of the new
> dpll_reftrack.sh, which registers a device, removes it and verifies
> that no reference survived. The snapshot file lives next to the lock
> file under /run, for the same reason the lock file does not live in
> /tmp. The library mounts debugfs when nothing else did, like it does
> for configfs, and the selftest config enables the tracker together
> with CONFIG_DEBUG_KERNEL, which it depends on, and debugfs.
>
> Signed-off-by: Petr Oros <poros@redhat.com>
Which dump holds a reference here?
The references to a dpll_device or a dpll_pin are taken in
dpll_device_get(), dpll_device_register(), dpll_pin_get(),
fwnode_dpll_pin_find() and by the pin registration, in
dpll_xa_ref_pin_add() and dpll_xa_ref_dpll_add().
The netlink dump and doit handlers in drivers/dpll/dpll_netlink.c run
under dpll_lock and do not take one.
Could the sentence name what actually holds the references the check waits
for, or be dropped if nothing does? The same sentence is in the comment
above dpll_ref_tracker_check_leaks():
[...]
> diff --git a/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh b/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh
> index ada10ee4394fd5..d851237bdac440 100644
> --- a/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh
> +++ b/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh
[...]
> @@ -622,3 +639,212 @@ dpllsim_setup_standard_device()
[...]
> +# $1: snapshot file written by dpll_ref_tracker_snapshot before the
> +# objects under test were created. Return 0 when no reference to an
> +# object created since the snapshot is held any more. A concurrent dump
> +# holds references for a moment, so wait for the candidates to drain. A
> +# timeout means the references never drained, the candidates seen by the
> +# last check are then printed and count as leaked.
> +dpll_ref_tracker_check_leaks()
[...]
Thanks,
Ivan
next prev parent reply other threads:[~2026-11-06 10:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 15:18 [PATCH net-next v2 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-11-05 15:18 ` [PATCH net-next v2 01/14] dpll: dpllsim: Add " Petr Oros
2026-11-06 10:47 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-11-06 10:48 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-11-06 10:48 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-11-06 10:48 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-11-06 10:41 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 06/14] selftests: dpll: add pin state tests Petr Oros
2026-11-06 10:49 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-11-06 10:49 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 08/14] selftests: dpll: add pin priority test Petr Oros
2026-11-06 10:50 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-11-06 10:50 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 10/14] selftests: dpll: add pin frequency test Petr Oros
2026-11-06 10:51 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-11-06 10:51 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-11-06 10:51 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-11-06 10:52 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-11-06 10:47 ` Ivan Vecera [this message]
2026-11-06 12:27 ` [PATCH net-next v2 00/14] dpll: add a simulated DPLL device driver Jiri Pirko
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=308681fb-2c07-472f-ac96-dcb70816285f@redhat.com \
--to=ivecera@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=arkadiusz.kubalewski@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jani.nikula@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=poros@redhat.com \
--cc=rdunlap@infradead.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=vadim.fedorenko@linux.dev \
/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