public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	ACPI Devel Mailing List <linux-acpi@vger.kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: ACPI scan regression -> Boot fail on Cherrytrail w/ 5.11-rc3
Date: Sat, 16 Jan 2021 12:18:54 +0100	[thread overview]
Message-ID: <a2ab4970-99ea-13c5-c02e-4e04030e1feb@redhat.com> (raw)
In-Reply-To: <56b732f4-9a24-688e-7cc7-6c2522d173c9@linux.intel.com>

Hi,

On 1/15/21 11:43 PM, Pierre-Louis Bossart wrote:
>>> OK, thanks!
>>>
>>> Now, there is a theory to test and some more debug work to do.
>>>
>>> First, the kernel should not crash outright if some ACPI device objects are
>>> missing which evidently happens here.  There may be some problems resulting
>>> from that, but the crash indicates a code bug in the kernel.
>>>
>>> Apparently, something expects the device objects to be there so badly, that it
>>> crashes right away when they aren't there.  One of the issues that may cause
>>> that to happen are mistakes around the acpi_bus_get_device() usage and I found
>>> two of them, so below is a patch to test.
>>>
>>> Please apply to plain 5.11-rc3 (or -rc4 when it is out) and see if that makes
>>> any difference.
>>>
>>> ---
>>>  drivers/acpi/scan.c         |    3 +--
>>>  drivers/usb/core/usb-acpi.c |    3 +--
>>>  2 files changed, 2 insertions(+), 4 deletions(-)
>>>
>>> Index: linux-pm/drivers/acpi/scan.c
>>> ===================================================================
>>> --- linux-pm.orig/drivers/acpi/scan.c
>>> +++ linux-pm/drivers/acpi/scan.c
>>> @@ -2120,8 +2120,7 @@ void acpi_walk_dep_device_list(acpi_hand
>>>  	mutex_lock(&acpi_dep_list_lock);
>>>  	list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) {
>>>  		if (dep->supplier == handle) {
>>> -			acpi_bus_get_device(dep->consumer, &adev);
>>> -			if (!adev)
>>> +			if (acpi_bus_get_device(dep->consumer, &adev))
>>>  				continue;
>>>  
>>>  			adev->dep_unmet--;
>>> Index: linux-pm/drivers/usb/core/usb-acpi.c
>>> ===================================================================
>>> --- linux-pm.orig/drivers/usb/core/usb-acpi.c
>>> +++ linux-pm/drivers/usb/core/usb-acpi.c
>>> @@ -163,10 +163,9 @@ usb_acpi_get_companion_for_port(struct u
>>>  	} else {
>>>  		parent_handle = usb_get_hub_port_acpi_handle(udev->parent,
>>>  							     udev->portnum);
>>> -		if (!parent_handle)
>>> +		if (!parent_handle || acpi_bus_get_device(parent_handle, &adev))
>>>  			return NULL;
>>>  
>>> -		acpi_bus_get_device(parent_handle, &adev);
>>>  		port1 = port_dev->portnum;
>>>  	}
>>>  
>> I can confirm that these changes fix the intermittent boot issue I had with
>> 5.11-rc3 on the Minix Neo z83-4. It is getting a bit late here, so I will
>> test my second (also intermittent) reproducer tomorrow.
> 
> Success on my side as well. I can boot and here is the updated list of dependencies (shorter than for the last test)

It is shorter because of this part of the debugging patch which Rafael send:

--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1854,7 +1854,8 @@ static u32 acpi_scan_check_dep(acpi_handle handle)
 	 * 2. ACPI nodes describing USB ports.
 	 * Still, checking for _HID catches more then just these cases ...
 	 */
-	if (!acpi_has_method(handle, "_DEP") || !acpi_has_method(handle, "_HID"))
+	if (!acpi_has_method(handle, "_DEP") || acpi_has_method(handle, "_ADR")
+	    || !acpi_has_method(handle, "_HID"))
 		return 0;
 
 	status = acpi_evaluate_reference(handle, "_DEP", NULL, &dep_devices);


So that is expected.

> I attached the diff I tested to make sure I didn't miss anything.

Erm, it looks like you also applied the debug patch from Rafael's last email, that
was only intended to be applied in case things still did not work I believe.

This bit from the debug-patch:

@@ -1937,10 +1938,8 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
 	if (type == ACPI_BUS_TYPE_DEVICE && check_dep) {
 		u32 count = acpi_scan_check_dep(handle);
 		/* Bail out if the number of recorded dependencies is not 0. */
-		if (count > 0) {
-			acpi_bus_scan_second_pass = true;
-			return AE_CTRL_DEPTH;
-		}
+		if (count > 0)
+			acpi_handle_info(handle, "Dependencies found\n");
 	}
 
 	acpi_add_single_object(&device, handle, type, sta);

Will cause all devices to be added during the first scan pass, like my
initial hack/test patch. Can you drop the debug patch and test with just the 2
changes from Rafael's previous mail please ?

Regards,

Hans




> 
> Thanks
> 
> -Pierre
> 
> 


  parent reply	other threads:[~2021-01-16 11:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 21:55 ACPI scan regression -> Boot fail on Cherrytrail w/ 5.11-rc3 Pierre-Louis Bossart
2021-01-14 23:34 ` Hans de Goede
2021-01-15  0:49   ` Pierre-Louis Bossart
2021-01-15  8:54     ` Hans de Goede
2021-01-15 13:38       ` Rafael J. Wysocki
2021-01-15 13:54     ` Rafael J. Wysocki
2021-01-15 14:52       ` Pierre-Louis Bossart
2021-01-15 14:55         ` Rafael J. Wysocki
2021-01-15 15:09           ` Pierre-Louis Bossart
2021-01-15 15:22             ` Rafael J. Wysocki
2021-01-15 15:38               ` Pierre-Louis Bossart
2021-01-15 16:05                 ` Hans de Goede
2021-01-15 16:22                   ` Rafael J. Wysocki
2021-01-15 16:41                     ` Pierre-Louis Bossart
2021-01-15 19:01                       ` Rafael J. Wysocki
2021-01-15 19:06                         ` Rafael J. Wysocki
2021-01-15 20:48                         ` Hans de Goede
2021-01-15 21:57                         ` Hans de Goede
     [not found]                           ` <56b732f4-9a24-688e-7cc7-6c2522d173c9@linux.intel.com>
2021-01-16 11:18                             ` Hans de Goede [this message]
2021-01-16 12:26                           ` Hans de Goede

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=a2ab4970-99ea-13c5-c02e-4e04030e1feb@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pierre-louis.bossart@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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