All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] can: rockchip_canfd: fix TX stalls and races
@ 2026-07-30 15:50 ` Cunhao Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Cunhao Lu @ 2026-07-30 15:50 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, kernel, Heiko Stuebner
  Cc: linux-can, linux-kernel, linux-arm-kernel, linux-rockchip, stable,
	Cunhao Lu

While running CAN traffic on an RK3588 system, the driver repeatedly
reported an inconsistent TX echo state:

  rockchip_canfd fea60000.can can0: rkcanfd_tx_tail_is_eff:
  echo_skb[0]=NULL tx_head=0x00060f7d tx_tail=0x00060f7c

The Rockchip CAN-FD driver completes transmissions by matching
self-received frames with entries in the echo skb ring. A race between its
transmit and completion paths can expose a partially updated echo entry,
dereference an skb queued for NAPI, or stop the TX queue without a later
completion to wake it.

The series aborts transmission when echo skb installation fails, retries the
outstanding hardware buffer, and serializes the TX head, tail, echo ring,
and command register sequence.

The final series was tested on an RK3588 rev2.2 at 1 Mbit/s with 100,000
extended CAN frames. The run triggered 138 erratum 6 retries and completed
without drops, queue stalls or driver warnings. RK3588 does not enable
erratum 12, so this test does not exercise that hardware workaround.

---
Changes in v4:
- Split the can_put_echo_skb() ownership fix into a standalone patch outside
  this series.
- Use reverse Christmas tree order for the new local variables.
- Use the same _unmasked suffix for the tx_head and tx_tail snapshots.
- Link to v3: https://patch.msgid.link/20260730-master-v3-0-91cf030c337d@qq.com

The standalone CAN core patch required by patch 1 was posted at:
https://lore.kernel.org/linux-can/tencent_944DADCC4B42C8484EC01DA2B15F42132906@qq.com

The v4 functional design and hardware test results are unchanged from v3.

Changes in v3:
- Make can_put_echo_skb() consume the skb on every error path and remove the
  Rockchip-specific -EINVAL free.
- Drop the redundant error message from rkcanfd_start_xmit().
- Link to v2:
  https://lore.kernel.org/linux-can/tencent_D802EB485A801362BF9F54130C0D990C6206@qq.com

Changes in v2:
- Document that the TX lock also serializes the erratum 12 MODE/CMD/MODE
  sequence.
- Add the erratum 12 commit to the Fixes tags of patch 3.
- Add RK3588 extended-frame stress-test results.
- Link to v1:
  https://lore.kernel.org/linux-can/tencent_0E5C2332F801372DD0D4CB4C25B88C18040@qq.com

To: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent Mailhol <mailhol@kernel.org>
To: kernel@pengutronix.de
To: Heiko Stuebner <heiko@sntech.de>
Cc: linux-can@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org

---
Cunhao Lu (3):
      can: rockchip_canfd: prevent TX stall on echo skb failure
      can: rockchip_canfd: retry the outstanding TX buffer
      can: rockchip_canfd: serialize TX state and command writes

 drivers/net/can/rockchip/rockchip_canfd-core.c |  1 +
 drivers/net/can/rockchip/rockchip_canfd-rx.c   | 31 +++++++++++++++------
 drivers/net/can/rockchip/rockchip_canfd-tx.c   | 37 +++++++++++++++++++++-----
 drivers/net/can/rockchip/rockchip_canfd.h      |  4 ++-
 4 files changed, 57 insertions(+), 16 deletions(-)
---
base-commit: 11028ab62899e4191e074ee364c712b77823a9c4
change-id: 20260730-master-a1b54b3cf5a0

Best regards,
--  
Cunhao Lu <1579567540@qq.com>


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-07-31  8:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260730-master-v4-0-07f7952f761d@qq.com>
2026-07-30 15:50 ` [PATCH v4 1/3] can: rockchip_canfd: prevent TX stall on echo skb failure Cunhao Lu
2026-07-30 15:50   ` Cunhao Lu
2026-07-30 16:11   ` sashiko-bot
2026-07-31  8:22   ` Marc Kleine-Budde
2026-07-31  8:22     ` Marc Kleine-Budde
2026-07-31  8:46     ` Cunhao Lu
2026-07-31  8:46       ` Cunhao Lu
2026-07-30 15:50 ` [PATCH v4 2/3] can: rockchip_canfd: retry the outstanding TX buffer Cunhao Lu
2026-07-30 15:50   ` Cunhao Lu
2026-07-30 16:12   ` sashiko-bot
2026-07-31  6:32     ` Marc Kleine-Budde
2026-07-30 15:50 ` [PATCH v4 3/3] can: rockchip_canfd: serialize TX state and command writes Cunhao Lu
2026-07-30 15:50   ` Cunhao Lu
2026-07-30 16:16   ` sashiko-bot
2026-07-30 15:50 [PATCH v4 0/3] can: rockchip_canfd: fix TX stalls and races Cunhao Lu
2026-07-30 15:50 ` Cunhao Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.