From: Andrew Morton <akpm@linux-foundation.org>
To: Stefani Seibold <stefani@seibold.net>
Cc: David Woodhouse <dwmw2@infradead.org>,
"Kreuzer, Michael \(NSN - DE/Ulm\)" <michael.kreuzer@nsn.com>,
linux-mtd@lists.infradead.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [Patch] fix MTD CFI/LPDDR flash driver huge latency bug
Date: Sat, 13 Mar 2010 06:25:53 -0500 [thread overview]
Message-ID: <20100313062553.2bdec297.akpm@linux-foundation.org> (raw)
In-Reply-To: <1268483490.6339.21.camel@wall-e>
On Sat, 13 Mar 2010 13:31:30 +0100 Stefani Seibold <stefani@seibold.net> wrote:
> Am Freitag, den 12.03.2010, 14:23 -0800 schrieb Andrew Morton:
> > On Sat, 06 Mar 2010 17:48:57 +0100
> > Stefani Seibold <stefani@seibold.net> wrote:
> >
> > > This patch fix a huge latency problem in the MTD CFI and LPDDR flash
> > > drivers.
> > >
> > > The use of a memcpy() during a spinlock operation will cause very long
> > > thread context switch delays if the flash chip bandwidth is low and the
> > > data to be copied large, because a spinlock will disable preemption.
> > >
> > > For example: A flash with 6,5 MB/s bandwidth will cause under ubifs,
> > > which request sometimes 128 KB (the flash erase size), a preemption
> > > delay of 20 milliseconds. High priority threads will not be served
> > > during this time, regardless whether this threads access the flash or
> > > not. This behavior breaks real time.
> > >
> > > The patch change all the use of spin_lock operations for xxxx->mutex
> > > into mutex operations, which is exact what the name says and means.
> > >
> > > There is no performance regression since the mutex is normally not
> > > acquired.
> >
> > hm, big scary patch. Are you sure this mutex is never taken from
> > atomic or irq contexts? Is it ully tested with all relevant debug options
> > and lockdep enabled?
> >
> >
>
> I have analyzed this drivers and IMHO i don't think there will be used
> from irq or atomic contexts. There is no request interrupt and there are
> a lot msleep and add_wait_queues/schedule calls during holding the
> mutex, which are not very useful in a irq or atomic context. But i don't
> know the whole mtd stack.
>
> I tested the patch with the following kernel debug options:
>
> CONFIG_DEBUG_KERNEL=y
> CONFIG_DETECT_SOFTLOCKUP=y
> CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
> CONFIG_SCHED_DEBUG=y
> CONFIG_SCHEDSTATS=y
> CONFIG_TIMER_STATS=y
> CONFIG_DEBUG_MUTEXES=y
> CONFIG_DEBUG_SPINLOCK_SLEEP=y
>
Neato. As was mentioned, one thing to check is the mtdoops path.
oopses can happen with locks held, from IRQ context, etc.
If we're trying to take that mutex in oops context then I guess that's
fixable by just not taking it and hoping for the best. Or, better,
mutex_trylock() and conditional mutex_unlock() to try to be nice to
possible concurrent activity on other CPUs.
next prev parent reply other threads:[~2010-03-13 11:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 16:48 [Patch] fix MTD CFI/LPDDR flash driver huge latency bug Stefani Seibold
2010-03-12 22:23 ` Andrew Morton
2010-03-12 23:38 ` Jamie Lokier
2010-03-13 12:35 ` Stefani Seibold
2010-03-15 3:03 ` Jamie Lokier
2010-03-15 6:15 ` Stefani Seibold
2010-03-15 14:24 ` Jamie Lokier
2010-03-19 8:29 ` David Woodhouse
2010-03-19 8:40 ` Jamie Lokier
2010-03-13 12:31 ` Stefani Seibold
2010-03-13 11:25 ` Andrew Morton [this message]
2010-03-13 17:00 ` Stefani Seibold
-- strict thread matches above, loose matches on Subject: below --
2010-02-28 17:00 Stefani Seibold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100313062553.2bdec297.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael.kreuzer@nsn.com \
--cc=stefani@seibold.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).