diff mbox series

[RFC,v1,1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices

Message ID 20220126085735.575625-1-decot+git@google.com
State Superseded
Delegated to: Miquel Raynal
Headers show
Series [RFC,v1,1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices | expand

Commit Message

David Decotigny Jan. 26, 2022, 8:57 a.m. UTC
From: David Decotigny <ddecotig@google.com>

With some spi devices, the heavy cpu usage due to polling the spi
registers may lead to netdev timeouts, RCU complaints, etc. This can
be acute in the absence of CONFIG_PREEMPT. This patch allows to give
enough breathing room to avoid those false positives.

Signed-off-by: David Decotigny <ddecotig@google.com>
---

I tested this on a 5.10 base (lockdep).

 drivers/mtd/mtd_blkdevs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Weinberger Jan. 26, 2022, 9:08 a.m. UTC | #1
David,

----- Ursprüngliche Mail -----
> Von: "David Decotigny" <decot+git@google.com>
> An: "linux-kernel" <linux-kernel@vger.kernel.org>
> CC: "Miquel Raynal" <miquel.raynal@bootlin.com>, "richard" <richard@nod.at>, "Vignesh Raghavendra" <vigneshr@ti.com>,
> "linux-mtd" <linux-mtd@lists.infradead.org>, "David Decotigny" <ddecotig@google.com>
> Gesendet: Mittwoch, 26. Januar 2022 09:57:35
> Betreff: [PATCH RFC v1 1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices

> From: David Decotigny <ddecotig@google.com>
> 
> With some spi devices, the heavy cpu usage due to polling the spi
> registers may lead to netdev timeouts, RCU complaints, etc. This can
> be acute in the absence of CONFIG_PREEMPT. This patch allows to give
> enough breathing room to avoid those false positives.

is the problem real or not? From your description it is not clear to me.
Please include lockdep splats and/or hung-task logs in the commit message.

I have no problem with adding a cond_resched() but first we need to
understand the issue a little better.

Thanks,
//richard
Richard Weinberger Jan. 26, 2022, 9:43 a.m. UTC | #2
----- Ursprüngliche Mail -----
> Von: "David Decotigny" <ddecotig@google.com>
> Yes, it is a real problem for us, sent v2 with splat in the commit description.
> The most annoying for us is not the RCU splat per-se, it's the netdev timeout,
> but the trace is not relevant (detected on another core).

Okay. But then it isn't a false positive as you write in the commit message.

Thanks,
//richard
diff mbox series

Patch

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 243f28a3206b4..64d2b093f114b 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -158,6 +158,7 @@  static void mtd_blktrans_work(struct mtd_blktrans_dev *dev)
 		}
 
 		background_done = 0;
+		cond_resched();
 		spin_lock_irq(&dev->queue_lock);
 	}
 }