Skip to contentSkip to conversation

FAILED: patch "[PATCH] can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Oct 31, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Possible dependencies:

702de2c21eed ("can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive") 45721c406dcf ("can: rcar_canfd: Add support for r8a779a0 SoC")
76e9353a80e9 ("can: rcar_canfd: Add support for RZ/G2L family")
13dfb3fa4943 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 702de2c21eed04c67cefaaedc248ef16e5f6b293 Mon Sep 17 00:00:00 2001
From: Biju Das <[email protected]>
Date: Tue, 25 Oct 2022 16:56:55 +0100
Subject: [PATCH] can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ
storm on global FIFO receive

We are seeing an IRQ storm on the global receive IRQ line under heavy CAN bus load conditions with both CAN channels enabled.

Conditions:

The global receive IRQ line is shared between can0 and can1, either of the channels can trigger interrupt while the other channel's IRQ line is disabled (RFIE).

When global a receive IRQ interrupt occurs, we mask the interrupt in the IRQ handler. Clearing and unmasking of the interrupt is happening in rx_poll(). There is a race condition where rx_poll() unmasks the interrupt, but the next IRQ handler does not mask the IRQ due to NAPIF_STATE_MISSED flag (e.g.: can0 RX FIFO interrupt is disabled and can1 is triggering RX interrupt, the delay in rx_poll() processing results in setting NAPIF_STATE_MISSED flag) leading to an IRQ storm.

This patch fixes the issue by checking IRQ active and enabled before handling the IRQ on a particular channel.

Fixes dd3bd23eb438 ("can: rcar_canfd: Add Renesas R-Car CAN FD driver")
[mkl: adjust commit message]
drivers/net/can/rcar/rcar_canfd.c +4 -2
index 567620d215f8..ea828c1bd3a1 100644
@@ -1157,11 +1157,13 @@ static void rcar_canfd_handle_global_receive(struct rcar_canfd_global *gpriv, u3
 {
 	struct rcar_canfd_channel *priv = gpriv->ch[ch];
 	u32 ridx = ch + RCANFD_RFFIFO_IDX;
-	u32 sts;
+	u32 sts, cc;
 
 	/* Handle Rx interrupts */
 	sts = rcar_canfd_read(priv->base, RCANFD_RFSTS(gpriv, ridx));
-	if (likely(sts & RCANFD_RFSTS_RFIF)) {
+	cc = rcar_canfd_read(priv->base, RCANFD_RFCC(gpriv, ridx));
+	if (likely(sts & RCANFD_RFSTS_RFIF &&
+		   cc & RCANFD_RFCC_RFIE)) {
 		if (napi_schedule_prep(&priv->napi)) {
 			/* Disable Rx FIFO interrupts */
 			rcar_canfd_clear_bit(priv->base,