Check PCIe lane with lspci

When managing servers or desktops, knowing the details of your PCIe configuration can be very beneficial. This information is essential for troubleshooting hardware issues, upgrading components, or optimizing performance. One of the most powerful tools for examining PCIe details on Debian-based systems is lspci.

In this blog post, we’ll show you a quick command to check the PCIe lane configuration using lspci.

Using lspci to Check PCIe Lanes

The lspci command is a standard utility to list all PCI devices on your system. However, to get detailed information about PCIe lanes, you’ll need to use it with certain options and grep for specific fields.

Here’s the command you need:

1
lspci -vv | grep -P "[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]|LnkSta:"

Breaking Down the Command

  • lspci -vv: The -vv option tells lspci to be very verbose, providing detailed information about each PCI device.

  • grep -P "[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]|LnkSta:": This grep command uses a Perl-compatible regular expression. It searches for:

    • [0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]: This part matches the PCI address.
    • LnkSta:: This part searches for the link status, which includes the current PCIe lane configuration.

Example Output

Running this command, you might see output similar to the following:

1
2
3
4
00:1c.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f2)
LnkSta: Speed 2.5GT/s, Width x1
01:00.0 VGA compatible controller: NVIDIA Corporation GP107GL [Quadro P400] (rev a1)
LnkSta: Speed 8GT/s, Width x16

In the example above:

  • The PCI bridge at address 00:1c.0 operates at 2.5GT/s (Giga-transfers per second) and uses 1 lane.
  • The NVIDIA Quadro P400 at address 01:00.0 operates at 8GT/s and uses 16 lanes.

Why Is This Information Important?

Understanding the PCIe lane configuration is crucial for several reasons:

  1. Performance Optimization: Ensuring that high-performance devices, like GPUs, are connected via the correct number of PCIe lanes can significantly impact performance.

  2. Troubleshooting: Sometimes, hardware issues might be related to improper PCIe configurations or limitations.

  3. Upgrading Hardware: Knowing your system’s current PCIe configuration can help determine compatibility with new components.

Conclusion

Checking your PCIe lane configuration is a straightforward process with the lspci command. This information can be pivotal for optimizing performance, troubleshooting, and general hardware management.

If you have any further questions or if there’s a specific task you need help with, feel free to ask in the comments below. Happy computing, and may your system always run smoothly!