Article View: linux.kernel.netdev
Article #13143Re: [PATCH net v8 10/10] can: rockchip_canfd: serialize timecounter timestamp conversion
From: netdev-bot+sashiko
Date: Mon, 09 Nov 2026 11:37
Date: Mon, 09 Nov 2026 11:37
73 lines
11023 bytes
11023 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] The fix only works because the preceding series patch "can:
rockchip_canfd: prevent timestamp work from rearming after bus-off"โฆ
--
can: rockchip_canfd: serialize timecounter timestamp conversion
The commit takes timestamp_lock around timecounter_cyc2time() in
rkcanfd_skb_set_timestamp(), so a conversion can no longer run while the
timestamp worker is inside timecounter_read(). It also updates the
comment on timestamp_lock in struct rkcanfd_priv to say that the lock
covers tc.
> Hold timestamp_lock across timecounter_cyc2time(), using the same lock
> as timecounter_read() and timecounter_init(). Keep the SKB timestamp
> assignment outside the critical section.
>
> TX completion nests timestamp_lock inside tx_lock; no timestamp-lock
> holder acquires tx_lock.
>
> Fixes: 4e1a18bab124 ("can: rockchip_canfd: add hardware timestamping support")
> Cc: stable@vger.kernel.org
[Severity: Low]
Should this commit message state its backport prerequisites?
At 4e1a18bab124, struct rkcanfd_priv has no timestamp_lock and no
timestamp_active field. Also, rkcanfd_timestamp_work() calls
timecounter_read(&priv->tc) with no lock held before it calls
schedule_delayed_work().
The statement "using the same lock as timecounter_read() and
timecounter_init()" is only true once the preceding patch in this
series is applied:
806691a20048 ("can: rockchip_canfd: prevent timestamp work from
rearming after bus-off")
That patch adds the lock and the active flag. It also adds the locking
in rkcanfd_timestamp_work() and rkcanfd_timestamp_start():
drivers/net/can/rockchip/rockchip_canfd-timestamp.c:rkcanfd_timestamp_work() {
...
spin_lock_irqsave(&priv->timestamp_lock, flags);
if (priv->timestamp_active) {
timecounter_read(&priv->tc);
...
}
The paragraph about lock nesting also depends on tx_lock. That lock comes
from the earlier patches "can: rockchip_canfd: serialize TX state and
command writes" and "can: rockchip_canfd: serialize TX with bus-off and
restart".
A plain cherry-pick onto a tree without 806691a20048 would fail to build,
and that patch carries the same Fixes: tag and Cc: stable. But suppose
someone adapts this patch by hand and only adds a lock in
rkcanfd_skb_set_timestamp(). The timecounter_read() in the worker would
still run unlocked, so the race would stay open.
Other patches in this series include a note such as "Backports must
include the preceding TX serialization fix...". Could a similar note be
added here, naming 806691a20048 and the tx_lock patches as prerequisites?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261108-rockchip-canfd-restart-close-v8-0-3e7a23fd9eae%40qq.com
Technical Details
Message-ID:
<179422427265.994134.1596521443425790522@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359244-linux-kernel-netdev=dewy.ruReferences:
<20261108-rockchip-canfd-restart-close-v8-10-3e7a23fd9eae@qq.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359244-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v8 10/10] can: rockchip_canfd: serialize timecounter timestamp conversion Date: Mon, 09 Nov 2026 11:37:52 +0000 Organization: Usenet Network Message-ID: <179422427265.994134.1596521443425790522@kernel.org> References: <20261108-rockchip-canfd-restart-close-v8-10-3e7a23fd9eae@qq.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="341455"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:gR8BvmOJAp5IqnbFJtYoVTzS0J0= sha256:eOijnDvocPThvro0pj668EjVOpoeQp5ri+S64VWKlZ8= sha1:MMFcZ38NniT+/vCG9lC9FPO2Ci0= sha256:NGfzIrvB7fDuX2d1QzsHlFJDey/b7udNaZxkgrGoVuY= 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 ED35C1137B2; Mon, 9 Nov 2026 14:40:34 +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 fY3SD_N9xLKm; Mon, 9 Nov 2026 14:40:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-359244-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 146AD11375F; Mon, 9 Nov 2026 14:40:22 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id E2484861DE; Mon, 9 Nov 2026 11:37:58 +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=1794224275; b=qp4epjItFwwPE4JqDkbEDOT4QZpdQuW/8KDAbyCtocgTxKXF1TZnQlqJnJvzT+1AOdF5 BWy5+JvO8ZINGxkf+SkiZfH/c6Z/EjOet9ro/Vt2SajAL60DeHyT/e9dwoGf40YsCs++x Z7gfWtNrbAsnSzi3DpzYQoh2dNTr4DtBuNu0x0Xr0Ns2OTCmhszHage5jDBiVnI4VCYLG wwyoOHDCnZrtwaUtqkrLoW5N0pWXfmpL6ouqsOS4hVAwREcpb0DYPQStUTzyXmaLqEr2u rmnc2rO7Zj9sH2VmqV03bOrRyU5BHjc3TrFTz/IriyZXGwGh+fbuaorif6/GhkiEJXQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794224275; 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=rd3+z6vq2TMUkUnwow78Fgj3dJ0i765N3091XiypQOI=; b=ZJaI7nDNKHWEAAgnKqDbYrgeL6nIQTaY1h8iVasW9Earg0tVqs4aprqAY+rZ5wj3L7xv 9GAHNlib8CBMiSX23EGGtUg/jdVNK1InBf4yfUwhi+mF+59/ONfuPbVHVeYKxAd/KOr1O PKAZ3+8T1DogHfoqGbV1Nwf0FTTn/vextear1fPAOgCeMhnblAIm4HF2/kqYBhVQh1Bjy 72zbbsveSAI9+C2p82xr9gkCwDFBIcX9b8i5pFBFVJ87DB5Hu+P4iHtkBdeaN4e1y/s3J xYzK9l/V3HJ7to7KwpYQz0Go4sYKcrBPBNOvxycxnaT+S61NrwsDnqCLgZC7meBWHEQ== 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=Er3jM619; 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 58EC4606D81B; Mon, 9 Nov 2026 11:37:55 +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=Er3jM619 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=1794224274; b=K8VOSY45cPM5b5picha0xdwydWPYPRC4akEMpFcOK5KImx+E7arlVczhEbpEdICKtqBX eE9Uu8vgg4eql8ovsfNNKIPdClfUv/LX7QU62ddsuck9popGr+f3BLzNU3TfDKgGI48RJ 6ej/Dt+rr5bVMsuSoErduEKZX9igHMA87GCjL0G/DT8AJSQ6zO4g9Dg1KFyb/+rSVkSgz D5U0iJMuMj9UTdAu+IuvDn1N6H5+YY9TA+PoATjqiu9L/kNptnjhdnGbJp66w4mG3I2Ek 8LbwyVjXPy7FHSphN2CokMMNM0Mdge1ER1hmzSeAbDf9IQmQ0ZNyRvQbL7K6m0O6J7Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794224274; 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=rd3+z6vq2TMUkUnwow78Fgj3dJ0i765N3091XiypQOI=; b=u56ibBYzpvU5wiyoQeKxMjV9ZWEQh9IHCwbAt+Q33eOuNZG7+uRBX9Xwhp/gcZTRnENu l+VhszLblH+ptkFkIk+dCutBwzHjvb0ObxyXiFMBAylesUan6RL9dEooO9N0Ku8liHy+x mWCevz+C1uk5pfxN/IhKiajaJqegOHdt0KothP/sPH4lUZlT2r2DPSY3QoczbnsXFCnsr ujVNkX4Sgp6/hmXFsGG0r6MQtNKHNOywC+vPXNbv/1i0urDp1chkyiesoZaNYIWCJdlvP Ay+sNYefOGw7YTB2EekuZLWdjoFsUT/akIMGM+00BuxAfmrQF/idPyU/K08wT9sRvBQ== 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=Er3jM619; 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 40ADD606D80A; Mon, 9 Nov 2026 11:37:54 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1163F1F008A1; Mon, 9 Nov 2026 11:37:53 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794224274; bh=rd3+z6vq2TMUkUnwow78Fgj3dJ0i765N3091XiypQOI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Er3jM619QoitPT+MyCqskB0zPJIXAu03U7PIFLgXR4BLHZFlgq3I/idooQVpJ9ElO 9vld4JK12+j8i5s5JI6l6GfSi6RtA4wOcPi0XoPgWCh/j/EOxW5mu4OSTosNswqB39 NlQDJ//yQTySjepJ1gJRY8gt76cTIytu17wE1flL0dv0bBKG1lu74MqQydeQX1lRXW P85ECnQNre4WnS2k3RhG0esyaFt1RNofreLm3v72hFoJAg6feC7zrABkMwZsfFoNs8 5APGh6jkpjLHiikXU43zuRUEiq0bPAsvIy3s3yxKc70ZtpBRQN08Id4fl4iAC/1nKX /s8Ka7W76MqRA== X-Cc: mkl@pengutronix.de, kernel@pengutronix.de, mailhol@kernel.org, heiko@sntech.de, socketcan@hartkopp.net, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, wg@grandegger.com, linux-can@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org X-In-Reply-To: <20261108-rockchip-canfd-restart-close-v8-10-3e7a23fd9eae@qq.com> X-sashiko-severity: Low 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