lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 30 Apr 2021 15:31:49 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Shujun Wang <wsj20369@....com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        David Box <david.e.box@...ux.intel.com>
Subject: Re: [PATCH] Revert "ACPI: power: Turn off unused power resources unconditionally"

On Fri, Apr 30, 2021 at 2:43 PM Shujun Wang <wsj20369@....com> wrote:
>
> This reverts commit 7e4fdeafa61f2b653fcf9678f09935e55756aed2.

OK, I'll revert that commit, thanks!

> It may cause some NVMe device probes to fail, and the system may get
> stuck when using an NVMe device as the root filesystem.
>
> In the function nvme_pci_enable(struct nvme_dev *dev), as shown below,
> readl(NVME_REG_CSTS) always returns -1 with the commit, which results in
> the probe failed.
>
>   if (readl(dev->bar + NVME_REG_CSTS) == -1) {
>         result = -ENODEV;
>         goto disable;
>   }
>
> dmesg:
>   [    1.106280] nvme 0000:04:00.0: platform quirk: setting simple suspend
>   [    1.109111] nvme nvme0: pci function 0000:04:00.0
>   [    1.113066] nvme 0000:04:00.0: enabling device (0000 -> 0002)
>   [    1.121040] nvme nvme0: Removing after probe failure status: -19
>
> lspci:
>   Non-Volatile memory controller: KIOXIA Corporation Device 0001
>
> device uevent:
>   DRIVER=nvme
>   PCI_CLASS=10802
>   PCI_ID=1E0F:0001
>   PCI_SUBSYS_ID=1E0F:0001
>   PCI_SLOT_NAME=0000:04:00.0
>   MODALIAS=pci:v00001E0Fd00000001sv00001E0Fsd00000001bc01sc08i02
>
> This patch was tested in Lenovo Thinkpad X1.
>
> Signed-off-by: Shujun Wang <wsj20369@....com>
> ---
>  drivers/acpi/power.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
> index 56102eaaa2da..8bf10abeb2e0 100644
> --- a/drivers/acpi/power.c
> +++ b/drivers/acpi/power.c
> @@ -1004,9 +1004,18 @@ void acpi_turn_off_unused_power_resources(void)
>         mutex_lock(&power_resource_list_lock);
>
>         list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
> +               int result, state;
> +
>                 mutex_lock(&resource->resource_lock);
>
> -               if (!resource->ref_count) {
> +               result = acpi_power_get_state(resource->device.handle, &state);
> +               if (result) {
> +                       mutex_unlock(&resource->resource_lock);
> +                       continue;
> +               }
> +
> +               if (state == ACPI_POWER_RESOURCE_STATE_ON
> +                   && !resource->ref_count) {
>                         dev_info(&resource->device.dev, "Turning OFF\n");
>                         __acpi_power_off(resource);
>                 }
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ