From: Greg Kroah-Hartman Date: Wed, 2 Nov 2022 01:38:20 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.9.332~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b672b4fb09cf671bb9c904d14ccaad0ebea1c1a;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: can-rcar_canfd-rcar_canfd_handle_global_receive-fix-irq-storm-on-global-fifo-receive.patch --- diff --git a/queue-5.4/can-rcar_canfd-rcar_canfd_handle_global_receive-fix-irq-storm-on-global-fifo-receive.patch b/queue-5.4/can-rcar_canfd-rcar_canfd_handle_global_receive-fix-irq-storm-on-global-fifo-receive.patch new file mode 100644 index 00000000000..9cb72427efd --- /dev/null +++ b/queue-5.4/can-rcar_canfd-rcar_canfd_handle_global_receive-fix-irq-storm-on-global-fifo-receive.patch @@ -0,0 +1,70 @@ +From 702de2c21eed04c67cefaaedc248ef16e5f6b293 Mon Sep 17 00:00:00 2001 +From: Biju Das +Date: Tue, 25 Oct 2022 16:56:55 +0100 +Subject: can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive + +From: Biju Das + +commit 702de2c21eed04c67cefaaedc248ef16e5f6b293 upstream. + +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") +Suggested-by: Marc Kleine-Budde +Signed-off-by: Biju Das +Link: https://lore.kernel.org/all/20221025155657.1426948-2-biju.das.jz@bp.renesas.com +Cc: stable@vger.kernel.org +[mkl: adjust commit message] +Signed-off-by: Marc Kleine-Budde +[biju: removed gpriv from RCANFD_RFCC_RFIE macro] +Signed-off-by: Biju Das +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/can/rcar/rcar_canfd.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c +index 67f0f14e2bf4..c61534a2a2d3 100644 +--- a/drivers/net/can/rcar/rcar_canfd.c ++++ b/drivers/net/can/rcar/rcar_canfd.c +@@ -1075,7 +1075,7 @@ static irqreturn_t rcar_canfd_global_interrupt(int irq, void *dev_id) + struct rcar_canfd_global *gpriv = dev_id; + struct net_device *ndev; + struct rcar_canfd_channel *priv; +- u32 sts, gerfl; ++ u32 sts, cc, gerfl; + u32 ch, ridx; + + /* Global error interrupts still indicate a condition specific +@@ -1093,7 +1093,9 @@ static irqreturn_t rcar_canfd_global_interrupt(int irq, void *dev_id) + + /* Handle Rx interrupts */ + sts = rcar_canfd_read(priv->base, RCANFD_RFSTS(ridx)); +- if (likely(sts & RCANFD_RFSTS_RFIF)) { ++ cc = rcar_canfd_read(priv->base, RCANFD_RFCC(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, +-- +2.25.1 + diff --git a/queue-5.4/series b/queue-5.4/series index 27eb28bad33..a9a4d9522b3 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -61,3 +61,4 @@ nh-fix-scope-used-to-find-saddr-when-adding-non-gw-n.patch net-mlx5e-do-not-increment-esn-when-updating-ipsec-e.patch net-mlx5-fix-possible-use-after-free-in-async-comman.patch net-enetc-survive-memory-pressure-without-crashing.patch +can-rcar_canfd-rcar_canfd_handle_global_receive-fix-irq-storm-on-global-fifo-receive.patch