[alsa-devel] [PATCH] ALSA: aloop - do not reschedule timer if deleted

Takashi Iwai tiwai at suse.de
Sun Oct 21 10:55:01 CEST 2012


At Sat, 20 Oct 2012 18:12:29 +0530,
Omair Mohammed Abdullah wrote:
> 
> 
> >>
> >> If the timer is deleted while the timer handler is running, it may get
> >> rescheduled and an unnecessary period elapsed will be sent.
> >>
> >> Add a flag to reschedule the timer only if it has not been stopped.
> >
> > In which situation is it rescheduled exactly?
> When the loopback_timer_stop() runs on one CPU while 
> loopback_timer_function() runs on the other CPU. This causes the 
> loopback_timer_function() to reschedule the timer beacuse del_timer() 
> will not wait for the timer function to finish.
> 
> >
> > Actually there is a small race in the check of running bit and the
> > timer lock.  Do you mean this?
> >
> > If so, wouldn't it be cleaner to get rid of timer_lock and protect the
> > whole start/stop with cable->lock, too, like below?
> >
> Yes, I think this fixes the problem quite well.

OK, now applied my patch.  Thanks for checking.


Takashi


More information about the Alsa-devel mailing list