🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24120

Re: [PATCH net-next v5 06/14] selftests: dpll: add pin state tests

#24120
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
179 lines
14382 bytes
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
Technical Details
Message-ID: <179594873061.3146.3568965349074234043@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373453-linux-kernel-netdev=dewy.ru
References: <20261125090522.3777494-7-poros@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373453-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 06/14] selftests: dpll: add pin state tests
Date: Sun, 29 Nov 2026 10:38:50 +0000
Organization: Usenet Network
Message-ID: <179594873061.3146.3568965349074234043@kernel.org>
References: <20261125090522.3777494-7-poros@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1150327"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6VzRfAtfgMFLdAjFDTKVEOhEHCI= sha256:XbrtzfL0M9ivSChG61Q6Fnn0V28AmuI4yOSE7Af8uqY=
	sha1:RR6XMeZehK4pa6vboG3etJPcrQY= sha256:IRfZpPqShvNsp9Cr+0GKVXGrMUkOzV0DXvheEXtwGww=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 00238125F98; Sun, 29 Nov 2026 13:39:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id vjboaFziRlh0;
	Sun, 29 Nov 2026 13:39:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373453-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 098E8125F97; Sun, 29 Nov 2026 13:38:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CD1472506A; Sun, 29 Nov 2026 10:38:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795948733;
	b=bflU3wy3d2nPWtR44tTQMMtCc0CF0kbCKzONGEg+p3FvRadpvmY92pkEHGHGVM3m0wm7
	 hyNNq8DgXUbQhL/Zb3kq84vrMuWPd58g03s0t57u2t96y75Vudkj08VjrylWLFPHx3uIk
	 ZhylYKxqq4bdlQVVEowYQ5fRitFPFT86IQzvDcTrjui4dS59E2hne9geD+MjlPSIbHT70
	 Dm66dcZiae9xk/TBoJD66LyhowUH4ySFjQWK+DeVftoDXEzIG/dbIqKRN/y5NNMYFkByo
	 n5NaJjOFDxwZQm1WbEbdUN/eg+3/iLMW2clLvj4m5hFGayFN+PHRtJuVwxveUbszSNQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948733;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=yOPRQVvDx9kk+1saXXX2yVpzulTc99MbscCaAsBmLRE=;
	b=4PGH2a/qFGZKPf5maqLVYxEZBGA5OIuFsxkitaUZhMKz5maFtAADtaXOg8fjDflyWFzH
	 Ei0PIyG8JItNk0Io9WQgkT35gQwTpqX4sJgeNkezzoB+mmqzeS0VD0csBq1zrcj0Zw07T
	 ysFfnoI49GFltCPU6G7YUeb4tIuoy4A4xy/zRFk6rHadscwVgvqQW2N0LlNwXX1zZ8X7X
	 E8o0ac4bwcLKv56O/xcqvMzUcJ+F7NFQ0kV8UkUna/0T7cGipZYHW2qHpcfFBLRO7y6FU
	 7XoZd1B+QmJjrSnidD1j0ihGNWd1r2JhJlMObf8TssIRqRHStWjKsNt5rECxoK8mu9g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XN01PeAa;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AC24606A337;
	Sun, 29 Nov 2026 10:38:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XN01PeAa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795948732;
	b=Xc3rtDOxA1tIeTaxWq0Y5jJXyeAHiZ1G4r+J1gHgCfrJq8sEy4K6oNCk2f81zHnzMsy5
	 DSzErznnA4ZzKznU679sFN18YGpx15xKP7hVG9UV6gJ9Oeq2B71QkAjru35RD7uFDuXYq
	 XOP0MzAST4G1MTDTU3UjbyChAZysxqpMieXOSMUFDIMZvZ0zHaJiwLtEPmvHEzqw2hv4A
	 PuYo5jwcjDV9DfAyC/3EgzbaGOKlbPPzhk6xKpfxoEO9ixEXcYyACFz9R3AC1jmzaR/Mm
	 1OrfM2/ivgSyKA0FibjqWIIpIgEs9aRR4grk8l1Ye4Sny0aY5Gb6KOqLGu0k5T3Fmcw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948732;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=yOPRQVvDx9kk+1saXXX2yVpzulTc99MbscCaAsBmLRE=;
	b=HW61aAwTpDszvvjuBBZOCxjIRKyjSPFn83FWyXpyI7Oofsx8P72tOys2vjXXOVZeTFFv
	 A/XMriGxN5q8Ar40+09VO72ycD4nPUS2kHYQ1iCELTLmeIvZO5VoZdX+Ji8k0iihzvDTT
	 IKAVT9wTc5QNI6FXwE7EDCLKTzBCh/FlEeNdGo5dHFm8oxq4tKGcLolIAAWhU7kHwa0nA
	 ui8Y3bmek8vnkSgMDpCym/pBovrofMPV7dBDwqMcHkA4L+rvYfZi7xI8ySFJtSwcg4bsr
	 nvEfV07v1jLimZX8nG74xv2nUQufY/wIYJL7jZf4AoDK08wYf8qz60lXwK+E7hDnJUQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XN01PeAa;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BBC7606A32D;
	Sun, 29 Nov 2026 10:38:52 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 136AC1F0089F;
	Sun, 29 Nov 2026 10:38:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795948732;
	bh=yOPRQVvDx9kk+1saXXX2yVpzulTc99MbscCaAsBmLRE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=XN01PeAac95QAjRf/ZZQMcecpPLC0ZVgdzzK+lZ9CFHzn/2E+0EOkLjfVm671nNoO
	 pcEVbY0xaXk2V4Smnjatw1R6fT7th86wqtYO73XzqHf+FdRhqFXU8wJA+jeuaB6iWq
	 TqPbkXyMc+BeRWfJdmNpuB1fknQxiPPYfhuoZW73yFmspYbvK6By5cK7Bl2IGf3Z0p
	 CdfvC5kP+vqkFkbp8Of3yqSso85Q20y4KcN1wg4Mf2yurD9HtkpbaaTMB1Wl/n/xwx
	 lJiZXOq3USbxVZZoQceNpjcEHAdJV4Nj+MYdnu1VDd8qfXxY9dunVgKyNF+T88UGyt
	 CP2Nkvqde4oTw==
X-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
X-In-Reply-To: <20261125090522.3777494-7-poros@redhat.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list