Netdev List
 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 v5 06/14] selftests: dpll: add pin state tests
Date: Sun, 29 Nov 2026 10:38:50 +0000	[thread overview]
Message-ID: <179594873061.3146.3568965349074234043@kernel.org> (raw)
In-Reply-To: <20261125090522.3777494-7-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] On ice E810-T, test_pin_state_transitions can leave SMA2
  changed and still report PASS when it picks U.FL2 as PIN_TUNE_ID.
- [Low] pin_is_spare() in
  tools/testing/selftests/drivers/dpll/dpll_features.sh reads the two…

--

selftests: dpll: add pin state tests

This adds dpll_features.sh. The script picks a spare input pin on a
dpllsim device or on a device the user names, moves it between
disconnected and selectable in automatic mode, reads each state back and
restores the original state. The library gains a pin state setter, a
device mode getter and a pin set keyword check, and the stress script
gains a test that floods one pin with state changes.

> diff --git a/tools/testing/selftests/drivers/dpll/dpll_features.sh b/tools/testing/selftests/drivers/dpll/dpll_features.sh
> new file mode 100755
> index 0000000000000..61ebfd9e71892
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_features.sh
> @@ -0,0 +1,477 @@

[ ... ]

> +	for state in disconnected selectable; do
> +		changed=$TUNE_CHANGED
> +		[ "$state" = "$before" ] || TUNE_CHANGED=1
> +		if ! dpll_pin_set_state "$DPLL_DEV_ID" "$PIN_TUNE_ID" \
> +					"$state"; then

[ ... ]

> +	done

[ ... ]

> +	if ! dpll_pin_set_state "$DPLL_DEV_ID" "$PIN_TUNE_ID" "$before"; then
> +		reason=${DPLL_LAST_ERR%%$'\n'*}
> +		reason=${reason:+, $reason}
> +		if [ "$RET" -eq 0 ]; then
> +			dpll_log_test_skip_or_fail \
> +			    "DPLL pin state transitions" \
> +			    "cannot set pin state to $before$reason"
> +			return
> +		fi
> +		check_err 1 "cannot restore pin state$reason"
> +	else
> +		TUNE_CHANGED=0
> +	fi
> +	# The automatic selection may pick a pin that is selectable again,
> +	# like it may in the loop above.
> +	after=$(dpll_pin_get_state "$DPLL_DEV_ID" "$PIN_TUNE_ID")
> +	if [ -z "$after" ]; then
> +		check_err 1 "cannot read the restored pin state back"
> +	elif [ "$after" != "$before" ] &&
> +	     [ "$may_pick/$before/$after" != 1/selectable/connected ]; then
> +		check_err 1 "pin state not restored, got '$after'"
> +	fi
> +
> +	log_test "DPLL pin state transitions"
> +}

[Severity: Medium]
On ice E810-T, can test_pin_state_transitions() leave SMA2 changed and
still log a pass when U.FL2 is picked as PIN_TUNE_ID?

On a device the user provides, U.FL2 passes pin_is_spare(). It is of type
ext, disconnected by default and has state-can-change. It also passes
pin_ranks_below_refs() whenever SMA2 ranks below the reference, because
U.FL2 reports the priority of the CGU input it shares with SMA2:

drivers/net/ethernet/intel/ice/ice_dpll.c:ice_dpll_sw_input_prio_get() {
    ...
	*prio = d->input_prio[p->input->idx];
    ...
}

In the loop, disconnected does nothing because DIR_EN is clear. Selectable
then does this:

drivers/net/ethernet/intel/ice/ice_dpll.c:ice_dpll_ufl_pin_state_set() {
    ...
	case ICE_DPLL_PIN_SW_2_IDX:
		if (state == DPLL_PIN_STATE_SELECTABLE) {
			data |= ICE_SMA2_DIR_EN;
			data &= ~ICE_SMA2_UFL2_RX_DIS;
			enable = true;
    ...
}

ice_dpll_init_info_sw_pins() sets ICE_SMA2_TX_EN by default. With DIR_EN
also set, the value matches ICE_SMA2_INACTIVE_MASK, so
ice_dpll_sw_pins_update() reports SMA2 as inactive. If TX_EN was clear,
SMA2 is reported as an output instead.

The restore to disconnected only does this:

			data |= ICE_SMA2_UFL2_RX_DIS;
			enable = false;
    ...
		ret = ice_dpll_pin_disable(hw, target, type, extack);

ICE_SMA2_DIR_EN is never cleared, and the CGU input shared with SMA2 is
disabled.

The U.FL2 readback above shows disconnected. The test therefore clears
TUNE_CHANGED, the deferred restore does nothing and the test passes. SMA2
started as an active input and ends up inactive or as an output, with its
CGU input disabled. A backup reference on SMA2 then drops out of
automatic selection without anything reporting it.

The header does say that reconfiguring U.FL2 changes the other pin too.
It also says the tests restore the pin and "leave alone what could change
the input a device uses". Is there a way for the test to detect or avoid
this case? The script is unchanged in this respect at the end of the
series.

[ ... ]

> +pin_is_spare()
> +{
> +	local devs pins
> +
> +	devs=$(dpll device show -j 2>/dev/null) || return 2
> +	pins=$(dpll pin show -j 2>/dev/null) || return 2

[Severity: Low]
Would it be safer to dump the pins before the devices here?

$held is built from the lock-status in the device dump, and $shown from
the pin dump, which is taken afterwards. A parent device can go from
unlocked to locked between the two calls while its new reference shows
only through operstate. The comment above says this is the case for
zl3073x with iproute2 up to 7.1.

In that case the stale unlocked status keeps the device out of $held. The
new reference, still reported selectable, is not in $shown. It then
passes as spare in pick_tune_pin() and in the recheck in pin_tune_spare(),
and test_pin_state_transitions() can set it disconnected.

With the pin dump first, the same transition puts the device in $held but
not in $shown, and every pin on it is rejected. The order is the same at
the end of the series, in "selftests: dpll: add reference leak tests".

> +	jq -e -s --argjson dev "$1" --argjson id "$2" '
> +		(.[0].device? // [.[0]]) as $devs |
> +		(.[1].pin? // [.[1]]) as $pins |
> +		[$pins[] | .["parent-device"][]? |
> +		 select(.direction == "input" and
> +			(.state == "connected" or .operstate == "active")) |
> +		 .["parent-id"]] as $shown |
> +		[$devs[] | select(.["lock-status"] != "unlocked") | .id]
> +		as $held |

[ ... ]

> +		all($on[]; .state != "connected" and
> +			   .operstate != "active" and
> +			   (.["parent-id"] as $p |
> +			    ($shown | index($p)) != null or
> +			    ($held | index($p)) == null))' \
> +		<<< "$devs"$'\n'"$pins" &> /dev/null || return 1
> +}

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

  parent reply	other threads:[~2026-11-29 10:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  9:05 [PATCH net-next v5 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-11-25  9:05 ` [PATCH net-next v5 01/14] dpll: dpllsim: Add " Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-11-25  9:05 ` [PATCH net-next v5 06/14] selftests: dpll: add pin state tests Petr Oros
2026-11-27 13:39   ` Ivan Vecera
2026-11-29 10:38   ` netdev-bot+sashiko [this message]
2026-11-25  9:05 ` [PATCH net-next v5 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-11-27 13:39   ` Ivan Vecera
2026-11-25  9:05 ` [PATCH net-next v5 08/14] selftests: dpll: add pin priority test Petr Oros
2026-11-27 13:40   ` Ivan Vecera
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-11-27 13:40   ` Ivan Vecera
2026-11-25  9:05 ` [PATCH net-next v5 10/14] selftests: dpll: add pin frequency test Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-11-25  9:05 ` [PATCH net-next v5 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-11-29 10:38   ` netdev-bot+sashiko
2026-11-25  9:05 ` [PATCH net-next v5 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-11-29 10:39   ` 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=179594873061.3146.3568965349074234043@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