[RFC PATCH powerpc ] Protect smp_processor_id() in arch_spin_unlock_wait()
Li Zhong
zhong at linux.vnet.ibm.com
Thu Jan 10 18:50:29 EST 2013
On Thu, 2013-01-10 at 17:02 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2012-11-19 at 14:16 +0800, Li Zhong wrote:
> > This patch tries to disable preemption for using smp_processor_id() in arch_spin_unlock_wait(),
> > to avoid following report:
>
> .../...
>
> > diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
> > index bb7cfec..7a7c31b 100644
> > --- a/arch/powerpc/lib/locks.c
> > +++ b/arch/powerpc/lib/locks.c
> > @@ -72,8 +72,10 @@ void arch_spin_unlock_wait(arch_spinlock_t *lock)
> > {
> > while (lock->slock) {
> > HMT_low();
> > + preempt_disable();
> > if (SHARED_PROCESSOR)
> > __spin_yield(lock);
> > + preempt_enable();
> > }
>
> I assume what you are protecting is the PACA access in SHARED_PROCESSOR
> or is there more ?
Yes, only the one in SHARED_PROCESSOR.
>
> In that case I'd say just make it use local_paca-> directly or something
> like that. It doesn't matter if the access is racy, all processors will
> have the same value for that field as far as I can tell.
It also seemed to me that all processors have the same value :). I'll
send an updated version based on your suggestion soon.
Thanks, Zhong
>
> Cheers,
> Ben.
>
>
More information about the Linuxppc-dev
mailing list