Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp565389pxv; Fri, 9 Jul 2021 04:25:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoqvSui5kaOu5oPs+aTXtUHRaNBc/aEdgTCppr1ph540YGOvX4y6Dlm9AD9D67/uy7JrAp X-Received: by 2002:a17:906:3e8a:: with SMTP id a10mr36577771ejj.479.1625829931576; Fri, 09 Jul 2021 04:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625829931; cv=none; d=google.com; s=arc-20160816; b=UqT5bb7tY9v3L0wVW/UrHxvv5PVxIefSNlSK0Byyac9PCHjuD5+ucWQiuMJvmdBwrt l84ijj+7LT1jAkNBfeqvLUY3+7tdTMAS0jLTHdlLRv8iJf3tRf71Df9HIIKSd1IMdIg0 o1AJ1dZeLKG9aGDo2Rr9s6nE0Cft7YXwEi1ME8BhxOEKOsQSsGj82rQeUnED3/NLB98/ fesXvk8AHvzKLwvM2CDQf3ZLdp0RqQNsWOWbX1UNnWQAXpg+gvPlIKoglAYRlRMkAyzZ khSDnUWs+oakmUN725KBvhiemQi3eSlUrhO1m3aur8cHOI1XzxVT6AmMCLA3XodTYUGp oy6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=pJBfn8KrookS9VA95B+AE2i8GXpFZrKK3T2F0bIumXM=; b=UeOjFhp9EbOMV9+n6I/fyndHBaP2eIN6yyuCoZBFJKHgNIUuBAsDxZg9uwektN4k9W sF9ChwbmbKDZBAi5pVfdbsaOkGKXZQb3Mj22MLcrk5jjBrmDkiuN1jh1kamNegd1lXKx qcH416RW1pnPHqtV4+1E6+2POtO0c1fKbYRPIzVrS21CAv7ELWFNlTJPx+puHSgeQljd JFItG9FrPVsM4HMvAFQTPjL8H9E9cGfMY8K3VHFE2on9wWw/YSTlquxHIf90E7GFHpEY m0wx4ycqLkAlW+yHgIpddcl4burlXhV2YWSOaqtAsMxERaniCth6h5XCk8T2t+b6Ibdo tefw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si6875285edd.315.2021.07.09.04.25.07; Fri, 09 Jul 2021 04:25:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbhGILYH (ORCPT + 99 others); Fri, 9 Jul 2021 07:24:07 -0400 Received: from mail-oi1-f180.google.com ([209.85.167.180]:33338 "EHLO mail-oi1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbhGILYF (ORCPT ); Fri, 9 Jul 2021 07:24:05 -0400 Received: by mail-oi1-f180.google.com with SMTP id s17so11888814oij.0; Fri, 09 Jul 2021 04:21:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pJBfn8KrookS9VA95B+AE2i8GXpFZrKK3T2F0bIumXM=; b=aRc+NklbSTsnfQpicbSPgqTYz7uxH4Q8uLRJtUa32G54awU6QbaW2vgeUK8UvhQ90J MCSR0f4lYd9d6vZE+AjP4dflHDTq4VbmFDRNs690cQb0Tm+CQ5cfDAdXF+kvdhTokx4+ DhaYOncmRGQ4X8IsOUJt0w6kDg8B++en/su8IfnOBVqj03yipqbg67qWWlKp7GRQauNb 2Z72AY1X0vW+jEQkTWrLjl5U6nr66hm6EQ84me9bmqbXJnOUylwQnbhfytAiAHhajecV N996kkk7wKMfbxEkja3FNfh4iDi5i/1PCNIpc8NOQBxxxd+SxcrY8Gs47DORuf1crdK8 ljUw== X-Gm-Message-State: AOAM53391wvwXp7Pz6saGQCmMj6BhrJ9dbJX5vchZzi3b7zSsXQ+7Lp2 IKEGwLKE0lxSYGpjlo0juyzzdXoBybK2/pkjWUE= X-Received: by 2002:aca:c457:: with SMTP id u84mr17485471oif.69.1625829681556; Fri, 09 Jul 2021 04:21:21 -0700 (PDT) MIME-Version: 1.0 References: <4327888.LvFx2qVVIh@kreacher> <5327028b-6e0b-e83c-b147-da083a23634c@gmail.com> In-Reply-To: <5327028b-6e0b-e83c-b147-da083a23634c@gmail.com> From: "Rafael J. Wysocki" Date: Fri, 9 Jul 2021 13:21:09 +0200 Message-ID: Subject: Re: [PATCH][RFT] PCI: Use pci_update_current_state() in pci_enable_device_flags() To: Maximilian Luz Cc: "Rafael J. Wysocki" , Linux PCI , LKML , Linux PM , Bjorn Helgaas , Mika Westerberg Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 8, 2021 at 10:34 PM Maximilian Luz wrote: > > On 7/8/21 3:25 PM, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > Updating the current_state field of struct pci_dev the way it is done > > in pci_enable_device_flags() before calling do_pci_enable_device() may > > not work. For example, if the given PCI device depends on an ACPI > > power resource whose _STA method initially returns 0 ("off"), but the > > config space of the PCI device is accessible and the power state > > retrieved from the PCI_PM_CTRL register is D0, the current_state > > field in the struct pci_dev representing that device will get out of > > sync with the power.state of its ACPI companion object and that will > > lead to power management issues going forward. > > > > To avoid such issues, make pci_enable_device_flags() call > > pci_update_current_state() which takes ACPI device power management > > into account, if present, to retrieve the current power state of the > > device. > > > > Link: https://lore.kernel.org/lkml/20210314000439.3138941-1-luzmaximilian@gmail.com/ > > Reported-by: Maximilian Luz > > Signed-off-by: Rafael J. Wysocki > > --- > > > > Hi Maximilian, > > > > Because commit 4514d991d992 ("PCI: PM: Do not read power state in > > pci_enable_device_flags()"), the issue addressed by it is back, so > > we need an alternative way to address it. > > > > Can you please check if this patch makes that issue go away? > > Hi, > > just tested this on v5.13 and it works, thanks! Feel free to add > > Tested-by: Maximilian Luz Thank you!