Linux Documentation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: poros@redhat.com
Cc: netdev@vger.kernel.org, ivecera@redhat.com, jiri@nvidia.com,
	corbet@lwn.net, skhan@linuxfoundation.org, shuah@kernel.org,
	rdunlap@infradead.org, jani.nikula@intel.com,
	vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com,
	jiri@resnulli.us, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v4 02/14] selftests: dpll: add test library and device lifecycle tests
Date: Mon, 16 Nov 2026 14:29:59 +0000	[thread overview]
Message-ID: <179483939997.3136.11285041510598744878@kernel.org> (raw)
In-Reply-To: <20261112130359.840795-3-poros@redhat.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] When dpllsim is built in (CONFIG_DPLLSIM=y), the selftests
  cannot find their own devices and report a hard FAIL where they should…
- [Low] A second signal can still abort the exit-trap teardown, despite
  the comment in cleanup().

--

selftests: dpll: add test library and device lifecycle tests

This adds a shell library for the DPLL selftests. It wraps the iproute2
dpll tool and the dpllsim configfs interface, and the patch also adds
dpll_basic.sh and dpll_stress.sh. The library finds simulated devices by
clock ID and module name, and each script takes a lock, mounts configfs
when needed and cleans up from an exit trap.

> diff --git a/tools/testing/selftests/drivers/dpll/dpll_lib.sh b/tools/testing/selftests/drivers/dpll/dpll_lib.sh
> new file mode 100644
> index 0000000000000..9fe7f2f62dd46
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_lib.sh

[ ... ]

> +# $1: clock-id, $2: module name (optional)
> +dpll_device_get_id_by_clock_id()
> +{
> +	local clock_id=$1
> +	local module=${2:-}
> +	local out
> +
> +	out=$(dpll device show -j 2>/dev/null) || return 1
> +	jq -r --arg cid "$clock_id" --arg mod "$module" \
> +	   '[.device[]? |
> +	     select((.["clock-id"] | tostring) == $cid and
> +		    ($mod == "" or .["module-name"] == $mod))
> +	    ][0].id // empty' <<< "$out"
> +}

[Severity: Medium]
Does this module-name match work when dpllsim is built in?

DPLLSIM is a tristate. With CONFIG_DPLLSIM=y, THIS_MODULE is NULL, and
dpllsim registers its device with:

drivers/dpll/dpllsim/dpll.c:dpllsim_dev_deploy() {
    ...
	dpll = dpll_device_get(sim->clock_id, 0, THIS_MODULE, &sim->tracker);
    ...
}

The netlink reply then carries:

drivers/dpll/dpll_netlink.c:dpll_device_get_one() {
    ...
	if (nla_put_string(msg, DPLL_A_MODULE_NAME, module_name(dpll->module)))
    ...
}

module_name() returns "kernel" for a NULL module. With mod=dpllsim, the
select above never matches a device the script created.

dpllsim_available() still counts a built-in simulator as available. Once
/sys/kernel/config/dpllsim exists it returns 0, and it ignores the
modprobe result:

	[ -d "$DPLLSIM_CFG" ] && return 0

So the scripts create and deploy a device that their own lookup cannot
find:

In dpll_basic.sh, dpllsim_setup_standard_device() calls
dpll_device_wait_by_clock_id "$clock_id" dpllsim. busywait runs until
BUSYWAIT_TIMEOUT, and the script then prints "FAIL: cannot create dpllsim
device" and exits with ksft_fail.

In dpll_stress.sh, test_deploy_cycle() fails on its first iteration with
"device not on netlink".

The default branch of dpll_lib_init() has a related problem:

	select(.["module-name"] != "dpllsim")

This does not exclude a leftover built-in dpllsim device, so that device
would be tested as if it were hardware.

The later patches in the series (the pin flooding and many-devices tests)
still use the same module-name filter, so they do not fix this.

Could the lookups handle a built-in dpllsim, or should the scripts skip
when dpllsim is not a module?

> diff --git a/tools/testing/selftests/drivers/dpll/dpll_stress.sh b/tools/testing/selftests/drivers/dpll/dpll_stress.sh
> new file mode 100755
> index 0000000000000..01d57ab0172b0
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_stress.sh

[ ... ]

> +cleanup()
> +{
> +	local dev
> +
> +	# A second signal must not abort the teardown half way.
> +	trap '' INT TERM

[Severity: Low]
Can a second signal still abort the teardown here? The script sets up its
traps like this:

	trap cleanup EXIT
	trap 'exit 1' INT TERM

The INT/TERM handler stays "exit 1" until cleanup() itself runs
trap '' INT TERM, and here "local dev" runs before that.

If another INT or TERM is handled at that command boundary, exit 1 runs
inside the EXIT trap. bash does not run the EXIT trap a second time, so
the shell exits without running:

- the CREATED_DEVICES loop
- the DPLLSIM_CREATED_NAME delete
- dpll_lib_cleanup()

The simulated devices and the configfs mount from this run would then be
left behind.

dpll_basic.sh uses the same trap pattern. Its cleanup() runs the ignore
first, which makes the window smaller but does not remove it.

The window is still there at the end of the series. There, cleanup() in
dpll_stress.sh runs "local pid dev base" and "local pids=() shell_jobs=()"
before the ignore.

Would it be better to ignore the signals in the handler itself? For
example:

	trap 'trap "" INT TERM; exit 1' INT TERM

Or at least make the ignore the first statement of every cleanup()?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112130359.840795-1-poros%40redhat.com

  reply	other threads:[~2026-11-16 14:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 13:03 [PATCH net-next v4 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 01/14] dpll: dpllsim: Add " Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-11-16 14:29   ` netdev-bot+sashiko [this message]
2026-11-12 13:03 ` [PATCH net-next v4 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 06/14] selftests: dpll: add pin state tests Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko
2026-11-12 13:03 ` [PATCH net-next v4 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 08/14] selftests: dpll: add pin priority test Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko
2026-11-12 13:03 ` [PATCH net-next v4 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-11-12 13:03 ` [PATCH net-next v4 10/14] selftests: dpll: add pin frequency test Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko
2026-11-12 13:03 ` [PATCH net-next v4 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko
2026-11-12 13:03 ` [PATCH net-next v4 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko
2026-11-12 13:03 ` [PATCH net-next v4 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko
2026-11-12 13:03 ` [PATCH net-next v4 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-11-16 14:30   ` netdev-bot+sashiko

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=179483939997.3136.11285041510598744878@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jani.nikula@intel.com \
    --cc=jiri@nvidia.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