All of lore.kernel.org
 help / color / mirror / Atom feed
From: linux-acpi@andraxin.se
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-acpi@vger.kernel.org
Subject: Re: [PATCH v1 1/2] ACPI: PM: Do not turn off power resources in unknown state
Date: Sun, 24 Oct 2021 17:28:50 +0200	[thread overview]
Message-ID: <YXV7srrMqWK4XagI@eleven> (raw)
In-Reply-To: <3625109.kQq0lBPeGtkreacher>

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);

       reply	other threads:[~2021-10-24 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3625109.kQq0lBPeGtkreacher>
2021-10-24 15:28 ` linux-acpi [this message]
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

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=YXV7srrMqWK4XagI@eleven \
    --to=linux-acpi@andraxin.se \
    --cc=linux-acpi@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.