lkml.org 
[lkml]   [2011]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG][2.6.38] IRQ Lock Inversion / i915 fails
At Fri, 18 Mar 2011 00:12:58 +0100,
Knut Petersen wrote:
>
> Thanks a lot. That patch below does indeed
> solve the irq lock inversion problem.

Thanks for testing. I applied the patch now.


Takashi

>
> cu,
> Knut
>
> >
> > The trigger callback should be called always in irq-disabled context,
> > so this should be OK. But loopback_pos_update() is called in the
> > timer callback, and this can be the issue.
> >
> > Knut, how about the patch below?
> >
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
> > index 12b44b0..a0da775 100644
> > --- a/sound/drivers/aloop.c
> > +++ b/sound/drivers/aloop.c
> > @@ -482,8 +482,9 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
> > cable->streams[SNDRV_PCM_STREAM_CAPTURE];
> > unsigned long delta_play = 0, delta_capt = 0;
> > unsigned int running;
> > + unsigned long flags;
> >
> > - spin_lock(&cable->lock);
> > + spin_lock_irqsave(&cable->lock, flags);
> > running = cable->running ^ cable->pause;
> > if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) {
> > delta_play = jiffies - dpcm_play->last_jiffies;
> > @@ -495,10 +496,8 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
> > dpcm_capt->last_jiffies += delta_capt;
> > }
> >
> > - if (delta_play == 0 && delta_capt == 0) {
> > - spin_unlock(&cable->lock);
> > - return running;
> > - }
> > + if (delta_play == 0 && delta_capt == 0)
> > + goto unlock;
> >
> > if (delta_play > delta_capt) {
> > loopback_bytepos_update(dpcm_play, delta_play - delta_capt,
> > @@ -510,14 +509,14 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
> > delta_capt = delta_play;
> > }
> >
> > - if (delta_play == 0 && delta_capt == 0) {
> > - spin_unlock(&cable->lock);
> > - return running;
> > - }
> > + if (delta_play == 0 && delta_capt == 0)
> > + goto unlock;
> > +
> > /* note delta_capt == delta_play at this moment */
> > loopback_bytepos_update(dpcm_capt, delta_capt, BYTEPOS_UPDATE_COPY);
> > loopback_bytepos_update(dpcm_play, delta_play, BYTEPOS_UPDATE_POSONLY);
> > - spin_unlock(&cable->lock);
> > + unlock:
> > + spin_unlock_irqrestore(&cable->lock, flags);
> > return running;
> > }
> >
> >
>


\
 
 \ /
  Last update: 2011-03-18 07:57    [W:0.040 / U:42.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site