🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24126

Re: [PATCH net-next v5 10/14] selftests: dpll: add pin frequency test

#24126
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
175 lines
14156 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 0

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 a zl3073x input reference whose frequency comes from a
  non-1/1 FEC ratio, test_pin_frequency_set_get() in…
- [Medium] test_pin_frequency_set_get() in
  tools/testing/selftests/drivers/dpll/dpll_features.sh changes the…

--

selftests: dpll: add pin frequency test

This commit adds test_pin_frequency_set_get() to dpll_features.sh. The
test picks a supported frequency other than the current one for a spare
input pin, sets it, reads it back and restores the original value. On a
device the user provides, it takes the candidate closest to the current
frequency, and it defers the restore once writing back the current value
succeeds.

> diff --git a/tools/testing/selftests/drivers/dpll/dpll_features.sh b/tools/testing/selftests/drivers/dpll/dpll_features.sh
> index 34e6b28ee224c..acaf61b36624c 100755
> --- a/tools/testing/selftests/drivers/dpll/dpll_features.sh
> +++ b/tools/testing/selftests/drivers/dpll/dpll_features.sh

[ ... ]

> @@ -455,6 +456,132 @@ test_pin_state_transitions()
>  	log_test "DPLL pin state transitions"
>  }
>  
> +test_pin_frequency_set_get()
> +{
> +	local before target after reason json near=true
> +
> +	RET=0
> +

[ ... ]

> +	pin_tune_spare "DPLL pin frequency set/get" || return

[Severity: Medium]
Is pin_tune_spare() enough of a check before this test changes the
frequency?

pin_is_spare() checks the state, the operstate, whether the pin is shown
as a reference, the pin type and reference-sync pairs. It does not check
priority.

In automatic mode, a selectable pin that outranks the reference but is not
selected has a signal that does not qualify. The comment in the priority
test says such a pin "takes over from it once its signal qualifies". One
way the signal can fail to qualify is a configured nominal frequency that
does not match it.

On a device the user provides, near=true picks the supported frequency
closest to the configured one. Depending on the hardware, if that value
matches the real signal, could the device switch its reference to
PIN_TUNE_ID here:

	if ! dpll_pin_set_frequency "$PIN_TUNE_ID" "$target"; then

and then switch back once the restore disqualifies the pin again?

test_pin_state_transitions() calls pin_ranks_below_refs() before it
offers a pin. test_pin_priority_get_set() also limits the priorities it
tries. The script header says "the tests leave alone what could change
the input a device uses".

Should this test call pin_ranks_below_refs() as well? The test is
unchanged at the end of the series.

[ ... ]

> +	if ! jq -e --argjson cur "$before" \
> +		'any(.["frequency-supported"][]?;
> +		     .["frequency-min"] <= $cur and
> +		     .["frequency-max"] >= $cur)' <<< "$json" &> /dev/null; then
> +		dpll_log_test_skip_or_fail "DPLL pin frequency set/get" \
> +		    "current frequency is not a supported one"
> +		return
> +	fi
> +	# A driver without a frequency setter refuses the current value as
> +	# well, writing it changes nothing otherwise. The restore is
> +	# deferred once that went through.
> +	if ! dpll_pin_set_frequency "$PIN_TUNE_ID" "$before"; then
> +		reason=${DPLL_LAST_ERR%%$'\n'*}
> +		dpll_log_test_skip_or_fail "DPLL pin frequency set/get" \
> +		    "cannot write the frequency back${reason:+, $reason}"
> +		return
> +	fi
> +	TUNE_CHANGED=0
> +	defer tune_restore dpll_pin_set_frequency "$PIN_TUNE_ID" "$before"

[Severity: Medium]
Can these two checks still let the test change a zl3073x input that it
cannot restore? This would be an input whose frequency comes from an FEC
ratio other than 1/1.

The jq guard only checks that the current frequency is listed.
zl3073x_pin_props_get() always lists curr_freq first. It skips the
zl3073x_pin_check_freq() filter that the firmware node entries go
through:

drivers/dpll/zl3073x/prop.c:zl3073x_pin_props_get() {
    ...
	if (curr_freq) {
		struct dpll_pin_frequency freq = DPLL_PIN_FREQUENCY(curr_freq);

		ranges[j++] = freq;
	}
    ...
}

curr_freq comes from zl3073x_ref_freq_get(), which applies the M/N ratio
and truncates:

	return mul_u64_u32_div(ref->freq_base * ref->freq_mult,
			       ref->freq_ratio_m, ref->freq_ratio_n);

For example, 156.25 MHz * 66/64 is reported as 161132812.
zl3073x_ref_freq_factorize() cannot express that value with any base and a
u16 multiplier.

The write back of $before does not reach the driver either, because
dpll_pin_freq_set() returns early:

	if (freq == old_freq)
		return 0;

The test then sets the nearest firmware node frequency. That value
factorizes, so zl3073x_ref_freq_set() programs it and forces M/N to 1/1.

The restore of $before does reach the driver, and there
zl3073x_ref_freq_set() returns -EINVAL. However,
zl3073x_dpll_input_pin_frequency_set() ignores that error:

	zl3073x_ref_freq_set(&ref, frequency);

	/* Commit reference state */
	return zl3073x_ref_state_set(zldev, ref_id, &ref);

zl3073x_ref_state_set() sees that nothing changed and returns 0. The
restore looks like it succeeded, so this branch sets TUNE_CHANGED back to
0:

	else
		TUNE_CHANGED=0
	fi

The deferred tune_restore then does nothing. It would also be a no-op if
it did run.

The test does report "frequency not restored". Would the user's reference
still be left at a different nominal frequency, with its ratio
programming lost?

The zl3073x behaviour predates this series and the series does not
change it. This test is the first code that relies on a listed frequency
being one that can be programmed back. The test is unchanged at the end
of the series.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125090522.3777494-1-poros%40redhat.com
Technical Details
Message-ID: <179594873454.3146.12287405671462016881@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373455-linux-kernel-netdev=dewy.ru
References: <20261125090522.3777494-11-poros@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373455-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 10/14] selftests: dpll: add pin frequency test
Date: Sun, 29 Nov 2026 10:38:54 +0000
Organization: Usenet Network
Message-ID: <179594873454.3146.12287405671462016881@kernel.org>
References: <20261125090522.3777494-11-poros@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1150641"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:C6Vk5GLyBXB/D1F5TybXWQUIR88= sha256:LD61ePwsphXwCjHoH3+1JcbJwh2T9lj/SMMNGTfV/GE=
	sha1:9yymcR8aRWxx0YyDIMoZgVSBuTM= sha256:VsiEy7EJqTdOYUczIB0viIxy+Vumu0G7urputJcHa7A=
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 AD4E0125F96; Sun, 29 Nov 2026 13:39:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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, URIBL_BLOCKED=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 LNkMAZt2xpIH;
	Sun, 29 Nov 2026 13:39:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373455-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 06B8C125F94; Sun, 29 Nov 2026 13:39:22 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 0B2A223F4C; Sun, 29 Nov 2026 10:39:08 +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=1795948747;
	b=XAujbQF+MYaSPa3xbKopj2v2fgj6kLAoBVOMwySB5ej8YtglCBN/pLp9D44JqA/oF1/Z
	 l9HCJDMfqcqNOk7W+vT8D++b0yp7Imj3jzl9IDKiLKwnQdP4mYPBfa5qziumvoUYkgY5L
	 TJuX9X7ZCOxifMh2SrdjNqHmBYgA/QraDH3S49C6bBe2kF0oYSGPAjyZHpCEJ/MIPlbV0
	 17kGjCLeUMhLWWqQ+TDGjtUWbjA35XQtwNQH9jPBhDmOwvIby86Q3BZSMV4sL/FVKDkiQ
	 st30s97SM8FsVcBVJoFkFUZ1/iWFiVlFRKO8WwSxU1Kv7Bl/78g5/+QnpcqBBHNR6RQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948747;
	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=gFOHqxjOh4tG1NuzaPblFJg2GJ5SRlEqVcwq801UcXg=;
	b=QM6nWp0F41wmsc/Ewi1So0JpKzx5jL45dua+M+RPqfLdPa5iVJAydT1HXmtXJ8nt5H9u
	 Sfdqba4IRfqUvff9n2HhpNlz1NpQYmtmirU6UOSBQBWnd10tqXBM48x9oZgYQ8le0hKR7
	 KQpjbMVZ9O2+byzLPjydpG7LS3jS7fcf2ppyj/Uj6PsjW7RE7ZVug4I8HYm6yqpFJb5HG
	 wMMtb1OMd0BesMPSBZ0ST5IoQfYQT2897PhFscoSyLFdpub73LbiyduPcsK6WsMUVFEx/
	 i67NAn8zVKUjZocZUCAyrW6jiBPHOo6Nas/6LUk9YSeRasvtOGozrB613lcwxEzE7rA==
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=NhC3X4gX;
	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 2FCB3606A32E;
	Sun, 29 Nov 2026 10:39:07 +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=NhC3X4gX
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=1795948736;
	b=jheuAYAYY7EDd8k+QKsK7lz6ab5aRhaIygqf4HL8TSz08H/fF2v/69h0RwhGcQtPtxOP
	 5s8NXQffJbETgvi01/j7tkKk4h6xaoKG/Ps9l2aAZEj3dkWcOcgbQ6rv0MuROTBaCLDVU
	 9evfGl4db/x6qi8dxbARcjGEor0Ktjd73W3Kgpv2esieIIiysn2DhTOhPnQwNPk4iaGRd
	 d9YJs4xdjMlL2p7WsOwviDWLWalUBkANmrRnYLuUHm1828o6/l/h/RHLglJGZxBR9OeRb
	 Wx9Bpn3BRAe8o/3EQVd75+3G987iWqnrht4QRBA/LCK21lkfmoS8fNtM798RMlB8QtA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948736;
	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=gFOHqxjOh4tG1NuzaPblFJg2GJ5SRlEqVcwq801UcXg=;
	b=nV1DhlEGkWladxJISknwZKVWEGgDa7ZtN0XgORl+lOmqSSYtdiBrmehNwkXa2nAEFouj
	 VigOTbpSj46vDmT14O06MN7V85NG4XaXzNDMItADsD8idxmbTlrcvSVfgtbaQBg6IUUJy
	 rF4CuCs/VAjEuiQr03gUnReu63B4RjFFfLQybfVWy6/DPTgMiGJLIPBJTlEydRLqe7Pvy
	 ztWFdUsxr6A1aNsSAmL+5Ilf94wc2HPiwci5VXJ6Imt09fUqQFpXYGxS94wcyzdkMura2
	 GAXWaDvdEYUgO3o5csJp1w30GKyAiruEd3XR2MKYsmIyzaji4fmMRzN1xuKHGyRFAoA==
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=NhC3X4gX;
	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 4B95C606A323;
	Sun, 29 Nov 2026 10:38:56 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08C5B1F008A0;
	Sun, 29 Nov 2026 10:38:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795948736;
	bh=gFOHqxjOh4tG1NuzaPblFJg2GJ5SRlEqVcwq801UcXg=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=NhC3X4gXo8XaTTsabBurj97irE3TJ3BUrbbVE7Bmf9Ull+vGyYjnwq0QORr2Aeoa+
	 yVa1DXnGopLT9lAm11oBz4GdlE75fV2l6Z/PrWsZbVGWFbJzDdpIPeb63ys4ZpfwVd
	 403rnmNrwrIgnTh3P32oB8Y50aOkUO2s+74tQZMHPn12mWKlYJ5JmYUBOCBcZG6I8i
	 bQF+pZQXi5CEPnjs4ccWR3aeM4V0qLRB56DPBQsVdApS15v89IU6bcHi64103UaCNG
	 gLzBiehGziU7XnUTELAcZU5tOBa5KRVZkQcZaEQjtZM0x9/TMvzO+v5q2dS9Wj6zuR
	 Jn2+Dn91xL5iw==
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-11-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