Jetson Nano PCIe Buss Error¶
警告
本文实践让我大跌眼镜,这个TF卡读写错误最终发现只是第三方转接器质量问题导致的不稳定…虽然我最初反复排查以为是Jetson Nano的硬件缺陷或者是内核bug,但是万万没有想到是一个小小的转接器印刷电路板质量问题。
意外发现Jetson Nano文件系统只读:
-bash: cannot create temp file for here-document: Read-only file system
备注
这个文件系统只读有可能是我通过dd复制TF卡,把原先旧卡中某些缺陷带入到新卡?我现在重新用新卡完整通过L4T重新安装,再继续观察。
检查系统日志中有PCIe错误:
[Sun Sep 13 19:01:16 2020] pcieport 0000: 2020] pcieport 0000:00:01.0: PCIe Bus Error: severity=Correcte:01.0: device [10de:0fae] error status/mask=00000001/00002000n Sep 13 19:32:35 2020] pcieport 0000:00:01.0: AER: Corrected error: severity=Corrected, type=Physical Layer, id=0008(Receivererror status/mask=00000001/00002000
[Sun Sep 13 19:32:35 2020] 20] pcieport 0000:00:01.0: AER: Corrected error received: id=00rected, type=Physical Layer, id=0008(Receiver ID)
[Sun Sep 13 202000
[Sun Sep 13 20:04:21 2020] pcieport 0000:00:01.0: [ 0]0: AER: Corrected error received: id=0010
[Sun Sep 13 20:15:41 er, id=0008(Receiver ID)
[Sun Sep 13 20:15:41 2020] pcieport 0041 2020] pcieport 0000:00:01.0: [ 0] Receiver Error id=0010
[Sun Sep 13 20:27:14 2020] pcieport 0000:00:01.0: PCIen Sep 13 20:27:14 2020] pcieport 0000:00:01.0: device [10de:0 (First)
[Sun Sep 13 20:38:53 2020] pcieport 0000:00:01.0 0000:00:01.0: PCIe Bus Error: severity=Corrected, type=Physicae [10de:0fae] error status/mask=00000001/00002000
上述报错看起来和PCIe Bus相关:
[五 8月 20 08:40:47 2021] pcieport 0000:00:01.0: AER: Corrected error received: id=0010
[五 8月 20 08:40:47 2021] pcieport 0000:00:01.0: PCIe Bus Error: severity=Corrected, type=Physical Layer, id=0008(Receiver ID)
[五 8月 20 08:40:47 2021] pcieport 0000:00:01.0: device [10de:0fae] error status/mask=00000001/00002000
[五 8月 20 08:40:47 2021] pcieport 0000:00:01.0: [ 0] Receiver Error (First)
检查处理器温度:
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'
输出显示:
AO-therm 41.5°C
CPU-therm 34.0°C
GPU-therm 31.0°C
PLL-therm 31.5°C
PMIC-Die 100.0°C
thermal-fan-est 33.0°C
iwlwifi 39.0°C
上述 PCIe Bus Error: severity=Corrected, type=Physical Layer, id=0008(Receiver ID)
报错在 askubuntu PCIe Bus Error: severity=Corrected, type=Physical Layer, id=00e5(Receiver ID) 有一个解释:
PCIe活跃状态电源管理(PCIe Active State Power Management)是将链路转换成低电能状态,在Jetson Nano的Ubuntu使用的内核版本较低,转换电能状态时会导致设备触发一些错误。
在内核启动参数中添加 pcie_aspm=off
可以使这种错误消息不再出现,但是这也会增加电能消耗,因为实际上主机这是关闭了节能功能。
修改启动参数¶
检查当前内核运行参数:
cat /proc/cmdline
当前显示如下:
tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,2 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000 earlycon=uart8250,mmio32,0x70006000 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4
console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
在Jetson Nano的配置文件 /boot/extlinux/extlinux.conf
可以看到:
TIMEOUT 30
DEFAULT primary
MENU TITLE L4T boot options
LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
默认情况下,会从 CBoot 获取 bootargs ,所以这里可以替换和修改启动参数,所以我增加上 pcie_aspm=off
:
TIMEOUT 30
DEFAULT primary
MENU TITLE L4T boot options
LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 pcie_aspm=off
修改后,重启系统,再检查
cat /proc/cmdline
可以看到内核参数后添加了pcie_aspm=off
参数:
tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,2 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000 earlycon=uart8250,mmio32,0x70006000 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4
console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 pcie_aspm=off
实践经验¶
从之前验证来看,使用 pcie_aspm=off
确实可以消除内核报错,并且印象中好像很少再出现文件系统只读问题。对比之下,我最近一次重装jetson系统,没有添加这个内核参数,则非常容易出现文件系统只读以及上述内核报错。
不过,我最终偶然发现,这个SD卡读写错误问题实际上是转接器的质量问题: 这真是出乎我的意料。实际上Jetson Nano并没有硬件问题,而是我购买的第三方装机外壳使用了一个TF卡转接器把原装的TF卡延伸到机壳外部方便装卸。然而这个转接卡电路板质量较差,我偶然拆机时发现电路印刷线路已经脱落翘起,导致TF卡安装后接触不良。
我尝试拆掉转接器,把TF卡直接插在Jetson Nano原装TF卡槽中,则之后使用就再也没有出现过TF卡读写错误。这真是一个非常令人哭笑不得的实践经验!