如何根据PCIE总线编号定位出错设备

2022年3月23日18:38:14 评论 3,394

通过ipmitool排查机器故障原因时,往往会提示出错的PCIE总线编号,这时候我们就需要根据这串编号找出对应的出错设备

 Critical Interrupt PCIE Fatal Err | Bus Fatal Error ( PCI bus:08 device:00 function:0) | Asserted
 Critical Interrupt PCIE Fatal Err | Bus Fatal Error ( PCI bus:00 device:1c function:7) | Asserted

在PCI或者说PCIe里,每个设备有三个编号:总线编号(Bus Number)、设备编号(Device Number)和功能编号(Function Number),那么对应上面的00:1c.7来说:这个设备的BusNumber是00,DeviceNumber是1c,FunctionNumber是7,需要说明的是这三个都是16进制表示,有些配置里需要填十进制数的,需要做下转换。

明白了前面的编号之后,还有一个疑问,就是要怎么才能知道00:1c.7这个编号对应哪个设备。

lspci这个工具就该出场了,用来查看当前系统连接的所有PCI/PCIe设备

一、确定出错设备

# lspci -nn | grep "00:1c.7"
00:1c.7 PCI bridge [0604]: Intel Corporation C600/X79 series chipset PCI Express Root Port 8 [8086:1d1e] (rev b5)

其中前面的[0604]表示了当前设备的DeviceClass,也就是设备类型,而后面的[8086:1d1e]代表的就是设备的VendorID和DeviceID,lspci命令会默认尝试读取/usr/share/hwdata/pci.ids.gz和/usr/share/hwdata/pci.ids文件,利用DeviceClass、VendorID:DeviceID去匹配相应的设备

二、获取出错总线的具体信息

# lspci -s 00:1c.7 -v                                                                                                                                                                          
00:1c.7 PCI bridge: Intel Corporation C600/X79 series chipset PCI Express Root Port 8 (rev b5) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=08, subordinate=0c, sec-latency=0
        Memory behind bridge: de000000-df7fffff
        Prefetchable memory behind bridge: 00000000d8000000-00000000d8ffffff
        Capabilities: [40] Express Root Port (Slot-), MSI 00
        Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Dell Device 04ce
        Capabilities: [a0] Power Management version 2
        Capabilities: [100] Advanced Error Reporting
        Kernel driver in use: pcieport
        Kernel modules: shpchp

三、跟踪端口

 \-[0000:00]-+-00.0
             +-01.0-[02]--+-00.0
             |            \-00.1
             +-01.1-[01]--+-00.0
             |            \-00.1
             +-02.0-[04]--
             +-02.2-[03]----00.0
             +-03.0-[05]--
             +-05.0
             +-05.2
             +-11.0-[06]--
             +-16.0
             +-16.1
             +-1a.0
             +-1c.0-[07]--
             +-1c.7-[08-0c]----00.0-[09-0c]--+-00.0-[0a-0b]----00.0-[0b]----00.0
             |                               \-01.0-[0c]--

四、输出机器可读信息

可以得到设备厂商,设备驱动

# lspci -vmm | grep -C 6 00:1c.7
Slot:   00:1c.7
Class:  PCI bridge
Vendor: Intel Corporation
Device: C600/X79 series chipset PCI Express Root Port 8
Rev:    b5
weinxin
聂扬帆博客
一个分享IT运维相关工作经验和实战技巧的个人博客

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: