* [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
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
* Re: [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state
[not found] <3625109.kQq0lBPeGtkreacher>
@ 2021-10-24 15:28 ` linux-acpi
0 siblings, 0 replies; 2+ messages in thread
From: linux-acpi @ 2021-10-24 15:28 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-acpi
Hi,
My NVME drive was affected by the "turn off in unknown state" feature,
preventing my system from booting on 5.13 and above, while everything
worked fine on 5.12 and below. BTW, I'm really grateful that 5.13 used
`dev_info` intstead of `dev_dbg`, otherwise I wouldn't have had a chance
to track this down from comparing plain `dmesg` output alone.
I cooked up a different patch (before checking here), which takes the
comment removed by the patch in
https://marc.info/?l=linux-acpi&m=163431826227166
that _some system_ may truly need this at face value, and introduces
a command-line parameter that allows the current behavior by setting
'acpi=unknown_off', but allows my system to boot when that's omitted.
I have no idea if using a kernel parameter for such is OK or a no-no,
but I'll surely learn soon enough...
Regards,
--andrás
Alternative patch against 5.14.14 follows
==========================================================
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -30,6 +30,7 @@
extern int acpi_use_timer_override;
extern int acpi_fix_pin2_polarity;
extern int acpi_disable_cmcff;
+extern int acpi_unknown_off;
extern u8 acpi_sci_flags;
extern u32 acpi_sci_override_gsi;
@@ -138,6 +139,7 @@
#define acpi_lapic 0
#define acpi_ioapic 0
#define acpi_disable_cmcff 0
+#define acpi_unknown_off 0
static inline void acpi_noirq_set(void) { }
static inline void acpi_disable_pci(void) { }
static inline void disable_acpi(void) { }
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -52,6 +52,7 @@
int acpi_ioapic;
int acpi_strict;
int acpi_disable_cmcff;
+int acpi_unknown_off;
/* ACPI SCI override configuration */
u8 acpi_sci_flags __initdata;
@@ -1641,6 +1642,10 @@
/* "acpi=nocmcff" disables FF mode for corrected errors */
else if (strcmp(arg, "nocmcff") == 0) {
acpi_disable_cmcff = 1;
+ }
+ /* "acpi=unknown_off" turns off unused devices in unknown state */
+ else if (strcmp(arg, "unknown_off") == 0) {
+ acpi_unknown_off = 1;
} else {
/* Core will printk when we return error. */
return -EINVAL;
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -1033,6 +1033,7 @@
* power resources without any users unconditionally.
*/
if (!resource->ref_count &&
+ (acpi_unknown_off || resource->state != ACPI_POWER_RESOURCE_STATE_UNKNOWN) &&
resource->state != ACPI_POWER_RESOURCE_STATE_OFF) {
dev_dbg(&resource->device.dev, "Turning OFF\n");
__acpi_power_off(resource);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-24 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <3625109.kQq0lBPeGtkreacher>
2021-10-24 15:28 ` [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state linux-acpi
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox