From: netdev-bot+sashiko@kernel.org
To: maimon.sagi@gmail.com
Cc: richardcochran@gmail.com, vadim.fedorenko@linux.dev,
kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
jiri@resnulli.us, arkadiusz.kubalewski@intel.com, corbet@lwn.net,
rdunlap@infradead.org, skhan@linuxfoundation.org,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 6/9] ptp: ocp: report fw.cpld with an empty value until the USERCODE is read
Date: Thu, 24 Sep 2026 14:29:30 +0000 [thread overview]
Message-ID: <179026017024.2160803.16394646149517774385@kernel.org> (raw)
In-Reply-To: <20260922142829.57740-7-maimon.sagi@gmail.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] After any CPLD flash that reaches the erase step, the fw.cpld
running version is never published again (and, at this commit, cpld.id…
--
ptp: ocp: report fw.cpld with an empty value until the USERCODE is read
Instead of publishing the literal string "unknown" for the fw.cpld running
version before the CPLD USERCODE has been read, the driver now passes an
empty value so the component name is still registered with devlink while no
version attribute is emitted.
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index e10f6b5149c93..4ce86df6e1968 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -2264,15 +2264,20 @@ ptp_ocp_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
> /* The flashable component. Naming it here is what lets
> * "devlink dev flash ... component fw.cpld" through, as the
> * core matches the name against the versions reported here,
> - * so it is reported for every board that has the part and not
> + * so it is named for every board that has the part and not
> * only once its USERCODE has been read: a part left holding a
> * bad image answers neither, and gating the component on the
> * read would make that state unrecoverable.
> + *
> + * An empty value still registers the name with the core -
> + * devlink_info_version_put() runs its version_cb before the
> + * empty-value early-out - while emitting no version attribute,
> + * so nothing is published until the USERCODE has been read.
> */
> if (smp_load_acquire(&bp->cpld_usercode_ok))
> sprintf(buf, "0x%08x", READ_ONCE(bp->cpld_usercode));
> else
> - strscpy(buf, "unknown", sizeof(buf));
> + buf[0] = '\0';
[Severity: Medium]
The comment says "nothing is published until the USERCODE has been read".
After a flash, can the USERCODE ever be read again?
adva_x1_cpld_flash() invalidates the cached identity before erasing:
WRITE_ONCE(bp->cpld_id, 0);
WRITE_ONCE(bp->cpld_usercode_ok, false);
WRITE_ONCE(bp->cpld_id_tried, false);
bp->cpld_id_attempts = 0;
but the only thing that re-reads it is ptp_ocp_cpld_work(), and that worker
re-arms itself only while the one-shot has not settled:
if (!READ_ONCE(bp->cpld_id_tried))
queue_delayed_work(system_power_efficient_wq, &bp->cpld_work,
HZ);
adva_x1_cpld_read_id() sets cpld_id_tried on success, so one second after
probe there is no pending cpld_work item left, and clearing the flag in the
flash path has nothing to wake. The only other queue site for bp->cpld_work
is ptp_ocp_probe(), and no exit path of adva_x1_cpld_flash() queues it.
With no further read, smp_store_release(&bp->cpld_usercode_ok, true) in
adva_x1_cpld_read_id() never runs again, so ptp_ocp_devlink_info_get() takes
the new else branch forever, and devlink_info_version_put() drops it:
net/devlink/dev.c:devlink_info_version_put() {
if (req->version_cb)
req->version_cb(version_name, version_type,
req->version_cb_priv);
if (!req->msg || !*version_value)
return 0;
...
}
Does this mean fw.cpld is silently missing from every subsequent
"devlink dev info" after a successful flash, recoverable only by unbind and
rebind? At this commit cpld.id is dropped the same way, since
adva_x1_cpld_flash() also clears bp->cpld_id.
For background: before the read was moved off the always-re-armed 1 Hz
ptp_ocp_sync_work(), clearing cpld_id_tried did cause a re-read on the next
tick; the commit that made the read a one-shot did not add a re-arm on the
flash path. Checking the end of the series (5b9611f), adva_x1_cpld_flash()
still clears cpld_usercode_ok and cpld_id_tried and cpld_work is still
queued only from probe and from the worker itself, so the missing fw.cpld
version persists there; the cpld.id half is addressed by the later commit
"ptp: ocp: drop only the USERCODE when flashing, and drop it before erasing",
which stops clearing cpld_id.
Would queueing bp->cpld_work from the flash path close this?
> err = devlink_info_version_running_put_ext(req, "fw.cpld", buf,
> ver_type);
> if (err)
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260922142829.57740-1-maimon.sagi%40gmail.com
next prev parent reply other threads:[~2026-09-24 14:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 14:28 [PATCH net-next 0/9] ptp: ocp: TAP CPLD follow-up fixes Sagi Maimon
2026-09-22 14:28 ` [PATCH net-next 1/9] ptp: ocp: move the CPLD identification read off the sync worker Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 2/9] ptp: ocp: do not cache EEPROM content after a failed TMC bus hand-back Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 3/9] ptp: ocp: hand the TMC bus back once on an acquire timeout Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 4/9] ptp: ocp: forget a CPLD i2c adapter number that no longer resolves Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 5/9] ptp: ocp: correct the CPLD bookkeeping comments and the flash progress Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 6/9] ptp: ocp: report fw.cpld with an empty value until the USERCODE is read Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko [this message]
2026-09-22 14:28 ` [PATCH net-next 7/9] ptp: ocp: drop only the USERCODE when flashing, and drop it before erasing Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 8/9] ptp: ocp: tolerate a latched FAILED when entering configuration mode Sagi Maimon
2026-09-24 14:29 ` netdev-bot+sashiko
2026-09-22 14:28 ` [PATCH net-next 9/9] ptp: ocp: confirm the CPLD really left configuration mode after REFRESH Sagi Maimon
2026-09-24 14:29 ` 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=179026017024.2160803.16394646149517774385@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@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maimon.sagi@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=richardcochran@gmail.com \
--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
all inboxes | Powered by JetHome®