linux-mips
[Top] [All Lists]

Re: [PATCH] mtd: Fix bug using smp_processor_id() in preemptible ubi_bgt

To: Jamie Lokier <jamie@shareable.org>
Subject: Re: [PATCH] mtd: Fix bug using smp_processor_id() in preemptible ubi_bgt1d kthread
From: Philby John <pjohn@mvista.com>
Date: Mon, 14 Jun 2010 22:10:18 +0530
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>
In-reply-to: <20100614150425.GC9550@shareable.org>
References: <1276513457.16642.3.camel@localhost.localdomain> <20100614150425.GC9550@shareable.org>
Reply-to: pjohn@mvista.com
Sender: linux-mips-bounce@linux-mips.org
On Mon, 2010-06-14 at 16:04 +0100, Jamie Lokier wrote:
> 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.

It isn't really udelay() but smp_processor_id() that you are not to call
from a preemptible thread. Now I also see Ed Swierk has done a similar
thing https://patchwork.kernel.org/patch/4049/ and he comments "..which
calls smp_processor_id(), which is not supposed to be called from a
preemptible thread."


So perhaps I can use preempt_disable() around just this call in function
__udelay()?

Regards,
Philby


<Prev in Thread] Current Thread [Next in Thread>