On Tue, 2012-10-30 at 14:45 -0400, Steven Rostedt wrote:
> On Wed, 2012-10-31 at 03:33 +0900, anish kumar wrote:
> 
> > > CPU 0                                 CPU 1
> > > 
> > > data = something                     flags = IRQ_WORK_BUSY
> > > smp_mb() (implicit with cmpxchg      smp_mb()
> > >           on flags in claim)         execute_work (sees data from CPU
> > > 0)
> > > try to claim
> > > 
> > As I understand without the memory barrier proposed by you the situation
> > would be as below:
> > CPU 0                                 CPU 1
> >  
> > data = something                     flags = IRQ_WORK_BUSY
> > smp_mb() (implicit with cmpxchg      execute_work (sees data from CPU 0)
> >            on flags in claim)        
> > _success_ in claiming and goes
> 
> Correct, because it would see the stale value of flags.
> 
> > ahead and execute the work(wrong?)
> >                                  cmpxchg cause flag to IRQ_WORK_BUSY
> > 
> > Now knows the flag==IRQ_WORK_BUSY
> >                                 
> > Am I right?
> 
> right.
> 
> > 
> > Probably a stupid question.Why do we return the bool from irq_work_queue
> > when no one bothers to check the return value?Wouldn't it be better if
> > this function is void as used by the users of this function or am I
> > looking at the wrong code.
> 
> Not a stupid question, as I was asking that to myself just earlier
> today. But forgot to mention it as well. Especially, because it makes it
> look like there's a bug in the code. Maybe someday someone will care if
> their work was finished by itself, or some other CPU.
> 
> Probably should just nix the return value.
Can I send a patch to fix this?
> 
> -- Steve
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to