public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Marcin Ślusarz" <marcin.slusarz@gmail.com>
Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM..."  <alsa-devel@alsa-project.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Vinod Koul <vkoul@kernel.org>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Len Brown <lenb@kernel.org>
Subject: Re: Crash in acpi_ns_validate_handle triggered by soundwire on Linux 5.10
Date: Wed, 27 Jan 2021 16:02:29 -0600	[thread overview]
Message-ID: <709fa03c-43b7-45e4-3ddc-aae0d8f4ced4@linux.intel.com> (raw)
In-Reply-To: <CA+GA0_sZm2pqOfA3LsNQowb930QS_g5CiCCGthzsS=vAjB9Rjg@mail.gmail.com>



On 1/27/21 1:18 PM, Marcin Ślusarz wrote:
> śr., 27 sty 2021 o 18:28 Pierre-Louis Bossart
> <pierre-louis.bossart@linux.intel.com> napisał(a):
>>> Weird, I can't reproduce this problem with my self-compiled kernel :/
>>> I don't even see soundwire modules loaded in. Manually loading them of course
>>> doesn't do much.
>>>
>>> Previously I could boot into the "faulty" kernel by using "recovery mode", but
>>> I can't do that anymore - it crashes too.
>>>
>>> Maybe there's some kind of race and this bug depends on some specific
>>> ordering of events?
>>
>> missing Kconfig?
>> You need CONFIG_SOUNDWIRE and CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE
>> selected to enter this sdw_intel_acpi_scan() routine.
> 
> It was a PEBKAC, but a slightly different one. I won't bore you with
> (embarrassing) details ;).
> 
> I reproduced the problem, tested both your and Rafael's patches
> and the kernel still crashes, with the same stack trace.
> (Yes, I'm sure I booted the right kernel :)
> 
> Why "recovery mode" stopped working (or worked previously) is still a mystery.
> 

Thanks Marcin for the information. If you have a consistent failure 
that's better to some extent.

Maybe a bit of explanation of what this routine tries to do:
when SoundWire is enabled in a system, we need to have the following 
pattern in the DSDT:

     Scope (_SB.PCI0)
     {
         Device (HDAS)
         {
             Name (_ADR, 0x001F0003)  // _ADR: Address
         }


         Scope (HDAS)
         {
             Device (SNDW)
             {
                 Name (_ADR, 0x40000000)  // _ADR: Address

The only thing the code does is to walk through the children and check 
if the valid _ADR 0x40000000 is found.

You don't have SoundWire in your device so there should not be any 
children found. I don't see anything in the DSDT that looks like 
_SB.PCI0.HDAS.<something>, so in theory we should not even enter the 
callback.

The error happens in acpi_bus_get_device(), after we read the adr but 
before we check it, so wondering if we shouldn't revert the checks. Can 
you try the diff below? I am not sure why there is a crash and we should 
root-cause this issue, just trying to triangulate what is happening.

diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index cabdadb09a1b..6bc87a682fb3 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -369,13 +369,6 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle 
handle, u32 level,
         if (ACPI_FAILURE(status))
                 return AE_OK; /* keep going */

-       if (acpi_bus_get_device(handle, &adev)) {
-               pr_err("%s: Couldn't find ACPI handle\n", __func__);
-               return AE_NOT_FOUND;
-       }
-
-       info->handle = handle;
-
         /*
          * On some Intel platforms, multiple children of the HDAS
          * device can be found, but only one of them is the SoundWire
@@ -386,6 +379,13 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle 
handle, u32 level,
         if (FIELD_GET(GENMASK(31, 28), adr) != SDW_LINK_TYPE)
                 return AE_OK; /* keep going */

+       if (acpi_bus_get_device(handle, &adev)) {
+               pr_err("%s: Couldn't find ACPI handle\n", __func__);
+               return AE_NOT_FOUND;
+       }
+
+       info->handle = handle;
+
         /* device found, stop namespace walk */
         return AE_CTRL_TERMINATE;
  }



  parent reply	other threads:[~2021-01-27 22:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 19:56 Crash in acpi_ns_validate_handle triggered by soundwire on Linux 5.10 Marcin Ślusarz
2021-01-20 20:34 ` Rafael J. Wysocki
2021-01-20 22:28   ` Pierre-Louis Bossart
2021-01-21 17:47     ` Marcin Ślusarz
2021-01-27 16:36       ` Marcin Ślusarz
2021-01-27 17:28         ` Pierre-Louis Bossart
2021-01-27 19:18           ` Marcin Ślusarz
2021-01-27 21:52             ` Pierre-Louis Bossart
2021-01-27 22:02             ` Pierre-Louis Bossart [this message]
2021-01-28 13:25               ` Marcin Ślusarz
2021-01-28 13:31                 ` Rafael J. Wysocki
2021-01-28 12:13             ` Rafael J. Wysocki
2021-01-28 12:39               ` Rafael J. Wysocki
2021-01-28 13:45                 ` Marcin Ślusarz
2021-01-28 14:32                 ` Marcin Ślusarz
2021-01-29 18:59                   ` Marcin Ślusarz
2021-01-29 20:03                     ` Marcin Ślusarz
2021-02-01 11:42                       ` Rafael J. Wysocki
2021-02-01 12:16                         ` Marcin Ślusarz
2021-02-04 12:11                           ` Marcin Ślusarz
2021-02-04 12:48                             ` Marcin Ślusarz
2021-02-05 15:40                               ` [PATCH] soundwire: intel: fix possible crash when no device is detected (was Re: Crash in acpi_ns_validate_handle triggered by soundwire on Linux 5.10) Marcin Ślusarz
2021-02-05 16:16                                 ` Pierre-Louis Bossart
2021-02-08 12:01                                   ` [PATCH 1/2] soundwire: intel: fix possible crash when no device is detected Marcin Ślusarz
2021-02-08 12:01                                     ` [PATCH 2/2] ACPICA: update documentation of acpi_walk_namespace Marcin Ślusarz
2021-02-08 12:43                                       ` Rafael J. Wysocki
2021-02-12 12:27                                         ` [PATCH] " Marcin Ślusarz
2021-02-12 13:26                                           ` Rafael J. Wysocki
2021-02-08 12:37                                     ` [PATCH 1/2] soundwire: intel: fix possible crash when no device is detected Rafael J. Wysocki
2021-02-10 23:15                                       ` Pierre-Louis Bossart
2021-02-11  5:20                                         ` Vinod Koul
2021-01-28 13:29               ` Crash in acpi_ns_validate_handle triggered by soundwire on Linux 5.10 Marcin Ślusarz
2021-01-28 13:36                 ` Rafael J. Wysocki
2021-01-25 18:38     ` Salvatore Bonaccorso
2021-01-25 19:26       ` Pierre-Louis Bossart

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=709fa03c-43b7-45e4-3ddc-aae0d8f4ced4@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=marcin.slusarz@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /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