All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Linux PCI" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v1] ACPI: PM: Avoid initializing power management for absent devices
Date: Tue, 17 Nov 2026 16:04:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-219138@kernel.org> (raw)
In-Reply-To: <6047463.DvuYhMxLoT@rafael.j.wysocki>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ACPI: PM: acpi_bus_init_power() leaves absent devices
  power_manageable in unknown state
--

commit e1ff9e3263028781a317610ed251f6f169a95bfb
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

ACPI: PM: Avoid initializing power management for absent devices

This commit restores the device presence check in acpi_bus_init_power()
and updates find_child_checks() to reject absent devices rather than
disabled ones.

> diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
> index 76104f715efa1..8007a0d64bb5b 100644
> --- a/drivers/acpi/device_pm.c
> +++ b/drivers/acpi/device_pm.c
> @@ -360,6 +360,9 @@ int acpi_bus_init_power(struct acpi_device *device)
>  	if (device->power.state != ACPI_STATE_UNKNOWN)
>  		return 0;
>  
> +	if (!acpi_device_is_present(device))
> +		return -ENXIO;
> +
>  	/*
>  	 * The ACPI device power state can be only initialized once.  If this
>  	 * fails, ACPI power management will not be used for the device going

[Severity: High]
Does returning -ENXIO early here leave device->flags.power_manageable set
to 1 with device->power.state stuck at ACPI_STATE_UNKNOWN (0xff)?

acpi_bus_get_power_flags() sets power_manageable = 1 and power.state =
ACPI_STATE_UNKNOWN for any device with _PS0 or _PR0, and 2f4ddf2bd1ba
("ACPI: scan: Stop calling acpi_bus_init_power() early") stopped clearing
power_manageable when acpi_bus_attach() skips a non-present device.

When a physical PCI device is bound to a single matching _ADR companion
whose _STA reports not present (via check_one_child(), which bypasses
find_child_checks()), acpi_bus_attach() logs FW_BUG and falls through to
acpi_bus_init_power() without updating device->status:

drivers/acpi/scan.c:acpi_bus_attach() {
    ...
	pci = acpi_dev_get_pci_dev(device);
	if (pci) {
		if (!acpi_device_is_present(device))
			pci_info(pci, FW_BUG "ACPI status differs from reality\n");

		pci_dev_put(pci);
	} else if (!acpi_dev_ready_for_enumeration(device)) {
    ...
	acpi_bus_init_power(device);
}

With this early return, acpi_bus_init_power() fails without taking D0
power resource references or clearing power_manageable.  Because
acpi_pci_power_manageable() and acpi_bus_power_manageable() still see
power_manageable == 1, subsequent power transitions on the PCI companion
(or on absent _ADR-bound SATA/USB devices) call acpi_device_set_power(),
which fails with -ENODEV because state < device->power.state (0xff) is
always true.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/6047463.DvuYhMxLoT@rafael.j.wysocki?part=1

      parent reply	other threads:[~2026-11-17 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 15:32 [PATCH v1] ACPI: PM: Avoid initializing power management for absent devices Rafael J. Wysocki
2026-11-17 15:53 ` Alan Borzeszkowski
2026-11-17 16:04 ` sashiko-bot [this message]

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=sashiko-outbox-219138@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.