linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC v1 1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices
@ 2022-01-26  8:57 David Decotigny
  2022-01-26  9:08 ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: David Decotigny @ 2022-01-26  8:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	linux-mtd, David Decotigny

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(+)

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);
 	}
 }
-- 
2.35.0.rc0.227.g00780c9af4-goog


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

* Re: [PATCH RFC v1 1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices
  2022-01-26  8:57 [PATCH RFC v1 1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices David Decotigny
@ 2022-01-26  9:08 ` Richard Weinberger
       [not found]   ` <CAG88wWZYbMLYRa9iebAeWtBdLtNWdL4djbPRq36EHrXeNzMsiw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2022-01-26  9:08 UTC (permalink / raw)
  To: David Decotigny
  Cc: linux-kernel, Miquel Raynal, Vignesh Raghavendra, linux-mtd,
	David Decotigny

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

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

* Re: [PATCH RFC v1 1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices
       [not found]   ` <CAG88wWZYbMLYRa9iebAeWtBdLtNWdL4djbPRq36EHrXeNzMsiw@mail.gmail.com>
@ 2022-01-26  9:43     ` Richard Weinberger
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2022-01-26  9:43 UTC (permalink / raw)
  To: David Decotigny
  Cc: David Decotigny, linux-kernel, Miquel Raynal,
	Vignesh Raghavendra, linux-mtd

----- 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

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

end of thread, other threads:[~2022-01-26  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  8:57 [PATCH RFC v1 1/1] mtd_blkdevs: avoid soft lockups with some mtd/spi devices David Decotigny
2022-01-26  9:08 ` Richard Weinberger
     [not found]   ` <CAG88wWZYbMLYRa9iebAeWtBdLtNWdL4djbPRq36EHrXeNzMsiw@mail.gmail.com>
2022-01-26  9:43     ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).