Article View: linux.kernel.netdev
Article #23677Re: [PATCH net v6 2/2] ptp: disable unassigned timestamp channels on unregister
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 17:09
Date: Fri, 27 Nov 2026 17:09
186 lines
15195 bytes
15195 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
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] ptp_disable_all_events() in drivers/ptp/ptp_chardev.c now
sends PTP_CLK_REQ_EXTTS with on=0 to every channel below n_ext_ts,…
- [Low] The changelog says a coding assistant helped 'develop the core
fix and regression tests' and that 'The regression harness exercises…
- [Low] The commit author is 'ahmadexp <ahmadexp@gmail.com>' but the
Signed-off-by is 'Ahmad Byagowi <ahmadexp@gmail.com>'.
- [Low] ptp: ptp_disable_all_events() triggers spurious dev_err() on
idt82p33 removal
--
ptp: disable unassigned timestamp channels on unregister
This commit changes ptp_disable_all_events() so it sends a
PTP_CLK_REQ_EXTTS disable request to every channel below n_ext_ts. Before,
the request went only to pins whose function was PTP_PF_EXTTS. The goal is
to shut down EXTTS channels that were enabled through PTP_EXTTS_REQUEST
without a pin assignment once the clock is unregistered.
Link: https://lore.kernel.org/r/179548551283.3135.17206659598806657887@kernel.org
> A coding assistant helped identify the unassigned-channel teardown gap, develop the core fix and regression tests, and prepare this changelog. The regression harness exercises the actual cleanup path with controlled clock callbacks; no physical card was tested.
[Severity: Low]
The changelog mentions regression tests and a regression harness. The patch
only touches drivers/ptp/ptp_chardev.c and contains no selftest, KUnit test
or harness code.
No physical card was tested either, so the only validation described here
can't be inspected or run.
Could the harness be submitted too, for example as a ptp_mock or netdevsim
based selftest? If not, could the wording be changed so it doesn't suggest
the tests are part of this change?
> Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
[Severity: Low]
This isn't a bug, but the Author line is "ahmadexp <ahmadexp@gmail.com>"
and the Signed-off-by uses "Ahmad Byagowi <ahmadexp@gmail.com>". checkpatch
reports this as a From:/Signed-off-by: name mismatch.
Could the author identity be updated to match the name used in the
sign-off?
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index f63b45f5ee6ae..5835c01cddb49 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -53,11 +53,15 @@ void ptp_disable_all_events(struct ptp_clock *ptp)
> unsigned int i;
>
> mutex_lock(&ptp->pincfg_mux);
> - /* Disable any pins that may raise EXTTS events */
> - for (i = 0; i < info->n_pins; i++)
> - if (info->pin_config[i].func == PTP_PF_EXTTS)
> - ptp_disable_pinfunc(info, info->pin_config[i].func,
> - info->pin_config[i].chan);
> + /* EXTTS requests do not require a pin assignment. */
> + for (i = 0; i < info->n_ext_ts; i++) {
> + struct ptp_clock_request req = {
> + .type = PTP_CLK_REQ_EXTTS,
> + .extts.index = i,
> + };
> +
> + info->enable(info, &req, 0);
> + }
[Severity: Low]
Does this make every idt82p33 removal print error messages, even when
EXTTS was never used?
idt82p33_caps_init() sets caps->n_ext_ts to MAX_PHC_PLL (2) and leaves
all pins at PTP_PF_NONE. Before this patch, ptp_disable_all_events()
never called idt82p33_enable() for such a clock, because no pin had
func == PTP_PF_EXTTS.
On teardown the driver does:
idt82p33_ptp_clock_unregister_all()
idt82p33->stopping = true
idt82p33->extts_mask = 0
cancel_delayed_work_sync(&idt82p33->extts_work)
ptp_clock_unregister(channel->ptp_clock) (for each channel)
ptp_disable_all_events()
info->enable(EXTTS index i, on=0)
idt82p33_enable()
idt82p33_enable() sees idt82p33->stopping, sets err = -ENODEV and jumps
to out, where it logs:
Failed in idt82p33_enable with err -19!
With two PHC channels and two EXTTS indexes each, that is up to four
dev_err() lines on every unbind, module removal or probe error unwind.
Nothing is actually leaked here, since the driver already clears
extts_mask and cancels extts_work before unregistering, and the core
ignores the return value of info->enable(). But it's a new user-visible
regression that makes a clean removal look like a failure.
The commit message says no clock driver is modified, but this is
another case where calling the EXTTS callback for channels that were
never enabled changes driver behaviour. Would tracking the channels
enabled through PTP_EXTTS_REQUEST in the core, and only disabling those,
avoid this too? Otherwise idt82p33 would need to treat a disable
request while stopping as a no-op.
[Severity: Medium]
Can this reprogram hardware on drivers whose EXTTS callback does work even
when on == 0?
Before this patch, the off request was only sent when pin_config[i].func
was PTP_PF_EXTTS. Now every channel below n_ext_ts gets it, whatever
function its pin has at the time.
The sja1105 driver re-muxes its only PTP_CLK pin before it checks on:
drivers/net/dsa/sja1105/sja1105_ptp.c:sja1105_extts_enable() {
...
rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS);
if (rc)
return rc;
priv->ptp_data.extts_enabled = on;
...
}
drivers/net/dsa/sja1105/sja1105_ptp.c:sja1105_change_ptp_clk_pin_func() {
...
avb->cas_master = (func == PTP_PF_PEROUT);
return sja1105_dynamic_config_write(priv, BLK_IDX_AVB_PARAMS, 0, avb,
true);
}
Suppose pin 0 (ptp_clk) is set to PTP_PF_PEROUT and PTP_PEROUT_REQUEST is
issued. Then sja1105_per_out_enable() sets avb->cas_master = true. On
unbind, the path is:
sja1105_teardown()
sja1105_ptp_clock_unregister()
ptp_clock_unregister()
ptp_disable_all_events()
info->enable(EXTTS index 0, on=0)
sja1105_ptp_enable()
sja1105_extts_enable()
sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS)
This clears cas_master and writes AVB_PARAMS over SPI. That switches the
PTP_CLK pin from output to input while the periodic output is still
programmed: startptpcp was set and stopptpcp was never issued.
pin_config[0].func still reads PTP_PF_PEROUT, so the driver's bookkeeping
no longer matches the hardware. In a cascaded setup, the switch silently
stops driving PTP_CLK.
On SJA1105E/T, the dynamic write fails with -ERANGE because the sja1105et
dyn_ops has no AVB_PARAMS entry. Only the in-memory static config is
changed.
This also conflicts with the changelog. It says pin assignments are kept
unchanged and suggests no clock driver is affected.
The new loop assumes that disabling EXTTS on a channel that was never
enabled leaves the hardware alone. The driver API doesn't promise that.
Would it be safer for the core to track which channels were enabled
through PTP_EXTTS_REQUEST, and send the off request only to those?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-timecard-core-v6-0-ahmadexp%40gmail.com
Technical Details
Message-ID:
<179579937848.3135.14198689317939903929@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372879-linux-kernel-netdev=dewy.ruReferences:
<20261126-timecard-core-v6-2-ahmadexp@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372879-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v6 2/2] ptp: disable unassigned timestamp channels on unregister Date: Fri, 27 Nov 2026 17:09:38 +0000 Organization: Usenet Network Message-ID: <179579937848.3135.14198689317939903929@kernel.org> References: <20261126-timecard-core-v6-2-ahmadexp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="779904"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:M3bEFGc6/XEWyr2pHzoDpIjc3Hw= sha256:+pE6Nx2gkfrSr3tpLk225J0YqvVQ1pTk6PcWYQzR9bo= sha1:nts6pTOXuipkPxDMFrW3xypUBW8= sha256:SKZuRuppn5lLfbGLoQ+3hqCAzOtY9W/wFWd31D/pims= 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 E5B51125F60; Fri, 27 Nov 2026 20:09:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 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] 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 n6i-ji5R6g1y; Fri, 27 Nov 2026 20:09:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372879-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 7150F125F62; Fri, 27 Nov 2026 20:09:44 +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 DB57024E9C; Fri, 27 Nov 2026 17:09:40 +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=1795799380; b=uNHDfq/rSSLa+wSm2wJTuoE+OraldbJhed1NNCUBQVhlZOY0XCJPU5cDb2HXkFwRiifM pT48npCNdg1LmcIP7nxTC5JMgMSZaiuttce2/I8vLe8ihgQihZrrF4dYSJMyUEIQjVH1A Lsa6DrDo8iUPQIRbttfHwRra8e0xAtj7kqAehXWfHudW4O2lYm4U3A/0xfNQR7QwlHUsF hVxPDqaXzNOLisp5DIdfaGUQBS290Wl8QNbXsc1r/rtT6AAB31Yvr44P8nDXDGTmZcW6Z 6TeotU5nWUBwRqjnX1WEbIBJmM+Guacr9roOSAebubwW3whGlGy1P+5t/XNzD6yAm3g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795799380; 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=mPrvCeTG1UkibyQxzQG6FzyncQlcTDruhe1450GNYSE=; b=Njgs5/OshwiGdqvzMYU+0zwWYu53PHLz2iTUthRQXrMjmIx87cHU1MkDnWtqQE1uZqtp eD/fGQbRDkR7wMd0V09YWO2h5I5EuEbNCi2VUBZhAn214nJzzfb1dSKs2d0qLfPmaaHW9 tzA5WHtVR+On3M6t9unsq6GO9CNRvF6C/jFzniP8va3zIxxEM7NfcDr/YfdFh4JwONQ86 QdDYT78FKeipXd9hl1EqVrgai0e5fwen+gKoKqCjWweOybwgS/9GplW4WipdJr/HvTFbs tl0SAvdqnvFkghRpgxzKzTkZqPr86jcu8bwAdn6nEeim/m4GJi+5BEbwFjM0cew+OnA== 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=EqtHR+Q8; 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 B34D5606A329; Fri, 27 Nov 2026 17:09:40 +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=EqtHR+Q8 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=1795799379; b=fKUjT6wi24dfPpHZo1fFsmq/Oo99kOCFUoWOcVZ0N6XXUMf+L/mOXkOSzXp8pe7AFEE6 eNkSsuYQY8ek/hOMFb+2hF/aTXc+ulMrvJGqDXs3YZ1NJo0PKbISI/mCDmw/gGxv+TtP5 88mVPR3pUUvjE0mZtEjGiT6H+NLkP9I0lqCxSJqqIkZw+ZsnyjLXbd2HXg60jvM5+/Bwh z2s7he5AiWN7KbE/p09OKkeKYU/RRyH7eV9KGK+bvE6cYmrvZ9OujFlqzs/Wa94CFMcz9 GfhpfYJeXzvIfMZifr35KkT6UMUbJhOAsFP+irGT7mSnqkx/sPkU5KEcB8CDAecR0ag== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795799379; 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=mPrvCeTG1UkibyQxzQG6FzyncQlcTDruhe1450GNYSE=; b=q3pxG/ESg27kdRmzsIBRTmljidg+iENK7iiDFiy5lFCtEgOrRJV024gg1Gs5o3MthJw8 fDB7F1tu2v4vua7Xn8xaBop1ccWWWqlr/D3Ph3oZteXc+RnhI1WzlvF71WolxdP6jmC65 mnIYEwfLXqDxUtWrRtEumkq6g1GGnRcNIAXTWqls12Dq7GxYVFQwzxFaHGXVwApssgCOX MBfCY9Li3C2MRTb+Ya2nKgOg0hybdmciea+FRxCu38Euo060fVZe8Ckkqn/Rohk+ZqdYz FIKVAYgQgHbI3p2oKakWAKT2rKnYXo9XiluFnYxZfefPSIS+vKYSnh8c4lN90aAoPZA== 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=EqtHR+Q8; 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 D2195606A31F for <netdev@vger.kernel.org>; Fri, 27 Nov 2026 17:09:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1511F00898; Fri, 27 Nov 2026 17:09:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795799379; bh=mPrvCeTG1UkibyQxzQG6FzyncQlcTDruhe1450GNYSE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=EqtHR+Q8CeGuYGES899CoZLCH/Q3nx4TPGwuOvTOdHH+uoSR9BqCbuP2210N59GCy h7DvV3WWMEyLtubLEdN4rhdDa7zUyDIh+3M2m7iD7F8aqpRGvwy3lnNTIQ/O8DTKHH +tZTqI80mqDWS6XQk5ZnwzE5aZbSSsLzi36ADGMs+gHYgPuEq0+37141qmVaT5t05k zCtBrdAoKt+jyolNeSq6vXJDRfjBxrh9LaoWGd6xB7/XgCAiSweW2DWnNIkh34lq6z /i09QY1dGfKrRAyUO3IV1bQxa6pwFguPzMCncUWG4Vm3+DKhCM7KvoNSjScKtY7vX6 yYRjBQeCZHOmw== X-Cc: netdev@vger.kernel.org, richardcochran@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, vladimir.oltean@nxp.com, vadim.fedorenko@linux.dev, andrew+netdev@lunn.ch, arnd@arndb.de, john.stultz@linaro.org, rmk+kernel@armlinux.org.uk X-In-Reply-To: <20261126-timecard-core-v6-2-ahmadexp@gmail.com> X-sashiko-severity: Medium 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