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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jamie Lokier
Date: Monday, June 14, 2010 - 8:04 am

Philby John wrote:

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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] mtd: Fix bug using smp_processor_id() in preem ..., Jamie Lokier, (Mon Jun 14, 8:04 am)