Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8782044pxu; Sun, 27 Dec 2020 20:07:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIofa9WVJWiEsDCE1W4xATgCJ9D8r8/JFxglQyvJTsjZ/RR+BFHRn93SydKtRQJUh09dlc X-Received: by 2002:a05:6402:1386:: with SMTP id b6mr40693799edv.42.1609128463377; Sun, 27 Dec 2020 20:07:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609128463; cv=none; d=google.com; s=arc-20160816; b=gesyqhqBVQdAZNwB8+V6djUr9NW0m//xC2PKJObJ75zAYGNu46p9WbLkYH0mOfRRKO 6IvgZuQUPAVJ0Eb4wq3bbuUxIVUwBptmCGxnmQcZZcyOpEN2JJHnCwLAptfSil1+8/Av gJehwtTEXoUm1bNFOrSwJSlrFFo8eZbn3oRJRpJKBqGHUHIMoM85UMNmT1L9KD28bs1q 0Oitb+MXrByhKBv0bipj0RHIEvXKEJB3BcwAJTSANG9j6a3HvCrrpUXTTGiQslfW/W6N l5FI9fRk2SvlWi0KOENr6w3yt3vr7s4pf92GALNt2VrSDP6Uanug1Qw7U9bM0Rufy/Df 6DTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=A2Ld4X3OfPXrXkSbB6A2oTJbiYjlCpWek+YyoIa/nbw=; b=I3pP11MCnaFVvD2TYVK1ILVTrZn2agZZZZH2VQXqGBDlAe6yQ1sA8AEkDEvAFBT6Ep DBy1n52y2p+pnd4gyjTbU7Byh+eoxyMJBc4b0sbJkmh00ug2Mf7cRyfbbNz2F3TxXXux ltldXM/uHPmpyqU9lYvnVpiTcsDM0CWBnDhiNxLofWZmmsoDJ7jfkJU/tZI7oo96GXQ4 I22nA/N061BptKN0YwrlOnO7GzeIcOKgSc3s3TVeAMzm2OTezJgK62X8yYxnfIb2Sx0j Z2vpyuqj/o0NLbdAw7Cfqtl7CnxR4whe/0ibMz6WXurF4qXFT7qDYxgdEJY4P72MigSj USKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yd7HBr0Z; 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 cx27si15502561edb.264.2020.12.27.20.07.19; Sun, 27 Dec 2020 20:07:43 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yd7HBr0Z; 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 S1726292AbgL1EF5 (ORCPT + 99 others); Sun, 27 Dec 2020 23:05:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:46410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgL1EF5 (ORCPT ); Sun, 27 Dec 2020 23:05:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 180E8206D4; Mon, 28 Dec 2020 04:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609128316; bh=MdjD7BH+41KU7Oxxv0Urq2PeP/eYK+mpFjsS8iyMIHo=; h=Date:From:To:Cc:Subject:From; b=Yd7HBr0ZBUEp/nRAC1TCrR02b2boWh7wSdnwYTFz1kjS2TZkVhHYBClyzzRPiTy74 XOgC6LrxYEO1gzprhBfOqMXENxFl2kq8T+0hDqZj/OhRkA9ETsHnpFuvzVHx3AozAA blq1yhrkjPFgRD1/GphflJFFq79laiaOgSTQ2XmSg7hITM8cUQ43WJpR/IPl0e0s/w GKcLRgn1d2r+zbkOv3OomZra5vGy0qmbpblqO1v5F1P7UkY2IyaitYE0Xq/2AY0KH9 Mqw5E89rf/a8SpFaoqmPfBBL798GCPZsOvCfOUBRoIMIEKA9nylSVgvF2y/rtNGpBr Phvuf1ee1KF2w== Date: Sun, 27 Dec 2020 22:05:13 -0600 From: Bjorn Helgaas To: "Kenneth R. Crudup" Cc: Vidya Sagar , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Commit 4257f7e0 ("PCI/ASPM: Save/restore L1SS Capability for suspend/resume") causing hibernate resume failures Message-ID: <20201228040513.GA611645@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Kenneth R. Crudup > > I've been running Linus' master branch on my laptop (Dell XPS 13 > 2-in-1). With this commit in place, after resuming from hibernate > my machine is essentially useless, with a torrent of disk I/O errors > on my NVMe device (at least, and possibly other devices affected) > until a reboot. > > I do use tlp to set the PCIe ASPM to "performance" on AC and > "powersupersave" on battery. Thanks a lot for the report, and sorry for the breakage. 4257f7e008ea restores PCI_L1SS_CTL1, then PCI_L1SS_CTL2. I think it should do those in the reverse order, since the Enable bits are in PCI_L1SS_CTL1. It also restores L1SS state (potentially enabling L1.x) before we restore the PCIe Capability (potentially enabling ASPM as a whole). Those probably should also be in the other order. If it's convenient, can you try the patch below? If the debug patch doesn't help: - Are you seeing the hibernate/resume problem when on AC or on battery? - What if you don't use tlp? Does hibernate/resume work fine then? If tlp makes a difference, can you collect "sudo lspci -vv" output with and without using tlp (before hibernate)? - If you revert 4257f7e008ea, does hibernate/resume work fine? Both with the tlp tweak and without? - Collect "sudo lspci -vv" output before hibernate and (if possible) after resume when you see the problem. I guess tlp only uses /sys/module/pcie_aspm/parameters/policy, so it sets the same ASPM policy system-wide. Bjorn diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b9fecc25d213..6598b5cd3154 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1665,9 +1665,8 @@ void pci_restore_state(struct pci_dev *dev) * LTR itself (in the PCIe capability). */ pci_restore_ltr_state(dev); - pci_restore_aspm_l1ss_state(dev); - pci_restore_pcie_state(dev); + pci_restore_aspm_l1ss_state(dev); pci_restore_pasid_state(dev); pci_restore_pri_state(dev); pci_restore_ats_state(dev); diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index a08e7d6dc248..c4a99274b4bb 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -752,8 +752,8 @@ void pci_save_aspm_l1ss_state(struct pci_dev *dev) return; cap = (u32 *)&save_state->cap.data[0]; - pci_read_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL1, cap++); pci_read_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL2, cap++); + pci_read_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL1, cap++); } void pci_restore_aspm_l1ss_state(struct pci_dev *dev) @@ -774,8 +774,8 @@ void pci_restore_aspm_l1ss_state(struct pci_dev *dev) return; cap = (u32 *)&save_state->cap.data[0]; - pci_write_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL1, *cap++); pci_write_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL2, *cap++); + pci_write_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL1, *cap++); } static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val)