Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3069174pxv; Mon, 12 Jul 2021 08:34:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoUQP08RPUpZFyCJDCWLLg3j9KZ6nNp97EeSbZNko04NxumLzaHIBarmWJwVMIjsZneQ1Q X-Received: by 2002:aa7:d554:: with SMTP id u20mr65780700edr.50.1626104066717; Mon, 12 Jul 2021 08:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626104066; cv=none; d=google.com; s=arc-20160816; b=eVft6ALv3zdXm8lKS8551QbZjuGwuF8VvLHouICnY3Y4LxsfbMWhHRsZxnu0WX3gax /6+gVp1ZoTTyI2wLYq3OWnnmi4sjaf7gFulA9N+NIaCtHhcMvJA43ng2Lx2No/1bmivb Og/2jHRH5GAKdCwrCDpzTs2B36Epi62ITBvs44JpuzydcV5QeYXMqGxW8iaTfnq6mz9C OCz+eZ8p8ozgrKqprLDNTG2EUjPke8GOnVl22Pr+e1QZbE5UIsdH5Iq74FIHrwS+HDca YqRjw9nzSupd8FrpwK177B/B/iCjmc9lYfJXzaHpODslPszuS2upitLVNnIfd3RJPUSi ubAg== 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=cIcjLpM0TOpXZTd92NOgPEpW4iOJiRiNmUMPa8oLMG8=; b=CyT2jSN2PccIebYCAEHTqQ6Rzl/g15KrTrTPn0+GMThmHqhnPscdyY6XB0VgDLxwHw YT3kZkqsm1pbaxKYBsdnjOdQgmf2snXJaG2rqUu2RDlb5fSvjo1MN07HFAIvw/zS9H54 cpQkHgAKY20eV5gdqYNyuM97ZfLZE6XE6vFM76Km+c2/i48Fo3JL+4zDT91u7pLzFqip 3HmDVCMbFDP6iKpC1YQpQsXoHh8mZ/VlwBIhCAFhE5GSLOFUA7dSGcjjcB4NAQtss6d2 QybL3t15RqdELfAZJQqq8v7TwXqCWacubbwVuSHHJNnjGYsSzGb62IYPrBJiP5KSYtrP G0wQ== 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 26si16109329ejk.553.2021.07.12.08.34.03; Mon, 12 Jul 2021 08:34:26 -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 S235455AbhGLPdI (ORCPT + 99 others); Mon, 12 Jul 2021 11:33:08 -0400 Received: from mail-ot1-f41.google.com ([209.85.210.41]:44560 "EHLO mail-ot1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234676AbhGLPdF (ORCPT ); Mon, 12 Jul 2021 11:33:05 -0400 Received: by mail-ot1-f41.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so19225004otq.11; Mon, 12 Jul 2021 08:30:16 -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=cIcjLpM0TOpXZTd92NOgPEpW4iOJiRiNmUMPa8oLMG8=; b=hRYtu88Uj6zLgLFEge+NF62ZR8FTddxvs/Dx+/7tBY9TnX2o41sMRhjFw8p/LL8WP3 hwTfZqp8qzxRgjrQTUNjM/6SNXNutsjt8jQKnaRMbXLxP3Onx0ce/drdIqiNkbPH+rK7 0sxJEzJ9ofFV2AVn/VOm2A1IDNW2x75tmrrow0PcvCZoY6+vTYtO7co9s4bAbauN8QyL bTE+SFWFWPsOc1baiRYmAQDGxwKtxxBzeCrV3DoinKrPgVbFu1pkRf3vERiE7WD7YCTT 3Qra0G5bPjDyNLi+37OZJ74Vw/xpBE+QAPSKpsBq1DKDiZcPZtok4Hs5uPeiHT6mX/fo vDkQ== X-Gm-Message-State: AOAM532Yu9IQsdXQfXMl7ZctVzzspRe1hMeNl84P2D6bo4jL6HYZSYPQ tYJlT5XpLb4X8rxWfhl5Oa3bGjcWBOHvB60CF7Y= X-Received: by 2002:a9d:604e:: with SMTP id v14mr41175279otj.260.1626103815664; Mon, 12 Jul 2021 08:30:15 -0700 (PDT) MIME-Version: 1.0 References: <4327888.LvFx2qVVIh@kreacher> <5327028b-6e0b-e83c-b147-da083a23634c@gmail.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 12 Jul 2021 17:30:04 +0200 Message-ID: Subject: Re: [PATCH][RFT] PCI: Use pci_update_current_state() in pci_enable_device_flags() To: Michael Cc: Maximilian Luz , "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 Fri, Jul 9, 2021 at 1:21 PM Rafael J. Wysocki wrote: > > 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 Michael, Salvatore, since this alternative to commit 4514d991d992 works for Maximilian, I'm going to queue it up for 5.15 (barring any objections from Bjorn), so I would appreciate it if you could test it and let me know whether or not there were any problems with it. The patch can be downloaded from https://patchwork.kernel.org/project/linux-pm/patch/4327888.LvFx2qVVIh@kreacher Thanks!