From: sashiko-bot@kernel.org
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 2/4] ACPI: scan: Stop calling acpi_bus_init_power() early
Date: Thu, 03 Sep 2026 17:24:37 +0000 [thread overview]
Message-ID: <20260903172437.CB90B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <2295263.irdbgypaU6@rafael.j.wysocki>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Non-power-manageable devices are incorrectly left in `ACPI_STATE_D0` instead of inheriting their parent's power state, breaking the non-recursive power state hierarchy.
--
commit 1b9c3462d28f35e1a6f47e065a29b14b3971db3a
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: ACPI: scan: Stop calling acpi_bus_init_power() early
This commit stops calling acpi_bus_init_power() from
acpi_bus_get_power_flags() to prevent devices with missing dependencies
from being put into D0 prematurely. It introduces a separate invocation
during PCI device initialization and uses ACPI power state tracking to
decide when to initialize a device's power state.
Link: https://lore.kernel.org/linux-acpi/20260820-acpi-power-resource-ref-fix-v2-1-29818173ea13@linux.spacemit.com/
> diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
> index 4269735aadde5..76104f715efa1 100644
> --- a/drivers/acpi/device_pm.c
> +++ b/drivers/acpi/device_pm.c
[ ... ]
> @@ -340,9 +346,36 @@ int acpi_bus_init_power(struct acpi_device *device)
> state = ACPI_STATE_D0;
> }
> device->power.state = state;
> +
> + acpi_handle_debug(device->handle, "Initial power state: %s\n",
> + acpi_power_state_string(state));
> +
> return 0;
> }
>
> +int acpi_bus_init_power(struct acpi_device *device)
> +{
> + int result;
> +
> + if (device->power.state != ACPI_STATE_UNKNOWN)
> + return 0;
[Severity: High]
Does this check prevent non-PM devices from ever executing
acpi_device_init_power()?
In acpi_add_single_object(), struct acpi_device is zero-initialized, which
defaults device->power.state to 0 (ACPI_STATE_D0). If a non-PM device skips
the ACPI_STATE_UNKNOWN assignment in acpi_bus_get_power_flags(), this early
return will silently freeze its state at D0 instead of letting it inherit
its parent's power state.
> +
> + /*
> + * The ACPI device power state can be only initialized once. If this
> + * fails, ACPI power management will not be used for the device going
> + * forward.
> + */
> + result = acpi_device_init_power(device);
[ ... ]
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index f48715ed827c7..f219a16e018a4 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
[ ... ]
> @@ -1145,8 +1146,7 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
> device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
> }
>
> - if (acpi_bus_init_power(device))
> - device->flags.power_manageable = 0;
> + device->power.state = ACPI_STATE_UNKNOWN;
[Severity: High]
Will non-power-manageable devices be incorrectly left in ACPI_STATE_D0
because of this new assignment's placement?
Earlier in acpi_bus_get_power_flags(), the code returns early for non-PM
devices:
/* Presence of _PS0|_PR0 indicates 'power manageable' */
if (!acpi_has_method(device->handle, "_PS0") &&
!acpi_has_method(device->handle, "_PR0"))
return;
Because this early return happens before the assignment to
ACPI_STATE_UNKNOWN, non-PM devices bypass it and retain their
zero-initialized D0 state.
Can this break the non-recursive ACPI power state hierarchy check?
If intermediate non-PM devices are left in D0, a PM-capable child device
might be incorrectly allowed to power up to D0 even if its grandparent is
physically powered off (D3_COLD). This could lead to bus errors or system
crashes when the child attempts to access powered-off hardware.
--
Sashiko AI review · https://sashiko.dev/#/patchset/6044499.DvuYhMxLoT@rafael.j.wysocki?part=2
next prev parent reply other threads:[~2026-09-03 17:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 16:57 [PATCH v3 0/4] ACPI: scan: Adjust power management initialization and PCI devices handling Rafael J. Wysocki
2026-09-03 16:58 ` [PATCH v3 1/4] ACPI: PM: Drop parent state update from acpi_device_get_power() Rafael J. Wysocki
2026-09-03 17:19 ` sashiko-bot
2026-09-03 17:05 ` [PATCH v3 2/4] ACPI: scan: Stop calling acpi_bus_init_power() early Rafael J. Wysocki
2026-09-03 17:24 ` sashiko-bot [this message]
2026-09-03 18:14 ` Rafael J. Wysocki (Intel)
2026-09-03 17:06 ` [PATCH v3 3/4] ACPI: PM: Move acpi_bus_init_power() declaration to internal header file Rafael J. Wysocki
2026-09-03 17:13 ` sashiko-bot
2026-09-03 17:09 ` [PATCH v3 4/4] ACPI: scan: Combine two conditionals in acpi_bus_attach() Rafael J. Wysocki
2026-09-03 17:13 ` sashiko-bot
2026-09-04 9:40 ` [PATCH v3 0/4] ACPI: scan: Adjust power management initialization and PCI devices handling Peixin Xie
2026-09-04 10:04 ` Rafael J. Wysocki (Intel)
2026-09-07 21:34 ` Sakari Ailus
2026-09-08 20:19 ` Rafael J. Wysocki (Intel)
2026-09-08 20:26 ` Rafael J. Wysocki (Intel)
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=20260903172437.CB90B1F000E9@smtp.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.