Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PCI/ASPM] Revert commit 456d8aa to avoid kernel panics in 6.1.94 #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions patch/revert-456d8aa-to-fix-pcie_aspm_exit_link_status.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nathan Wolfe <[email protected]>
Date: Tue, 8 Oct 2024 11:57:26 -0700
Subject: [PATCH] revert 456d8aa to fix pcie_aspm_exit_link_status

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a summary, and also a reference to the upstream discussion.

https://github.com/torvalds/linux/commit/456d8aa37d0f56fc9e985e812496e861dcd6f2f2
---
drivers/pci/pcie/aspm.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index cf4acea66..188517c5a 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1025,24 +1025,21 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)

down_read(&pci_bus_sem);
mutex_lock(&aspm_lock);
+ /*
+ * All PCIe functions are in one slot, remove one function will remove
+ * the whole slot, so just wait until we are the last function left.
+ */
+ if (!list_empty(&parent->subordinate->devices))
+ goto out;

link = parent->link_state;
root = link->root;
parent_link = link->parent;

- /*
- * link->downstream is a pointer to the pci_dev of function 0. If
- * we remove that function, the pci_dev is about to be deallocated,
- * so we can't use link->downstream again. Free the link state to
- * avoid this.
- *
- * If we're removing a non-0 function, it's possible we could
- * retain the link state, but PCIe r6.0, sec 7.5.3.7, recommends
- * programming the same ASPM Control value for all functions of
- * multi-function devices, so disable ASPM for all of them.
- */
+ /* All functions are removed, so just disable ASPM for the link */
pcie_config_aspm_link(link, 0);
list_del(&link->sibling);
+ /* Clock PM is for endpoint device */
free_link_state(link);

/* Recheck latencies and configure upstream links */
@@ -1050,7 +1047,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
pcie_update_aspm_capable(root);
pcie_config_aspm_path(parent_link);
}
-
+out:
mutex_unlock(&aspm_lock);
up_read(&pci_bus_sem);
}
4 changes: 4 additions & 0 deletions patch/series
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ cisco-npu-disable-other-bars.patch
# Micas patches
0001-fix-os-crash-caused-by-optoe-when-class-switch.patch

# Fix to avoid kernel panic on Kernel 6.1.94
# https://github.com/sonic-net/sonic-buildimage/issues/20901
revert-456d8aa-to-fix-pcie_aspm_exit_link_status.patch

#
#
############################################################
Expand Down