🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24124

Re: [PATCH net-next v5 12/14] selftests: dpll: add pin phase adjust test

#24124
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
136 lines
13148 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] In test_pin_phase_adjust_set_get()
  (tools/testing/selftests/drivers/dpll/dpll_features.sh), the branch…
- [Low] In test_pin_phase_adjust_set_get()
  (tools/testing/selftests/drivers/dpll/dpll_features.sh), the comment…

--

selftests: dpll: add pin phase adjust test

This adds test_pin_phase_adjust_set_get() to dpll_features.sh. The test
reads the phase adjust range and granularity a pin advertises, picks a
different value, sets it, reads it back and restores the original value.
It also adds dpll_pin_get_phase_adjust() and dpll_pin_set_phase_adjust()
helpers to dpll_lib.sh.

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

[ ... ]

> @@ -456,6 +457,149 @@ test_pin_state_transitions()
>  	log_test "DPLL pin state transitions"
>  }
>  
> +test_pin_phase_adjust_set_get()
> +{

[ ... ]

> +	# Pick a target inside the advertised range different from the
> +	# current value and a multiple of the granularity.
> +	min=$(jq -r '.["phase-adjust-min"] // empty' <<< "$json")
> +	max=$(jq -r '.["phase-adjust-max"] // empty' <<< "$json")
> +	gran=$(jq -r '.["phase-adjust-gran"] // empty' <<< "$json")
> +	if [ -z "$min" ] || [ -z "$max" ]; then
> +		dpll_log_test_skip_or_fail "DPLL pin phase-adjust set/get" \
> +		    "no adjust range"
> +		return
> +	fi

[ ... ]

> +	if [ -n "$DPLL_CREATED_DEVICE" ]; then
> +		# The simulator is checked at the ends of its range. Shell
> +		# division truncates towards zero, so round the bounds towards
> +		# the inside of the range explicitly, which matters for
> +		# negative ones.
> +		[ -n "$gran" ] || gran=1

[Severity: Low]
On the created device, should a missing phase-adjust-gran go through
dpll_log_test_skip_or_fail(), as a missing phase-adjust, phase-adjust-min
or phase-adjust-max already does, instead of being replaced with 1?

dpllsim always advertises a granularity:

drivers/dpll/dpllsim/dpll.c:dpllsim_pin_props() {
    ...
	prop->phase_gran = DPLLSIM_PHASE_ADJUST_GRAN;
    ...
}

The core emits DPLL_A_PIN_PHASE_ADJUST_GRAN whenever phase_gran is
non-zero. On the created device, a missing value can therefore only come
from a regression in dpllsim, in the core or in the dpll tool's JSON
output. The comment above dpll_log_test_skip_or_fail() in dpll_lib.sh says
such a condition is a failure there:

# known, so a missing pin, attribute or capability on it can only mean a
# failed query or broken tooling. Report such a condition as a failure
# on the created device and as a skip on a device the user provided,

The commit message describes the fallback as intended ("Without it the
target on the created device is computed with a granularity of 1"). That
does not match the rule above.

DPLLSIM_PHASE_ADJUST_MAX is S32_MAX - S32_MAX % 100 = 2147483600, which is
already a multiple of 100. With gran=1 the target is the same value and
the core accepts it, so the test passes even when granularity reporting
is broken.

The test also never submits a value that is off the granularity, so the
core's granularity check is not exercised here.

> +		target=$((max / gran * gran))
> +		[ "$target" -gt "$max" ] && target=$((target - gran))
> +		if [ "$target" = "$before" ]; then
> +			target=$((min / gran * gran))
> +			[ "$target" -lt "$min" ] && target=$((target + gran))
> +		fi

[Severity: Low]
Can this min-end branch be reached on the created device? The comment
above says "The simulator is checked at the ends of its range" and that
the rounding "matters for negative ones". However, dpllsim_pin_reset()
zeroes the phase adjust when the device goes live:

drivers/dpll/dpllsim/dpll.c:dpllsim_pin_reset() {
    ...
	pin->phase_adjust = 0;
}

No earlier test in ALL_TESTS changes the phase adjust, so before is
always 0 on the freshly created device. The first target is
max / gran * gran = 2147483600. That never equals before, so the switch
to min never happens.

As a result, the min-end computation and its rounding for negative bounds
are dead code here. A negative phase adjust is never set or read back.

Would it make sense to exercise both ends, or to change the comment so it
matches what is actually tested?

> +	else
> +		# On hardware the end of the range can be a large phase step,
> +		# 2.1 ms on zl3073x, which the outputs see once the pin becomes
> +		# the reference. Step by the granularity, or by 1 ns when the
> +		# driver reports none, towards the inside of the range.
> +		step=${gran:-1000}
> +		target=$((before + step))
> +		[ "$target" -gt "$max" ] && target=$((before - step))
> +	fi

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125090522.3777494-1-poros%40redhat.com
Technical Details
Message-ID: <179594873656.3146.399595190325088649@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373456-linux-kernel-netdev=dewy.ru
References: <20261125090522.3777494-13-poros@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373456-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 12/14] selftests: dpll: add pin phase adjust test
Date: Sun, 29 Nov 2026 10:38:56 +0000
Organization: Usenet Network
Message-ID: <179594873656.3146.399595190325088649@kernel.org>
References: <20261125090522.3777494-13-poros@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1150530"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BfIBfcqlTzrq+KbDNSEsS2XB8S8= sha256:Sm2lLlojtIE1lWHQpHnz+HbDA5TCW3YHUYq+Qw7/VFw=
	sha1:z7xVyKn9/kdrLTiMM73VYSYSKAg= sha256:3XgV/nMYHx9WPh1Cdg8kt9uGFguqOzN7nt/GTloiuR0=
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 74811125F97; Sun, 29 Nov 2026 13:39:24 +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 pNH0QZ5iuGe1;
	Sun, 29 Nov 2026 13:39:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373456-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 BA935125F94; Sun, 29 Nov 2026 13:39:12 +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 7F61A25B3A; Sun, 29 Nov 2026 10:38:59 +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=1795948739;
	b=lcgn/0UToWhUof7mXp0mKcPh8UyeeEvk+y60XbTZ6GI91pAWE8VrZ6M24sqj4Xo/7Buo
	 zQd/QkdcpflZnUBlCqFx4S0SUidZx0a+ttmTXb4yvIpm95DhrmOS08vmGVZYTOrKMmZn5
	 W2R9jsCRInNaSnY4veeXDxJ14upCt+Qda6FtIngPMmJyhVSOvuy2hDSE9nTKikLhQJu8L
	 3u/qvKF8bDWDR6aKKyHxCGzO9fBgj5lHqazWc5JhZcgwvaOa/VOyXB7UK666aSBKqNEd/
	 Vyhd8T0R08TCgfFtiW6bKjdE5nR+tX0vPOrVcQUId7zQFrlk5SaZWcbIO1o03XQNooQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948739;
	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=lcP03ov499QQmKXHvJXUyjVwp7YEkTe82RthMKzJJPQ=;
	b=S+SrUd4bNsIV+PJy/Naegyuw7YDa4AmRHZrMrXdY5oBARRHZnoMKkGC5EwP+TMxDM/Z9
	 y9MbI3K4Z7rXmhvWz9wpKgzncbCm3KC0LU9VStIuoOr1dwqUT2Op0vqNUEjUhcXgrk7jb
	 tPSAV+UBxedKaxgBbaI7WEkYap7CRdnSszXCcHTT8yTy0PbfYBN6Yhjr/7Ur43brj2Mv9
	 BoqHvB2IiNX0mdEYsJ+pmeKENaMLL1GVoGfHuoNAIKJiBPgQIrhNoK2B8870Ut9ZuWhle
	 htRLKByJgeNo0WDqsAt3bLhmdsYNOgvWan2YdXyxrBlVZS9A+ojTCjiluJpIXz3VSig==
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=IDDh6o8g;
	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 56D10606A336;
	Sun, 29 Nov 2026 10:38:59 +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=IDDh6o8g
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=1795948738;
	b=HADaKFJems4rv9Z5QfMh1c/Ec3YZPwKp8M7DOtt6wiz+PMvLPidjRUEU6V7Q2CwQe7dS
	 zMjkadyD8wB9t//pwz5vfQYqNrEi5FLkhOQikrlEljB6DRO6tH0r1t892y4sWhzy9RLJM
	 QbQViNURnjwgKLqKAO8FQ8xcAJaHoWfQ9lWXpwZVlwhiZgKNK4fYCDUIF9npsKVTPMT0L
	 4sZDPEjpOvM9J2cAxIDgTxxA56pqMi+1SREnapaPw111lxvkwuvy6HrxSNzA0D5c3hs0G
	 hdTg1K4n+sgrDeew2UQEy07qveMBJCbXRxnWArXWuenPa4FAcbHXidyMWmGW/KQA7XQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795948738;
	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=lcP03ov499QQmKXHvJXUyjVwp7YEkTe82RthMKzJJPQ=;
	b=EsvHDTbXGC4z7aMNZbbQMSyXNfTq6hKKVuUiCR7qjIyaln+cNhpSpA3xgSVzK5vvHdao
	 h6AvxIHvAyv22Tt4XOXUPzkQRzJHm5q95NvqKDqUsBFOAxrQfMqCjLctwOclde760Tyzr
	 zzMQ2+LSEP1B4+Gd01lheUoHyyVe+YXWvOxj5jSYUgFk5wtTqOaylv6nKq9m095Nf3WVN
	 +SsxJSsG6NEvss+aOm6PojlUsH01T0/iHlM/ptmX5hyqppLl3o8LboGRu55Qsoi2c0xZ7
	 r2x0agWPtj39jo0lNePUnNci35Siw0iXPxnqcomkUXWEyz6Ufufq79G4m4zZ/MBLM3w==
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=IDDh6o8g;
	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 70D70606A327;
	Sun, 29 Nov 2026 10:38:58 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0EBB1F000C1;
	Sun, 29 Nov 2026 10:38:56 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795948737;
	bh=lcP03ov499QQmKXHvJXUyjVwp7YEkTe82RthMKzJJPQ=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=IDDh6o8g/KlmlzP46ZDVnkhUMjUj3HVV7qVXmpLUWzcgqCh8zIopJYmyCTrJ6XkAc
	 Hd/gMgtLtsCJcVvQfHrRA3iwHhGT8duumTLC9qaNflD7UclpgD20UbiMdlLgzSfD0F
	 uKoOQ7p3jbgUnj/bMYkn9dv1TniLeN75WVEd6tPjdIhP802D6pvrc8ZawC0dlXEeaA
	 bmJWoP7o/lxBbbRLc5P6Vard08u5wmIEu3FJu5+3W1FdEmGOuyfqPGIO04VCQB0Ybk
	 NN5W+ul8l6DOOne9+Utw/pcATaq8KQds8CVNhvoDV0kfNnEIHQpJY3XIb9pwoGWjvL
	 8y/heGHan/yAQ==
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-13-poros@redhat.com>
X-sashiko-severity: Low
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