Byeo

최신 device와 lspci 본문

프로그래밍 (Programming)/컴퓨터 네트워크 - 학부 외

최신 device와 lspci

BKlee 2023. 9. 22. 20:03
반응형

lspci

lspci는 시스템에 장착된 pci 디바이스들을 모두 나열하여 보여줍니다. Ubuntu 기준으로 기본적으로 내장이 되어 있는 바이너리인데요. lspci라는 명령어를 입력하는 것 만으로 쉽게 사용할 수 있습니다.

  • Ubuntu 18.04 instance의 lspci
ubuntu@byeo-test-instance:~$ lspci  
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)  
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]  
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]  
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)  
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)  
00:02.0 VGA compatible controller: Cirrus Logic GD 5446  
00:03.0 Ethernet controller: Red Hat, Inc. Virtio network device 00:04.0 SCSI storage controller: Red Hat, Inc. Virtio block device  
00:05.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon
  • -nn 옵션

여기서 -nn 옵션을 붙여주면 pci vendor id와 product id를 확인할 수 있어요. 이런 식으로 말이죠:

00:03.0 Ethernet controller [0200]: Red Hat, Inc. Virtio network device [1af4:1000]

여기서 앞 1af4는 vendor id입니다. 장비 (혹은 pcie device)를 만드는 회사마다 갖는 고유 번호입니다. 뒤의 product id는 말 그대로 상품 번호입니다.

 

 

최신 디바이스

그런데 Ubuntu 18.04의 출시일 (release date)보다 더 늦게 나온 최신 장비들이 있겠죠? 그러면 해당 버전의 lspci는 그 장비를 정확히 인식할 수 없습니다.

저는 이 사례를 Mellanox의 CX-6 NIC을 Ubuntu 18.04에 장착했을 때 겪을 수 있었는데요, 다음처럼 15b3:101e에 대해서 이름이 불충분하게 출력이 됐습니다. 실제 해당 device는 CX-6 NIC의 VF (SR-IOV Virtual Function) 입니다. Nvidia mellanox NIC의 vendor id는 15b3 입니다.

00:05.0 Ethernet controller [0200]: Mellanox Technologies MT28850 [15b3:101e]

 

 

update-pciids

이 문제는 lspci 명령어가 오래됐기 때문입니다. 해당 문제는 간단하게 update-pciids 명령어를 입력하면 해결됩니다. 관련된 내용은 https://github.com/pciutils/pciutils/tree/v3.7.0 여기서 찾을 수 있습니다.

root@byeo-test-instance:/home/ubuntu# update-pciids
Downloaded daily snapshot dated 2023-09-22 03:15:02
root@byeo-test-instance:/home/ubuntu# lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation 440FX - 82441FX PMC [Natoma] [8086:1237] (rev 02)
00:01.0 ISA bridge [0601]: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] [8086:7000]
00:01.1 IDE interface [0101]: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] [8086:7010]
00:01.2 USB controller [0c03]: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] [8086:7020] (rev 01)
00:01.3 Bridge [0680]: Intel Corporation 82371AB/EB/MB PIIX4 ACPI [8086:7113] (rev 03)
00:02.0 VGA compatible controller [0300]: Cirrus Logic GD 5446 [1013:00b8]
00:03.0 Ethernet controller [0200]: Red Hat, Inc. Virtio network device [1af4:1000]
00:04.0 SCSI storage controller [0100]: Red Hat, Inc. Virtio block device [1af4:1001]
00:05.0 Ethernet controller [0200]: Mellanox Technologies ConnectX Family mlx5Gen Virtual Function [15b3:101e]
00:06.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon [1af4:1002]

짜잔~ 00:05.0을 보면 Virtual Function이다 까지를 확실하게 표현을 해주고 있죠.

 

위 깃허브 주소에 들어가서 pci.ids 파일을 살펴보면 굉장히 많은 device들의 pci vendor id와 product id의 리스트를 볼 수 있습니다: https://raw.githubusercontent.com/pciutils/pciutils/v3.7.0/pci.ids

 여길 보면 15be:101e가 ConnectX Family mlx5Gen Virtual Function임을 알 수 있죠. 실제로 lspci 결과도 이 내용인 것도 확인할 수 있구요.

 

 반면에 기본 설치 버전인 v3.5.2로 브랜치를 바꿔서 pci.ids 파일을 확인해보면 다음처럼 정보가 없습니다.

 

 왜 ubuntu 18.04에서 CX-6 NIC VF에 대한 lspci 결과가 성의없게 나왔는 지를 알 수 있는 부분이죠

 

 

 

언제 문제일까?

 그런데 lspci의 이름 출력이 중요할 때가 있을까요? 저는 mlnx driver를 설치할 때 이와 관련 된 이슈를 겪었습니다. mlnx driver 설치과정중에 마지막에 Firmware update를 수행합니다. 이를 진행할 때 lspci -nn 의 vendor id가 15b3인 pci device를 대상으로 모두 검사를 수행합니다. 이 중에서 VF는 skip하는게 일반적인 동작입니다.

 

 하지만 다음과 같은 에러가 발생했었어요.

Initializing...
Attempting to perform Firmware update...
Querying Mellanox devices firmware ...

Device #1:
----------

  Device Type:      N/A
  Part Number:      --
  Description:
  PSID:
  PCI Device Name:  00:06.0
  Port1 MAC:        N/A
  Port1 GUID:       N/A
  Port2 MAC:        N/A
  Port2 GUID:       N/A
  Versions:         Current        Available
     FW             --

  Status:           Failed to open device

---------
-E- Failed to query 00:06.0 device, error : No such file or directory. MFE_CR_ERROR

 

 00:08.0 pci device에 대해서 firmware update를 진행하려 했는데 device를 열 수 없어서 발생한 오류였습니다. 근데 해당 디바이스는 VF였고, skip했어야 했습니다.

 

 이를 VF라고 인식하지 못한 이유는 lspci의 결과가 virtual function이라는 문구가 없었음에 원인이 있다고 파악했습니다. (강한 추측이고, 실제 내부 소스코드는 어떻게 되어있는지 모릅니다.)

 

 update-pciids를 통해 lspci 출력을 정상으로 바꿔주니 해결할 수 있었습니다~

 

root@byeo-test-instance:/home/ubuntu/MLNX_OFED_LINUX-5.8-3.0.7.0-ubuntu18.04-x86_64# FW_UPDATE_FLAGS='--log ./bk_fw_update.log -v --tmpdir /tmp' RUN_FW_UPDATER='yes'  /usr/bin/dpkg -i ./DEBS/mlnx-fw-updater_5.8-3.0.7.0_amd64.deb
(Reading database ... 153865 files and directories currently installed.)
Preparing to unpack .../mlnx-fw-updater_5.8-3.0.7.0_amd64.deb ...
Unpacking mlnx-fw-updater (5.8-3.0.7.0) over (5.8-3.0.7.0) ...
Setting up mlnx-fw-updater (5.8-3.0.7.0) ...

Added 'RUN_FW_UPDATER_ONBOOT=no to /etc/infiniband/openib.conf

Initializing...
Scanning /opt/mellanox/mlnx-fw-updater/firmware/mlxfwmanager_sriov_dis_x86_64_4115
...
Scanning /opt/mellanox/mlnx-fw-updater/firmware/mlxfwmanager_sriov_dis_x86_64_41686
Attempting to perform Firmware update...
Running: lspci -d 15b3: -s.0 2>/dev/null | cut -d" " -f"1"
Skipping a Virtual Function: 00:06.0
반응형
Comments