How to Diagnose and Fix PCIe Link Speed Downgrade in Linux

"Stability is the goal of IT operations, but anomalies are the daily reality."
Photo by Alin Gavriliuc / Unsplash

πŸš€

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


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 (bus c9, device 00.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.

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:
    1. Reboot and enter BIOS/UEFI (DEL, F2, or F12 during boot).
    2. Look for "PCIe Speed Settings" and set it to the highest available speed (e.g., Gen4 or Auto).

πŸ”Ή 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

πŸ”Ή 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

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


Read more