The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] ACPI: power: Evaluate power resource _ON methods exclusively
@ 2026-11-26 17:21 Ayush Singh
  2026-12-02 19:29 ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 3+ messages in thread
From: Ayush Singh @ 2026-11-26 17:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel, Ayush Singh

On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan), the NVMe drive in
the second M.2 slot is frequently lost after resuming from s2idle:

  pcieport 0000:00:02.1: broken device, retraining non-functional downstream link at 2.5GT/s
  pcieport 0000:00:02.1: retraining failed
  pcieport 0000:00:02.1: Data Link Layer Link Active not set in 100 msec
  nvme nvme1: Disabling device after reset failure: -19

The _ON methods of the two M.2 slots' power resources update a clock
control register shared by both slots without any locking, and sleep in
the middle of the update. Since the root ports are resumed
asynchronously, the two methods can run concurrently, and one of them
can undo the other's change, leaving that slot's reference clock
disabled. Its link then never trains.

The same symptom has been reported on the closely related IdeaPad Pro 5
14AKP10 (83JL) [0], which likely has the same problem and should be
fixed by this as well.

Evaluate power resource _ON methods one at a time using the
acpi_evaluate_object_exclusive() helper. With this, 20/20
s2idle cycles succeeded, versus failure within 1-2 cycles before.
Also tested in normal laptop usage for a few days.

[0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t

Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Assisted-by: claude-opus-5-5
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
---
On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan, BIOS QFCN29WW),
the NVMe drive behind root port 00:02.1 (ACPI GPP3) is lost on nearly
every s2idle resume, while the drive in the other M.2 slot (GP10) always
comes back. Updating to the latest BIOS did not help, and neither did
disabling SSD power management via kernel parameters or recovering the
device from userspace.

The "broken device, retraining non-functional downstream link at
2.5GT/s" / "retraining failed" messages come from the Target Speed quirk
reacting to a link that cannot train at all. The actual cause is a race
between the two slots' power resource _ON methods in firmware, which
can leave one slot's reference clock disabled, as described in the
patch. I can share the relevant AML and debug logs if useful.

Testing: 20/20 s2idle cycles with real S0i3 residency, versus failure
within 1-2 cycles without the patch. I have also done normal daily use
testing outside of synthetic suspend.

The IdeaPad Pro 5 14AKP10 (83JL) appears to have the same problem on
the same root port [0].

As suggested, we now use acpi_evaluate_object_exclusive
unconditionally.

[0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
---
Changes in v2:
- Switch to using acpi_evaluate_object_exclusive() unconditionally
- Link to v1: https://lore.kernel.org/r/20261124-ssd-fix-v1-1-ee8ef43190b1@beagleboard.org
---
 drivers/acpi/power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 23a4e207a01e..82c8af6f8c7a 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -368,7 +368,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
 	struct acpi_power_dependent_device *dep;
 	acpi_status status = AE_OK;
 
-	status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
+	status = acpi_evaluate_object_exclusive(handle, "_ON", NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
 		return -ENODEV;

---
base-commit: 988117cc1bb17338c586a4e21ade88b5397eac33
change-id: 20261122-ssd-fix-6b7ab639796d

Best regards,
-- 
Ayush Singh <ayush@beagleboard.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ACPI: power: Evaluate power resource _ON methods exclusively
  2026-11-26 17:21 [PATCH v2] ACPI: power: Evaluate power resource _ON methods exclusively Ayush Singh
@ 2026-12-02 19:29 ` Rafael J. Wysocki (Intel)
  2026-12-05 13:33   ` Ayush Singh
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-12-02 19:29 UTC (permalink / raw)
  To: Ayush Singh; +Cc: Rafael J. Wysocki, Len Brown, linux-acpi, linux-kernel

On Thu, Nov 26, 2026 at 6:21 PM Ayush Singh <ayush@beagleboard.org> wrote:
>
> On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan), the NVMe drive in
> the second M.2 slot is frequently lost after resuming from s2idle:
>
>   pcieport 0000:00:02.1: broken device, retraining non-functional downstream link at 2.5GT/s
>   pcieport 0000:00:02.1: retraining failed
>   pcieport 0000:00:02.1: Data Link Layer Link Active not set in 100 msec
>   nvme nvme1: Disabling device after reset failure: -19
>
> The _ON methods of the two M.2 slots' power resources update a clock
> control register shared by both slots without any locking, and sleep in
> the middle of the update. Since the root ports are resumed
> asynchronously, the two methods can run concurrently, and one of them
> can undo the other's change, leaving that slot's reference clock
> disabled. Its link then never trains.
>
> The same symptom has been reported on the closely related IdeaPad Pro 5
> 14AKP10 (83JL) [0], which likely has the same problem and should be
> fixed by this as well.
>
> Evaluate power resource _ON methods one at a time using the
> acpi_evaluate_object_exclusive() helper. With this, 20/20
> s2idle cycles succeeded, versus failure within 1-2 cycles before.
> Also tested in normal laptop usage for a few days.
>
> [0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
>
> Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
> Assisted-by: claude-opus-5-5
> Signed-off-by: Ayush Singh <ayush@beagleboard.org>
> ---
> On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan, BIOS QFCN29WW),
> the NVMe drive behind root port 00:02.1 (ACPI GPP3) is lost on nearly
> every s2idle resume, while the drive in the other M.2 slot (GP10) always
> comes back. Updating to the latest BIOS did not help, and neither did
> disabling SSD power management via kernel parameters or recovering the
> device from userspace.
>
> The "broken device, retraining non-functional downstream link at
> 2.5GT/s" / "retraining failed" messages come from the Target Speed quirk
> reacting to a link that cannot train at all. The actual cause is a race
> between the two slots' power resource _ON methods in firmware, which
> can leave one slot's reference clock disabled, as described in the
> patch. I can share the relevant AML and debug logs if useful.
>
> Testing: 20/20 s2idle cycles with real S0i3 residency, versus failure
> within 1-2 cycles without the patch. I have also done normal daily use
> testing outside of synthetic suspend.
>
> The IdeaPad Pro 5 14AKP10 (83JL) appears to have the same problem on
> the same root port [0].
>
> As suggested, we now use acpi_evaluate_object_exclusive
> unconditionally.
>
> [0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
> ---
> Changes in v2:
> - Switch to using acpi_evaluate_object_exclusive() unconditionally
> - Link to v1: https://lore.kernel.org/r/20261124-ssd-fix-v1-1-ee8ef43190b1@beagleboard.org
> ---
>  drivers/acpi/power.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
> index 23a4e207a01e..82c8af6f8c7a 100644
> --- a/drivers/acpi/power.c
> +++ b/drivers/acpi/power.c
> @@ -368,7 +368,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
>         struct acpi_power_dependent_device *dep;
>         acpi_status status = AE_OK;
>
> -       status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
> +       status = acpi_evaluate_object_exclusive(handle, "_ON", NULL, NULL);
>         if (ACPI_FAILURE(status)) {
>                 resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
>                 return -ENODEV;
>
> ---

Unfortunately, this doesn't work for reasons explained by Sashiko:

https://sashiko.dev/#/patchset/20261126-ssd-fix-v2-1-32c91f6532e3%40beagleboard.org

So after all, using a separate lock around _ON and _OFF evaluation is
a better approach.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ACPI: power: Evaluate power resource _ON methods exclusively
  2026-12-02 19:29 ` Rafael J. Wysocki (Intel)
@ 2026-12-05 13:33   ` Ayush Singh
  0 siblings, 0 replies; 3+ messages in thread
From: Ayush Singh @ 2026-12-05 13:33 UTC (permalink / raw)
  To: Rafael J. Wysocki (Intel)
  Cc: Ayush Singh, Len Brown, linux-acpi, linux-kernel

"Rafael J. Wysocki (Intel)" <rafael@kernel.org> writes:

> On Thu, Nov 26, 2026 at 6:21 PM Ayush Singh <ayush@beagleboard.org> wrote:
>>
>> On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan), the NVMe drive in
>> the second M.2 slot is frequently lost after resuming from s2idle:
>>
>>   pcieport 0000:00:02.1: broken device, retraining non-functional downstream link at 2.5GT/s
>>   pcieport 0000:00:02.1: retraining failed
>>   pcieport 0000:00:02.1: Data Link Layer Link Active not set in 100 msec
>>   nvme nvme1: Disabling device after reset failure: -19
>>
>> The _ON methods of the two M.2 slots' power resources update a clock
>> control register shared by both slots without any locking, and sleep in
>> the middle of the update. Since the root ports are resumed
>> asynchronously, the two methods can run concurrently, and one of them
>> can undo the other's change, leaving that slot's reference clock
>> disabled. Its link then never trains.
>>
>> The same symptom has been reported on the closely related IdeaPad Pro 5
>> 14AKP10 (83JL) [0], which likely has the same problem and should be
>> fixed by this as well.
>>
>> Evaluate power resource _ON methods one at a time using the
>> acpi_evaluate_object_exclusive() helper. With this, 20/20
>> s2idle cycles succeeded, versus failure within 1-2 cycles before.
>> Also tested in normal laptop usage for a few days.
>>
>> [0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
>>
>> Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
>> Assisted-by: claude-opus-5-5
>> Signed-off-by: Ayush Singh <ayush@beagleboard.org>
>> ---
>> On the Lenovo Yoga Pro 7 14AKP10 (83KG, AMD Krackan, BIOS QFCN29WW),
>> the NVMe drive behind root port 00:02.1 (ACPI GPP3) is lost on nearly
>> every s2idle resume, while the drive in the other M.2 slot (GP10) always
>> comes back. Updating to the latest BIOS did not help, and neither did
>> disabling SSD power management via kernel parameters or recovering the
>> device from userspace.
>>
>> The "broken device, retraining non-functional downstream link at
>> 2.5GT/s" / "retraining failed" messages come from the Target Speed quirk
>> reacting to a link that cannot train at all. The actual cause is a race
>> between the two slots' power resource _ON methods in firmware, which
>> can leave one slot's reference clock disabled, as described in the
>> patch. I can share the relevant AML and debug logs if useful.
>>
>> Testing: 20/20 s2idle cycles with real S0i3 residency, versus failure
>> within 1-2 cycles without the patch. I have also done normal daily use
>> testing outside of synthetic suspend.
>>
>> The IdeaPad Pro 5 14AKP10 (83JL) appears to have the same problem on
>> the same root port [0].
>>
>> As suggested, we now use acpi_evaluate_object_exclusive
>> unconditionally.
>>
>> [0]: https://ratatoskr.run/linux-pci/2026/04/6586201/t
>> ---
>> Changes in v2:
>> - Switch to using acpi_evaluate_object_exclusive() unconditionally
>> - Link to v1: https://lore.kernel.org/r/20261124-ssd-fix-v1-1-ee8ef43190b1@beagleboard.org
>> ---
>>  drivers/acpi/power.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
>> index 23a4e207a01e..82c8af6f8c7a 100644
>> --- a/drivers/acpi/power.c
>> +++ b/drivers/acpi/power.c
>> @@ -368,7 +368,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
>>         struct acpi_power_dependent_device *dep;
>>         acpi_status status = AE_OK;
>>
>> -       status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
>> +       status = acpi_evaluate_object_exclusive(handle, "_ON", NULL, NULL);
>>         if (ACPI_FAILURE(status)) {
>>                 resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
>>                 return -ENODEV;
>>
>> ---
>
> Unfortunately, this doesn't work for reasons explained by Sashiko:
>
> https://sashiko.dev/#/patchset/20261126-ssd-fix-v2-1-32c91f6532e3%40beagleboard.org
>
> So after all, using a separate lock around _ON and _OFF evaluation is
> a better approach.

In patch v1, I was only serializing _ON. At least in my particular case,
there was no problem related to _OFF methods. Do you want both serialized?

Best Regards,
Ayush Singh

-- 
BeagleBoard.org Foundation
https://www.beagleboard.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-05 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 17:21 [PATCH v2] ACPI: power: Evaluate power resource _ON methods exclusively Ayush Singh
2026-12-02 19:29 ` Rafael J. Wysocki (Intel)
2026-12-05 13:33   ` Ayush Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox