Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6832227rdb; Tue, 2 Jan 2024 15:34:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ5RVNkHqUSdyee5/OVxadKfyQnbri8nMetH1Ke8oRrhq7bjs6bCmF8uM0mS0R2ed0HE83 X-Received: by 2002:a17:906:a1cc:b0:a26:b1a5:a665 with SMTP id bx12-20020a170906a1cc00b00a26b1a5a665mr6308451ejb.35.1704238442466; Tue, 02 Jan 2024 15:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704238442; cv=none; d=google.com; s=arc-20160816; b=N0QrZx6nkTm/blbnNpiuc9AEMQVnVExf5jG1sYZ87gPSK6i/YOV5Jpc88sqAMRyfpv bRNtn58fiW8KLg7ztOauAhnJ6OOEfijDzb0g/CsOpk8i4+X0WvSlsEIUe5JE6DF7s09J ovtqkqvFVFdWiJqwt3Flj8mC7nOkU/luLdOumEbKB1FrjMn8QVlwyTMQjPSMHybYtZ6X JH9W3c8ixC2vIVFwQFot6BSB9TI0fSgHnvav62I6VY1LaO+dKeJ9IB31QiWaPSGhi9O+ dOjAjIK2AJ64S1jB39lt6tES+gOloAyPwNSb2bibkMEbtTI0GtMUsc/2goM9ZsVeBfTM yAfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Ku4PKV7kziApmw4FmyPXHO5c22jdnk+OKYutyEMZA0Q=; fh=cy0E4DWElPs3G8DhC1/kSK1pxyEoJE1ce94tm6QuSGE=; b=rfsXgUzBfrKmJgwYm4ZpGFWsSotGCxcuwFAY2JcvDX49zl/EfI71arp//n8PAJlIDX tHIRelO6pgsnjs+WoAJ7Ap+TzapA+FoV6zTkboN74FzdSQma4kwY1hnmwIvswDT4yh8K /UA+I6lzutkayoONgbecoCWNQIcemq9B95nau65EuGQR7cru87FAs2/I8KpoJb25a5Tf Nv/LEA3Kgt6dQG2t8kOpMTH28nLcZYeybm+qqxwYsVBuWghDtKL5g1j1npHziZ2UOEKr nywzV9D6d5vzyw/p4Ho7oPOFK9eAbJqNOmCEGoiqESaIal8pqlhu3DMJgg0IKAFQhoYe 4I1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=T0PE5hAi; spf=pass (google.com: domain of linux-kernel+bounces-14974-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14974-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ez21-20020a1709070bd500b00a26d8457addsi8420293ejc.295.2024.01.02.15.34.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 15:34:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14974-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=T0PE5hAi; spf=pass (google.com: domain of linux-kernel+bounces-14974-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14974-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 300901F23568 for ; Tue, 2 Jan 2024 23:34:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1D621775F; Tue, 2 Jan 2024 23:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="T0PE5hAi" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 465CE17982; Tue, 2 Jan 2024 23:33:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704238434; x=1735774434; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=hmnREbkJ1spni6quDzIEHXCaQXW3TktM92/lBSG23sI=; b=T0PE5hAiC4Xewm3C6culXzxpzHV4YvDgFq+hdbaV96FzOPk8/5HG2Iqn wvVF3Jb/0vjfdd/96jASXHAO1UFuk4jk/rFOE2OOOsiMOHc9SlE6Oik+v TzGS1yxcd8RXTc+/6i8ZJZK7ZyxMEqVssL9aEo412uRSyeCRCUYF7xB18 FiECVJZ+1uWX2KwazMLLoqJDmZ4L7Jm4KP3KZ0bw3zuuSKcTXc0vQrT/a d20aWBLYm8gWam0iYuTBcHGmbFbl0pvUY/NvZExfny7yB6Ae+yPQii8Pn /wVvNTojt/jWFmFeoB36NceFxnZ3uM3t2ZlY4Q03k8IxiXL7boRdnlrQ0 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="3769991" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="3769991" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 15:33:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111182255" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="1111182255" Received: from keithj1-mobl2.amr.corp.intel.com (HELO [10.209.44.31]) ([10.209.44.31]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 15:33:51 -0800 Message-ID: <20cd835e-f84c-4c43-812e-6706f7266150@linux.intel.com> Date: Tue, 2 Jan 2024 15:33:51 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Revert "PCI/ASPM: Remove pcie_aspm_pm_state_change()" Content-Language: en-US To: Bjorn Helgaas , Michael Schaller , Kai-Heng Feng Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, regressions@lists.linux.dev, "Maciej W . Rozycki" , Ajay Agarwal , Greg Kroah-Hartman , Heiner Kallweit , Johan Hovold , Bjorn Helgaas , stable@vger.kernel.org References: <76c61361-b8b4-435f-a9f1-32b716763d62@5challer.de> <20240102232550.1751655-1-helgaas@kernel.org> From: Kuppuswamy Sathyanarayanan In-Reply-To: <20240102232550.1751655-1-helgaas@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/2/2024 3:25 PM, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > This reverts commit 08d0cc5f34265d1a1e3031f319f594bd1970976c. > > Michael reported that when attempting to resume from suspend to RAM on ASUS > mini PC PN51-BB757MDE1 (DMI model: MINIPC PN51-E1), 08d0cc5f3426 > ("PCI/ASPM: Remove pcie_aspm_pm_state_change()") caused a 12-second delay > with no output, followed by a reboot. > > Workarounds include: > > - Reverting 08d0cc5f3426 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()") > - Booting with "pcie_aspm=off" > - Booting with "pcie_aspm.policy=performance" > - "echo 0 | sudo tee /sys/bus/pci/devices/0000:03:00.0/link/l1_aspm" > before suspending > - Connecting a USB flash drive > Did you find the root cause? Is this issue specific to that particular device? If yes, can we do a quirk? > Fixes: 08d0cc5f3426 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()") > Reported-by: Michael Schaller > Link: https://lore.kernel.org/r/76c61361-b8b4-435f-a9f1-32b716763d62@5challer.de > Signed-off-by: Bjorn Helgaas > Cc: > --- > drivers/pci/pci.c | 6 ++++++ > drivers/pci/pci.h | 2 ++ > drivers/pci/pcie/aspm.c | 19 +++++++++++++++++++ > 3 files changed, 27 insertions(+) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 55bc3576a985..bdbf8a94b4d0 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -1335,6 +1335,9 @@ static int pci_set_full_power_state(struct pci_dev *dev) > pci_restore_bars(dev); > } > > + if (dev->bus->self) > + pcie_aspm_pm_state_change(dev->bus->self); > + > return 0; > } > > @@ -1429,6 +1432,9 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state) > pci_power_name(dev->current_state), > pci_power_name(state)); > > + if (dev->bus->self) > + pcie_aspm_pm_state_change(dev->bus->self); > + > return 0; > } > > diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h > index 5ecbcf041179..f43873049d52 100644 > --- a/drivers/pci/pci.h > +++ b/drivers/pci/pci.h > @@ -569,10 +569,12 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt); > #ifdef CONFIG_PCIEASPM > void pcie_aspm_init_link_state(struct pci_dev *pdev); > void pcie_aspm_exit_link_state(struct pci_dev *pdev); > +void pcie_aspm_pm_state_change(struct pci_dev *pdev); > void pcie_aspm_powersave_config_link(struct pci_dev *pdev); > #else > static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { } > static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { } > +static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { } > static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { } > #endif > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > index 50b04ae5c394..8715e951c491 100644 > --- a/drivers/pci/pcie/aspm.c > +++ b/drivers/pci/pcie/aspm.c > @@ -1008,6 +1008,25 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev) > up_read(&pci_bus_sem); > } > > +/* @pdev: the root port or switch downstream port */ > +void pcie_aspm_pm_state_change(struct pci_dev *pdev) > +{ > + struct pcie_link_state *link = pdev->link_state; > + > + if (aspm_disabled || !link) > + return; > + /* > + * Devices changed PM state, we should recheck if latency > + * meets all functions' requirement > + */ > + down_read(&pci_bus_sem); > + mutex_lock(&aspm_lock); > + pcie_update_aspm_capable(link->root); > + pcie_config_aspm_path(link); > + mutex_unlock(&aspm_lock); > + up_read(&pci_bus_sem); > +} > + > void pcie_aspm_powersave_config_link(struct pci_dev *pdev) > { > struct pcie_link_state *link = pdev->link_state; -- Sathyanarayanan Kuppuswamy Linux Kernel Developer