From: netdev-bot+sashiko@kernel.org
To: poros@redhat.com
Cc: netdev@vger.kernel.org, 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, ivecera@redhat.com, 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 v6 10/14] selftests: dpll: add pin frequency test
Date: Thu, 03 Dec 2026 15:36:10 +0000 [thread overview]
Message-ID: <179631217029.3146.839603646090989679@kernel.org> (raw)
In-Reply-To: <20261202153223.2725780-11-poros@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · 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] test_pin_frequency_set_get() in
tools/testing/selftests/drivers/dpll/dpll_features.sh can leave an…
--
selftests: dpll: add pin frequency test
This adds test_pin_frequency_set_get() to the dpll selftests. It picks a
supported frequency other than the current one for a spare input pin, sets
it, reads it back and restores the original value. A deferred restore
covers interrupted runs.
> diff --git a/tools/testing/selftests/drivers/dpll/dpll_features.sh b/tools/testing/selftests/drivers/dpll/dpll_features.sh
> index e50b60608f1e9..dd5320a1e9498 100755
> --- a/tools/testing/selftests/drivers/dpll/dpll_features.sh
> +++ b/tools/testing/selftests/drivers/dpll/dpll_features.sh
[ ... ]
> + # The core refuses a frequency outside the supported ranges, the
> + # current one included, and a driver may report one it does not
> + # offer, zl3073x reads a sub-Hz reference back as 0 Hz. Such a pin
> + # could not be restored, so bail out before it is touched.
> + 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"
[ ... ]
> + # A refused restore is taken like in the state test, the deferred
> + # one tries again. A driver may swallow the refusal of a value it
> + # cannot program, zl3073x lists the current frequency of a
> + # reference whether or not it can factorize it back into a base
> + # and a multiplier, so the restore of one it cannot reports
> + # success and leaves the pin at the target, which the readback
> + # reports and the interface cannot undo.
> + if ! dpll_pin_set_frequency "$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 frequency set/get" \
> + "cannot restore frequency$reason"
> + return
> + fi
> + check_err 1 "cannot restore frequency$reason"
> + else
> + TUNE_CHANGED=0
> + fi
[Severity: Medium]
Can this leave a zl3073x input reference on a user-provided device stuck
at the target frequency?
The comment above describes this case, but neither of the two guards that
run before the first set catches it.
The jq check always passes on zl3073x. zl3073x_pin_props_get() lists
curr_freq without the zl3073x_pin_check_freq() factorizability check 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 is base * mult * M / N. With a fractional FEC ratio, for example
156.25 MHz * 66 / 64 = 161132812, zl3073x_ref_freq_factorize() returns
-EINVAL for it.
The write-back of $before never reaches the driver either. The core
returns early when the value has not changed:
drivers/dpll/dpll_netlink.c:dpll_pin_freq_set() {
...
if (freq == old_freq)
return 0;
...
}
So that probe only catches a missing setter or a value outside the
advertised ranges.
The set to the target then succeeds, because the firmware-node values
factorize. On the restore, zl3073x_dpll_input_pin_frequency_set() drops
the error from zl3073x_ref_freq_set() and commits the ref unchanged:
drivers/dpll/zl3073x/dpll.c:zl3073x_dpll_input_pin_frequency_set() {
...
/* Update frequency */
zl3073x_ref_freq_set(&ref, frequency);
/* Commit reference state */
return zl3073x_ref_state_set(zldev, ref_id, &ref);
}
That call returns 0, so the else branch here sets TUNE_CHANGED=0 and the
deferred tune_restore does nothing. A retry would fail the same way. The
readback only logs "frequency not restored", and the standby reference
stays at a nominal frequency that no longer matches its signal.
The commit message says:
the restore is deferred before the pin is changed so that an
interrupted run restores it too.
and:
A refused restore is taken as in the state test, the deferred
one tries again.
Neither of these holds in this case.
The driver was already dropping this return value before this patch, but
this test is what now exercises it on user hardware.
Could zl3073x_dpll_input_pin_frequency_set() return the error as part of
this series, along these lines:
rc = zl3073x_ref_freq_set(&ref, frequency);
if (rc)
return rc;
Or could the test skip the destructive set on such a device? No later
patch in the series touches drivers/dpll/zl3073x/ or dpll_netlink.c, and
the comment above is still in dpll_features.sh at the end of the series.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202153223.2725780-1-poros%40redhat.com
next prev parent reply other threads:[~2026-12-03 15:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 15:32 [PATCH net-next v6 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 01/14] dpll: dpllsim: Add " Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 06/14] selftests: dpll: add pin state tests Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 08/14] selftests: dpll: add pin priority test Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko
2026-12-02 15:32 ` [PATCH net-next v6 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 10/14] selftests: dpll: add pin frequency test Petr Oros
2026-12-03 15:36 ` netdev-bot+sashiko [this message]
2026-12-02 15:32 ` [PATCH net-next v6 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-12-02 15:32 ` [PATCH net-next v6 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-12-03 15:36 ` 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=179631217029.3146.839603646090989679@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@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