Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Sun, 29 Nov 2026 10:38
Re: [PATCH net-next v5 12/14] selftests: dpll: add pin phase adjust test
Author: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
Date: Sun, 29 Nov 2026 10:38
136 lines
13148 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads