How to Diagnose and Fix PCIe Link Speed Downgrade in Linux
π
When troubleshooting PCIe performance issues, one of the first steps is to check the PCIe link speed and lane width to ensure that a device is operating at its full potential. Using lspci
, we can examine whether a device is running at the expected speed and width or if it has been downgraded.
π In this guide, youβll learn:
β
How to check the PCIe link speed and width using lspci
β
How to interpret the output and identify link downgrades
β
Common reasons for PCIe speed degradation
β
How to troubleshoot and fix link speed issues
π 1. Checking PCIe Link Speed Using lspci
To check the PCIe link speed and width for a specific device, use:
lspci -vvvs c9:00.0 | grep -i speed
π Breaking down the command:
lspci
β Lists all PCI devices.-vvv
β Displays verbose device details.-s c9:00.0
β Specifies the PCI device (busc9
, device00.0
).| grep -i speed
β Filters the output to show only speed-related information.
π 2. Understanding the Output
Example Output:
LnkCap: Port #0, Speed 16GT/s, Width x4, ASPM L0s L1, Exit Latency L0 <512ns, L1 <16us
LnkSta: Speed 8GT/s (downgraded), Width x2 (downgraded)
LnkCtl2: Target Link Speed: 16GT/s, EnterCompliance- SpeedDis-
π Breaking down the output:
Field | Meaning |
---|---|
LnkCap | (Link Capability) Shows the maximum supported speed and lane width. This device is capable of 16GT/s and x4 width. |
LnkSta | (Link Status) Displays the actual operating speed and width. Here, the link has downgraded to 8GT/s and x2 width. |
LnkCtl2 | (Link Control 2) Indicates the target link speed. The system expects 16GT/s, but it is currently running at a lower rate. |
β οΈ 3. Why Is PCIe Link Speed Downgraded?
If your PCIe device is running at a lower speed or fewer lanes than expected, it could be due to several factors:
πΉ 1. PCIe Slot Limitations
- Some motherboards do not support full-speed PCIe on all slots.
- Solution: Check your motherboard manual and install the device in a higher-speed slot.
πΉ 2. BIOS/UEFI Settings
- Some BIOS settings limit PCIe speeds to reduce power consumption.
- Solution:
- Reboot and enter BIOS/UEFI (
DEL
,F2
, orF12
during boot). - Look for "PCIe Speed Settings" and set it to the highest available speed (e.g.,
Gen4
orAuto
).
- Reboot and enter BIOS/UEFI (
πΉ 3. PCIe Power Management (ASPM)
- Active State Power Management (ASPM) can reduce link speeds to save power.
Solution: Disable ASPM in Linux:
echo performance | sudo tee /sys/module/pcie_aspm/parameters/policy
πΉ 4. Firmware or Driver Issues
- Some devices may require specific firmware updates or drivers to run at full speed.
Solution: Update the kernel and drivers:
sudo apt update && sudo apt upgrade -y
πΉ 5. Faulty or Poor-Quality PCIe Cables/Risers
- If using a PCIe riser, a poor-quality riser can cause lane width reductions.
- Solution: Try reconnecting the device or using a higher-quality riser.
πΉ 6. Thermal Throttling
- Some PCIe devices reduce speed to prevent overheating.
Solution: Check the device temperature:
sensors
π οΈ 4. Fixing PCIe Link Downgrade Issues
πΉ Step 1: Check Your Motherboard Manual
Ensure the device is installed in a full-speed slot.
πΉ Step 2: Verify PCIe Power Settings
Disable PCIe power-saving mode:
sudo nano /etc/default/grub
Find:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=off"
Save the file and update GRUB:
sudo update-grub
sudo reboot
πΉ Step 3: Reset the PCIe Device
Reinitialize the PCIe device without rebooting:
echo 1 | sudo tee /sys/bus/pci/devices/0000:c9:00.0/remove
echo 1 | sudo tee /sys/bus/pci/rescan
πΉ Step 4: Manually Set PCIe Link Speed
If the issue persists, force the link speed:
sudo setpci -s c9:00.0 CAP_EXP+10.B=4
π This forces the link speed to Gen4 (16GT/s).
π 5. Summary
Issue | Possible Cause | Solution |
---|---|---|
PCIe speed lower than expected | Wrong slot placement | Install in a full-speed PCIe slot |
Link width is downgraded | Power-saving mode (ASPM) | Disable ASPM in BIOS/Linux |
Speed stuck at Gen3 (8GT/s) instead of Gen4 (16GT/s) | BIOS settings limiting speed | Change PCIe speed in BIOS to Auto or Gen4 |
Poor PCIe performance | Old drivers or firmware | Update kernel, drivers, and firmware |
Speed fluctuates | Thermal throttling | Improve cooling and monitor temperatures |
PCIe link width reduced (e.g., x4 β x2) | Bad riser or motherboard issue | Try reseating the card or using a different slot |
π¬ Join the Discussion!
Have you ever faced PCIe performance issues?
What troubleshooting steps did you use to fix them?
π¬ Share your experience in the comments below! π
π If you're troubleshooting Linux performance, check out: How to Check and Monitor Hard Drive Health Using SMART in Linux