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 12/14] selftests: dpll: add pin phase adjust test
Date: Sun, 29 Nov 2026 10:38:56 +0000 [thread overview]
Message-ID: <179594873656.3146.399595190325088649@kernel.org> (raw)
In-Reply-To: <20261125090522.3777494-13-poros@redhat.com>
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
next prev 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
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 [this message]
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=179594873656.3146.399595190325088649@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