linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] ACPI: PM: Fix up turning off unused power resources
@ 2021-10-15 17:11 Rafael J. Wysocki
  2021-10-15 17:12 ` [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state Rafael J. Wysocki
  2021-10-15 17:14 ` [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-10-15 17:11 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Linux PCI, Linux PM, Mika Westerberg, Andreas K. Huettel

Hi,

This series fixes a regression introduced during the 5.14 cycle and related to
turning off unused ACPI power resources (patch [1/2]) and causes the states of
all power resources to be checked during initialization (patch [2/2]).

Please refer to the patch changelogs for details.

Thanks!




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

* [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state
  2021-10-15 17:11 [PATCH v1 0/2] ACPI: PM: Fix up turning off unused power resources Rafael J. Wysocki
@ 2021-10-15 17:12 ` Rafael J. Wysocki
  2021-10-15 17:14 ` [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization Rafael J. Wysocki
  1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-10-15 17:12 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Linux PCI, Linux PM, Mika Westerberg, Andreas K. Huettel

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Commit 6381195ad7d0 ("ACPI: power: Rework turning off unused power
resources") caused power resources in unknown state with reference
counters equal to zero to be turned off too, but that caused issues
to appear in the field, so modify the code to only turn off power
resources that are known to be "on".

Link: https://lore.kernel.org/linux-acpi/6faf4b92-78d5-47a4-63df-cc2bab7769d0@molgen.mpg.de/
Fixes: 6381195ad7d0 ("ACPI: power: Rework turning off unused power resources")
Reported-by: Andreas K. Huettel <andreas.huettel@ur.de>
Tested-by: Andreas K. Huettel <andreas.huettel@ur.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: 5.14+ <stable@vger.kernel.org> # 5.14+
---
 drivers/acpi/power.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -1015,13 +1015,8 @@ void acpi_turn_off_unused_power_resource
 	list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
 		mutex_lock(&resource->resource_lock);
 
-		/*
-		 * Turn off power resources in an unknown state too, because the
-		 * platform firmware on some system expects the OS to turn off
-		 * power resources without any users unconditionally.
-		 */
 		if (!resource->ref_count &&
-		    resource->state != ACPI_POWER_RESOURCE_STATE_OFF) {
+		    resource->state == ACPI_POWER_RESOURCE_STATE_ON) {
 			acpi_handle_debug(resource->device.handle, "Turning OFF\n");
 			__acpi_power_off(resource);
 		}




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

* [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization
  2021-10-15 17:11 [PATCH v1 0/2] ACPI: PM: Fix up turning off unused power resources Rafael J. Wysocki
  2021-10-15 17:12 ` [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state Rafael J. Wysocki
@ 2021-10-15 17:14 ` Rafael J. Wysocki
  2021-10-18 10:40   ` [EXT] " Andreas K. Huettel
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-10-15 17:14 UTC (permalink / raw)
  To: Linux ACPI, Andreas K. Huettel; +Cc: LKML, Linux PCI, Linux PM, Mika Westerberg

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

To avoid situations in which the actual states of certain ACPI power
resources are not known just because they have never been referenced
by any device configuration objects, check the initial states of all
power resources as soon as they are found in the ACPI namespace (and
fall back to turning them on if the state check fails).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

Andreas, please test this patch (on top of the [1/2]) and let me know
if it works for you.

Thanks!

---
 drivers/acpi/power.c |   30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -923,6 +919,7 @@ struct acpi_device *acpi_add_power_resou
 	union acpi_object acpi_object;
 	struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
 	acpi_status status;
+	u8 state_dummy;
 	int result;
 
 	acpi_bus_get_device(handle, &device);
@@ -951,6 +948,10 @@ struct acpi_device *acpi_add_power_resou
 	resource->order = acpi_object.power_resource.resource_order;
 	resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
 
+	/* Get the initial state or just flip it on if that fails. */
+	if (acpi_power_get_state(resource, &state_dummy))
+		__acpi_power_on(resource);
+
 	pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device));
 
 	device->flags.match_driver = true;




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

* Re: [EXT] [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization
  2021-10-15 17:14 ` [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization Rafael J. Wysocki
@ 2021-10-18 10:40   ` Andreas K. Huettel
  2021-10-19 10:59     ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas K. Huettel @ 2021-10-18 10:40 UTC (permalink / raw)
  To: Linux ACPI, Rafael J. Wysocki; +Cc: LKML, Linux PCI, Linux PM, Mika Westerberg

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

Am Freitag, 15. Oktober 2021, 19:14:10 CEST schrieb Rafael J. Wysocki:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> To avoid situations in which the actual states of certain ACPI power
> resources are not known just because they have never been referenced
> by any device configuration objects, check the initial states of all
> power resources as soon as they are found in the ACPI namespace (and
> fall back to turning them on if the state check fails).
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> Andreas, please test this patch (on top of the [1/2]) and let me know
> if it works for you.
> 

I see no negative impact (actually, no impact at all) of the second
additional patch. The network card is again working fine now.

Boot logs (unpatched, with one patch, with both patches) at
https://dev.gentoo.org/~dilfridge/igb/  (the 5.14.12* files).

Best,
Andreas

-- 
PD Dr. Andreas K. Huettel
Institute for Experimental and Applied Physics
University of Regensburg
93040 Regensburg
Germany

tel. +49 151 241 67748 (mobile)
tel. +49 941 943 1618 (office)
e-mail andreas.huettel@ur.de
http://www.akhuettel.de/
http://www.physik.uni-r.de/forschung/huettel/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

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

* Re: [EXT] [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization
  2021-10-18 10:40   ` [EXT] " Andreas K. Huettel
@ 2021-10-19 10:59     ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2021-10-19 10:59 UTC (permalink / raw)
  To: Andreas K. Huettel
  Cc: Linux ACPI, Rafael J. Wysocki, LKML, Linux PCI, Linux PM,
	Mika Westerberg

On Mon, Oct 18, 2021 at 12:41 PM Andreas K. Huettel
<andreas.huettel@ur.de> wrote:
>
> Am Freitag, 15. Oktober 2021, 19:14:10 CEST schrieb Rafael J. Wysocki:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > To avoid situations in which the actual states of certain ACPI power
> > resources are not known just because they have never been referenced
> > by any device configuration objects, check the initial states of all
> > power resources as soon as they are found in the ACPI namespace (and
> > fall back to turning them on if the state check fails).
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >
> > Andreas, please test this patch (on top of the [1/2]) and let me know
> > if it works for you.
> >
>
> I see no negative impact (actually, no impact at all) of the second
> additional patch. The network card is again working fine now.
>
> Boot logs (unpatched, with one patch, with both patches) at
> https://dev.gentoo.org/~dilfridge/igb/  (the 5.14.12* files).

Thanks!

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

end of thread, other threads:[~2021-10-19 10:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 17:11 [PATCH v1 0/2] ACPI: PM: Fix up turning off unused power resources Rafael J. Wysocki
2021-10-15 17:12 ` [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state Rafael J. Wysocki
2021-10-15 17:14 ` [PATCH v1 2/2][RFT] ACPI: PM: Check states of power resources during initialization Rafael J. Wysocki
2021-10-18 10:40   ` [EXT] " Andreas K. Huettel
2021-10-19 10:59     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).