Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH v2 0/2] can: rx-offload: make skb_irq_queue per-CPU
@ 2026-09-01  8:39 Ciprian Costea
  2026-09-01  8:39 ` [PATCH v2 1/2] " Ciprian Costea
  2026-09-01  8:39 ` [PATCH v2 2/2] can: at91_can: add missing can_rx_offload_del() in at91_can_remove() Ciprian Costea
  0 siblings, 2 replies; 6+ messages in thread
From: Ciprian Costea @ 2026-09-01  8:39 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Kurt Van Dijck
  Cc: linux-can, linux-arm-kernel, linux-kernel, imx, s32,
	Ciprian Marian Costea

From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>

can_rx_offload keeps a lockless irq_queue that the IRQ handlers fill and
that is later spliced under skb_queue.lock into the NAPI-facing skb_queue.
This works as long as a single context fills the irq_queue. flexcan with
FLEXCAN_QUIRK_SECONDARY_MB_IRQ and mcf5441x use two mailbox IRQ lines. When
those are affined to different CPUs the two handlers can enqueue into the
same list at the same time and corrupt it.

This series:
  1. Makes the irq_queue per-CPU so the handlers no longer share a list.
  2. Adds the can_rx_offload_del() that at91_can was missing; without it
the per-CPU allocation is leaked on unbind.

Changes since v1:

- The enqueue helpers used this_cpu_ptr() without disabling preemption.
  All four enqueue helpers now use get_cpu_ptr()/put_cpu_ptr().
- Guard can_rx_offload_del() against skb_irq_queue == NULL.
- Fix 'at91_can' memory leak by adding missing 'can_rx_offload_del'.

Ciprian Marian Costea (2):
  can: rx-offload: make skb_irq_queue per-CPU
  can: at91_can: add missing can_rx_offload_del() in at91_can_remove()

 drivers/net/can/at91_can.c       |  2 +
 drivers/net/can/dev/rx-offload.c | 83 ++++++++++++++++++++++++++------
 include/linux/can/rx-offload.h   |  2 +-
 3 files changed, 72 insertions(+), 15 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-09-01  9:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01  8:39 [PATCH v2 0/2] can: rx-offload: make skb_irq_queue per-CPU Ciprian Costea
2026-09-01  8:39 ` [PATCH v2 1/2] " Ciprian Costea
2026-09-01  8:56   ` sashiko-bot
2026-09-01  8:39 ` [PATCH v2 2/2] can: at91_can: add missing can_rx_offload_del() in at91_can_remove() Ciprian Costea
2026-09-01  8:49   ` sashiko-bot
2026-09-01  9:02     ` Ciprian Marian Costea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox