mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Knut Petersen <Knut_Petersen@t-online.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	jesse.barnes@intel.com, gregkh@suse.de,
	linux-kernel@vger.kernel.org,
	"David Müller" <d.mueller@elsoft.ch>
Subject: Re: [BUG][2.6.38] IRQ Lock Inversion / i915 fails
Date: Fri, 18 Mar 2011 00:12:58 +0100	[thread overview]
Message-ID: <4D82957A.1080200@t-online.de> (raw)
In-Reply-To: <s5haagtvfc2.wl%tiwai@suse.de>

Thanks a lot. That patch below does indeed
solve the irq lock inversion problem.

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;
>  }
>  
>


  parent reply	other threads:[~2011-03-17 23:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17  9:40 Knut Petersen
2011-03-17  9:47 ` Knut Petersen
2011-03-17 16:55 ` Linus Torvalds
2011-03-17 17:15   ` Takashi Iwai
2011-03-17 17:33     ` Linus Torvalds
2011-03-17 20:05       ` Steven Rostedt
2011-03-17 23:12     ` Knut Petersen [this message]
2011-03-18  6:55       ` Takashi Iwai
2011-03-17 23:33   ` Knut Petersen
2011-03-18 16:08   ` Knut Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D82957A.1080200@t-online.de \
    --to=knut_petersen@t-online.de \
    --cc=chris@chris-wilson.co.uk \
    --cc=d.mueller@elsoft.ch \
    --cc=gregkh@suse.de \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome