From: Takashi Iwai <tiwai@suse.de>
To: Daniel J Blueman <daniel@quora.org>
Cc: Dave Airlie <airlied@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
alsa-devel@alsa-project.org
Subject: Re: [3.6-rc7] switcheroo race with Intel HDA...
Date: Mon, 08 Oct 2012 14:58:38 +0200 [thread overview]
Message-ID: <s5hvceli0ht.wl%tiwai@suse.de> (raw)
In-Reply-To: <CAMVG2st1-3kz-KRrm-zXZOGw8=QnyYbB3n5e8Z36xAbmD4b5RQ@mail.gmail.com>
Hi Daniel,
sorry for the late reply. I'm just back from vacation.
At Tue, 25 Sep 2012 13:20:05 +0800,
Daniel J Blueman wrote:
>
> On my Macbook with a discrete Nvidia GPU, there is a race between
> selecting the integrated GPU and putting the discrete GPU into D3 [1],
> reliably causing a kernel oops [2].
>
> Introducing a delay of ~1s between the calls prevents this. When the
> second 'OFF' write path executes, it looks like struct azx at
> card->private_data hasn't yet been allocated yet [3], so there is
> likely some locking missing.
It's rather pci_get_drvdata() returning NULL (i.e. card is NULL, thus
card->private_data causes Oops). Could you check the patch like below
and see whether you get a kernel warning (but no Oops) or the problem
gets fixed by shifting the assignment of pci drvdata?
thanks,
Takashi
---
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f09ff6c..152f9e1 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2609,9 +2609,15 @@ static void azx_vs_set_state(struct pci_dev *pci,
enum vga_switcheroo_state state)
{
struct snd_card *card = pci_get_drvdata(pci);
- struct azx *chip = card->private_data;
+ struct azx *chip;
bool disabled;
+ if (WARN_ON(!card))
+ return;
+
+ chip = card->private_data;
+ if (WARN_ON(!chip))
+ return;
if (chip->init_failed)
return;
@@ -3314,6 +3320,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
}
snd_card_set_dev(card, &pci->dev);
+ pci_set_drvdata(pci, card);
err = azx_create(card, pci, dev, pci_id->driver_data, &chip);
if (err < 0)
@@ -3340,8 +3347,6 @@ static int __devinit azx_probe(struct pci_dev *pci,
goto out_free;
}
- pci_set_drvdata(pci, card);
-
if (pci_dev_run_wake(pci))
pm_runtime_put_noidle(&pci->dev);
@@ -3350,6 +3355,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
out_free:
snd_card_free(card);
+ pci_set_drvdata(pci, NULL);
return err;
}
next prev parent reply other threads:[~2012-10-08 12:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 5:20 Daniel J Blueman
2012-10-08 12:58 ` Takashi Iwai [this message]
2012-10-08 16:34 ` Daniel J Blueman
2012-10-09 10:04 ` Takashi Iwai
2012-10-09 10:07 ` Takashi Iwai
2012-10-09 11:23 ` Daniel J Blueman
2012-10-09 13:04 ` Takashi Iwai
2012-10-09 14:26 ` Daniel J Blueman
2012-10-10 12:34 ` Takashi Iwai
2012-10-12 15:08 ` Daniel J Blueman
2012-10-12 15:26 ` Takashi Iwai
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=s5hvceli0ht.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=airlied@redhat.com \
--cc=alsa-devel@alsa-project.org \
--cc=daniel@quora.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®