From: Jamie Lokier <jamie@shareable.org>
To: Philby John <pjohn@mvista.com>
Cc: linux-mtd@lists.infradead.org, linux-mips@linux-mips.org,
David Daney <ddaney@caviumnetworks.com>,
linux-kernel@vger.kernel.org,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH] mtd: Fix bug using smp_processor_id() in preemptible ubi_bgt1d kthread
Date: Mon, 14 Jun 2010 16:04:25 +0100 [thread overview]
Message-ID: <20100614150425.GC9550@shareable.org> (raw)
In-Reply-To: <1276513457.16642.3.camel@localhost.localdomain>
Philby John wrote:
> mtd: Fix bug using smp_processor_id() in preemptible ubi_bgt1d kthread
>
> On a MIPS Cavium Octeon CN5020 when trying to create a UBI volume,
> on the NOR flash, the kernel thread ubi_bgt1d calls
> cfi_amdstd_write_buffers() --> do_write_buffer() -->
> INVALIDATE_CACHE_UDELAY --> __udelay(). Its __udelay() that calls
> smp_processor_id() in preemptible code, which you are not supposed to.
> Fix the problem by disabling preemption.
The MTD code just calls udelay().
Are you sure it isn't permitted to call udelay() from preemptible code?
I think it is fine.
Perhaps MIPS udelay() should be disabling preemption itself, or
(as x86 does) using raw_smp_processor_id() instead? Or perhaps the x86
version is a bug because the current CPU might change during the delay loop?
See git commit 5c1ea08215f1f830dfaf4819a5f22efca41c3832
"x86: enable preemption in delay"
I don't think it makes sense to disable preemption in all udelay()
calls in drivers, so my NAK to this MTD patch. To workaround,
consider putting the preempt_disable in MIPS udelay(), or using
raw_smp_processor_id() in it, after reading the above git commit's
message. A proper fix would accept a context switch during the delay
and rescale the remaining count, but even on x86 they haven't done
that yet :-)
Regards,
-- Jamie
next prev parent reply other threads:[~2010-06-14 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-14 11:04 [PATCH] mtd: Fix bug using smp_processor_id() in preemptible ubi_bgt1d kthread Philby John
2010-06-14 15:04 ` Jamie Lokier [this message]
2010-06-14 15:37 ` Philby John
2010-06-14 16:40 ` Philby John
2010-06-15 12:26 ` Philby John
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=20100614150425.GC9550@shareable.org \
--to=jamie@shareable.org \
--cc=ddaney@caviumnetworks.com \
--cc=dedekind1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-mtd@lists.infradead.org \
--cc=pjohn@mvista.com \
/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