lkml.org 
[lkml]   [2014]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: [PATCH 1/2] genirq: Fix the possible synchronize_irq() wait-forever
On Fri, 21 Feb 2014, Liu, Chuansheng wrote:
> Hello Thomas,
>
> > -----Original Message-----
> > From: Thomas Gleixner [mailto:tglx@linutronix.de]
> > Sent: Friday, February 21, 2014 6:34 PM
> > To: Liu, Chuansheng
> > Cc: linux-kernel@vger.kernel.org; Wang, Xiaoming
> > Subject: RE: [PATCH 1/2] genirq: Fix the possible synchronize_irq() wait-forever
> >
> > On Fri, 21 Feb 2014, Liu, Chuansheng wrote:
> > > But feels there is another case which the synchronize_irq waited there
> > forever,
> > > it is no waking up action from irq_thread().
> > >
> > > CPU0 CPU1
> > > disable_irq() irq_thread()
> > > synchronize_irq()
> > > wait_event()
> > > adding the __wait into the queue wake_threads_waitq
> > > test threads_active==0
> > > atomic_dec_and_test(threads_active) 1 -- > 0
> > >
> > waitqueue_active(&desc->wait_for_threads)
> > > <== Here without smp_mb(), CPU1
> > maybe detect
> > > the queue is still empty??
> > > schedule()
> > >
> > > It will cause although the threads_active is 0, but irq_thread() didn't do the
> > waking up action.
> > > Is it reasonable? Then maybe we can add one smp_mb() before
> > waitqueue_active.
> >
> > I think you have a point there, but not on x86 wherre the atomic_dec
> > and the spinlock on the queueing side are full barriers. For non-x86
> > there is definitely a potential issue.
> >
> But even on X86, spin_unlock has no full barrier, the following scenario:
> CPU0 CPU1
> spin_lock
> atomic_dec_and_test
> insert into queue
> spin_unlock
> checking waitqueue_active

But CPU0 sees the 0, right?

Thanks,

tglx


\
 
 \ /
  Last update: 2014-02-21 12:41    [W:0.048 / U:1.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site