Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Wollrath <jwollrath@web.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: Dylan Reid <dgreid@chromium.org>, alsa-devel@alsa-project.org
Subject: Re: Hung task with trace after resume on kernel v3.7-rc6
Date: Mon, 19 Nov 2012 13:15:04 +0100	[thread overview]
Message-ID: <20121119131504.71f3151b@ilfaris> (raw)
In-Reply-To: <s5hmwydg7mq.wl%tiwai@suse.de>

> Could you try the patch below instead?
The patch did not apply against 3.7-rc6 but the patch below applied and
let the trace disappear.

> > By the way, it seems like I get the traces every 120 seconds and not
> > only once, forgot to mention that earlier.
> 
> The spurious call (or no proper reply for the verb) indicates that
> either the HD-audio controller or the HD-audio codec stalls.  Is yours
> a machine with a discrete GPU?  If so, and if you are using
> vga-switcheroo or anything manipulating the D-GPU, it's possibly the
> cause of the stall.
I just have an AMD-450 APU (an onboard GPU) with no vga-switcheroo or
other things involved.


With best regards,
Julian Wollrath

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 70d4848..cebe2dfd 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -228,7 +228,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
 	}
 	mutex_unlock(&bus->cmd_mutex);
 	snd_hda_power_down(codec);
-	if (res && *res == -1 && bus->rirb_error) {
+	if (!codec->in_pm && res && *res == -1 && bus->rirb_error) {
 		if (bus->response_reset) {
 			snd_printd("hda_codec: resetting BUS due to "
 				   "fatal communication error\n");
@@ -238,7 +238,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
 		goto again;
 	}
 	/* clear reset-flag when the communication gets recovered */
-	if (!err)
+	if (!err || codec->in_pm)
 		bus->response_reset = 0;
 	return err;
 }
@@ -3616,6 +3616,8 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
 {
 	unsigned int state;
 
+	codec->in_pm = 1;
+
 	if (codec->patch_ops.suspend)
 		codec->patch_ops.suspend(codec);
 	hda_cleanup_all_streams(codec);
@@ -3630,6 +3632,7 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
 	codec->power_transition = 0;
 	codec->power_jiffies = jiffies;
 	spin_unlock(&codec->power_lock);
+	codec->in_pm = 0;
 	return state;
 }
 
@@ -3638,6 +3641,8 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq)
  */
 static void hda_call_codec_resume(struct hda_codec *codec)
 {
+	codec->in_pm = 1;
+
 	/* set as if powered on for avoiding re-entering the resume
 	 * in the resume / power-save sequence
 	 */
@@ -3656,6 +3661,8 @@ static void hda_call_codec_resume(struct hda_codec *codec)
 		snd_hda_codec_resume_cache(codec);
 	}
 	snd_hda_jack_report_sync(codec);
+
+	codec->in_pm = 0;
 	snd_hda_power_down(codec); /* flag down before returning */
 }
 #endif /* CONFIG_PM */
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 507fe8a..4f4e545 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -869,6 +869,7 @@ struct hda_codec {
 	unsigned int power_on :1;	/* current (global) power-state */
 	unsigned int d3_stop_clk:1;	/* support D3 operation without BCLK */
 	unsigned int pm_down_notified:1; /* PM notified to controller */
+	unsigned int in_pm:1;		/* suspend/resume being performed */
 	int power_transition;	/* power-state in transition */
 	int power_count;	/* current (global) power refcount */
 	struct delayed_work power_work; /* delayed task for powerdown */

  reply	other threads:[~2012-11-19 12:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-18 15:18 Hung task with trace after resume on kernel v3.7-rc6 Julian Wollrath
2012-11-19  5:54 ` Dylan Reid
2012-11-19  9:38   ` Takashi Iwai
2012-11-19 10:56     ` Julian Wollrath
2012-11-19 11:11       ` Julian Wollrath
2012-11-19 11:22       ` Takashi Iwai
2012-11-19 12:15         ` Julian Wollrath [this message]
2012-11-19 12:50           ` Takashi Iwai
2012-11-19 13:56             ` Julian Wollrath
2012-11-19 14:18               ` Julian Wollrath
2012-11-19 14:38                 ` Takashi Iwai
2012-11-19 15:00                   ` Julian Wollrath
2012-11-19 16:09                     ` Julian Wollrath
2012-11-19 16:17                       ` Takashi Iwai
2012-11-19 17:51                         ` Julian Wollrath
2012-11-19 18:08                           ` Takashi Iwai
2012-11-19 19:06                             ` Takashi Iwai
2012-11-19 19:25                               ` Julian Wollrath
2012-11-19 20:28                                 ` Takashi Iwai
2012-11-19 19:14                             ` Julian Wollrath

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=20121119131504.71f3151b@ilfaris \
    --to=jwollrath@web.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dgreid@chromium.org \
    --cc=tiwai@suse.de \
    /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