Message ID | 20230606094814.3581397-19-peter.maydell@linaro.org |
---|---|
State | Accepted |
Commit | 6c4f229a2e0d6f882bae389ce0c5bdaea712ce0f |
Headers | show |
Series | [PULL,01/42] arm: move KVM breakpoints helpers | expand |
On 06/06/2023 11.47, Peter Maydell wrote: > From: qianfan Zhao <qianfanguijin@163.com> > > Add test case for booting from initrd and sd card. > > Signed-off-by: qianfan Zhao <qianfanguijin@163.com> > Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> > Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++ > 1 file changed, 176 insertions(+) ... > + def test_arm_bpim2u_gmac(self): > + """ > + :avocado: tags=arch:arm > + :avocado: tags=accel:tcg > + :avocado: tags=machine:bpim2u > + :avocado: tags=device:sd > + """ > + self.require_netdev('user') > + > + deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' > + 'linux-image-current-sunxi_21.02.2_armhf.deb') > + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' > + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) > + kernel_path = self.extract_from_deb(deb_path, > + '/boot/vmlinuz-5.10.16-sunxi') > + dtb_path = ('/usr/lib/linux-image-current-sunxi/' > + 'sun8i-r40-bananapi-m2-ultra.dtb') > + dtb_path = self.extract_from_deb(deb_path, dtb_path) > + rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/' > + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') > + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' > + rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) > + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') > + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) > + image_pow2ceil_expand(rootfs_path) > + > + self.vm.set_console() > + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + > + 'console=ttyS0,115200 ' > + 'root=/dev/mmcblk0 rootwait rw ' > + 'panic=-1 noreboot') > + self.vm.add_args('-kernel', kernel_path, > + '-dtb', dtb_path, > + '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', > + '-net', 'nic,model=gmac,netdev=host_gmac', > + '-netdev', 'user,id=host_gmac', > + '-append', kernel_command_line, > + '-no-reboot') > + self.vm.launch() > + shell_ready = "/bin/sh: can't access tty; job control turned off" > + self.wait_for_console_pattern(shell_ready) > + > + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', > + 'Allwinner sun8i Family') > + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', > + 'mmcblk0') > + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', > + 'eth0: Link is Up') > + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', > + 'udhcpc: lease of 10.0.2.15 obtained') > + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', > + '3 packets transmitted, 3 packets received, 0% packet loss') > + exec_command_and_wait_for_pattern(self, 'reboot', > + 'reboot: Restarting system') > + # Wait for VM to shut down gracefully > + self.vm.wait() FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 Looking at the debug.log in the artifacts, it looks like the kernel was hanging during boot: 10:53:56 DEBUG| of_cfs_init 10:53:56 DEBUG| of_cfs_init: OK 10:53:56 DEBUG| ALSA device list: 10:53:56 DEBUG| No soundcards found. 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... 10:54:26 DEBUG| dcdc4: disabling 10:54:26 DEBUG| dc5ldo: disabling 10:54:26 DEBUG| vcc5v0: disabling 10:55:15 ERROR| ... 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM I can reproduce the problem locally on my laptop when running the test repeatedly, e.g. with: make check-venv for ((x=0;x<10;x++)); do \ ./tests/venv/bin/avocado run \ tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ done 1 out of 10 runs were failing. Any ideas what could be wrong in those failing cases? Thomas
在 2023/6/29 19:35, Thomas Huth 写道: > On 06/06/2023 11.47, Peter Maydell wrote: >> From: qianfan Zhao <qianfanguijin@163.com> >> >> Add test case for booting from initrd and sd card. >> >> Signed-off-by: qianfan Zhao <qianfanguijin@163.com> >> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> >> Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> >> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >> --- >> tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++ >> 1 file changed, 176 insertions(+) > ... >> + def test_arm_bpim2u_gmac(self): >> + """ >> + :avocado: tags=arch:arm >> + :avocado: tags=accel:tcg >> + :avocado: tags=machine:bpim2u >> + :avocado: tags=device:sd >> + """ >> + self.require_netdev('user') >> + >> + deb_url = >> ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' >> + 'linux-image-current-sunxi_21.02.2_armhf.deb') >> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' >> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) >> + kernel_path = self.extract_from_deb(deb_path, >> + '/boot/vmlinuz-5.10.16-sunxi') >> + dtb_path = ('/usr/lib/linux-image-current-sunxi/' >> + 'sun8i-r40-bananapi-m2-ultra.dtb') >> + dtb_path = self.extract_from_deb(deb_path, dtb_path) >> + rootfs_url = >> ('http://storage.kernelci.org/images/rootfs/buildroot/' >> + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') >> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' >> + rootfs_path_xz = self.fetch_asset(rootfs_url, >> asset_hash=rootfs_hash) >> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') >> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) >> + image_pow2ceil_expand(rootfs_path) >> + >> + self.vm.set_console() >> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >> + 'console=ttyS0,115200 ' >> + 'root=/dev/mmcblk0 rootwait rw ' >> + 'panic=-1 noreboot') >> + self.vm.add_args('-kernel', kernel_path, >> + '-dtb', dtb_path, >> + '-drive', 'file=' + rootfs_path + >> ',if=sd,format=raw', >> + '-net', 'nic,model=gmac,netdev=host_gmac', >> + '-netdev', 'user,id=host_gmac', >> + '-append', kernel_command_line, >> + '-no-reboot') >> + self.vm.launch() >> + shell_ready = "/bin/sh: can't access tty; job control turned >> off" >> + self.wait_for_console_pattern(shell_ready) >> + >> + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', >> + 'Allwinner sun8i >> Family') >> + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', >> + 'mmcblk0') >> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', >> + 'eth0: Link is Up') >> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', >> + 'udhcpc: lease of 10.0.2.15 obtained') >> + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', >> + '3 packets transmitted, 3 packets received, 0% packet >> loss') >> + exec_command_and_wait_for_pattern(self, 'reboot', >> + 'reboot: Restarting >> system') >> + # Wait for VM to shut down gracefully >> + self.vm.wait() > > FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: > > https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 > > Looking at the debug.log in the artifacts, it looks like the kernel > was hanging during boot: > > 10:53:56 DEBUG| of_cfs_init > 10:53:56 DEBUG| of_cfs_init: OK > 10:53:56 DEBUG| ALSA device list: > 10:53:56 DEBUG| No soundcards found. > 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... > 10:54:26 DEBUG| dcdc4: disabling > 10:54:26 DEBUG| dc5ldo: disabling > 10:54:26 DEBUG| vcc5v0: disabling > 10:55:15 ERROR| > ... > 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM > > I can reproduce the problem locally on my laptop when running the test > repeatedly, e.g. with: > > make check-venv > for ((x=0;x<10;x++)); do \ > ./tests/venv/bin/avocado run \ > tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ > done > > 1 out of 10 runs were failing. > > Any ideas what could be wrong in those failing cases? Hi: I can reproduce this issue based on master code(v8.0.0-rc1-2442-g4d541f63e9) with your's test scripts, and I have tested 50 times only failed once. Copy liunx boot logs and make a diff: $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt 3c3 < Linux version 5.10.16-sunxi (root@beast) (arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #21.02.2 SMP Sun Feb 14 21:12:17 CET 2021 --- > Linux version 5.10.16-sunxi (root@beast) (arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm- 28c28 < Memory: 890856K/1048576K available (9216K kernel code, 1457K rwdata, 3216K rodata, 1024K init, 331K bss, 26648K reserved, 131072K cma-reserved, 131072K highmem) --- > Memory: 890856K/1048576K available (9216K kernel code, 1457K rwdata, 3216K rodata, 1024K init, 331K bss, 26648K reserved, 131072K 74c74 < audit: type=2000 audit(0.156:1): state=initialized audit_enabled=0 res=1 --- > audit: type=2000 audit(0.152:1): state=initialized audit_enabled=0 res=1 83,93c83,93 < raid6: neonx8 gen() 1684 MB/s < raid6: neonx8 xor() 630 MB/s < raid6: neonx4 gen() 1103 MB/s < raid6: neonx4 xor() 939 MB/s < raid6: neonx2 gen() 1966 MB/s < raid6: neonx2 xor() 928 MB/s < raid6: neonx1 gen() 1471 MB/s < raid6: neonx1 xor() 403 MB/s < raid6: int32x8 gen() 464 MB/s < raid6: int32x8 xor() 273 MB/s < raid6: int32x4 gen() 449 MB/s --- > raid6: neonx8 gen() 1677 MB/s > raid6: neonx8 xor() 646 MB/s > raid6: neonx4 gen() 1111 MB/s > raid6: neonx4 xor() 924 MB/s > raid6: neonx2 gen() 1973 MB/s > raid6: neonx2 xor() 929 MB/s > raid6: neonx1 gen() 1505 MB/s > raid6: neonx1 xor() 407 MB/s > raid6: int32x8 gen() 457 MB/s > raid6: int32x8 xor() 275 MB/s > raid6: int32x4 gen() 444 MB/s 95,100c95,100 < raid6: int32x2 gen() 1029 MB/s < raid6: int32x2 xor() 557 MB/s < raid6: int32x1 gen() 840 MB/s < raid6: int32x1 xor() 452 MB/s < raid6: using algorithm neonx2 gen() 1966 MB/s < raid6: .... xor() 928 MB/s, rmw enabled --- > raid6: int32x2 gen() 1018 MB/s > raid6: int32x2 xor() 553 MB/s > raid6: int32x1 gen() 837 MB/s > raid6: int32x1 xor() 446 MB/s > raid6: using algorithm neonx2 gen() 1973 MB/s > raid6: .... xor() 929 MB/s, rmw enabled 138,142c138,142 < arm4regs : 1530 MB/sec < 8regs : 1764 MB/sec < 32regs : 1508 MB/sec < neon : 1761 MB/sec < xor: using function: 8regs (1764 MB/sec) --- > arm4regs : 1526 MB/sec > 8regs : 1765 MB/sec > 32regs : 1587 MB/sec > neon : 1768 MB/sec > xor: using function: neon (1768 MB/sec) 194c194 < bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this. --- > bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need th 288a289,291 > mmc1: host does not support reading read-only switch, assuming write-enable > mmc1: new high speed SD card at address 4567 > mmcblk1: mmc1:4567 QEMU! 64.0 MiB 296,298d298 < mmc0: host does not support reading read-only switch, assuming write-enable < mmc0: new high speed SD card at address 4567 < mmcblk0: mmc0:4567 QEMU! 64.0 MiB 322,331c322,325 < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) < VFS: Mounted root (ext2 filesystem) on device 179:0. < devtmpfs: mounted < Freeing unused kernel memory: 1024K < Run /sbin/init as init process < EXT4-fs (mmcblk0): re-mounted. Opts: (null) < Starting syslogd: OK < Starting klogd: OK < Running sysctl: OK \ No newline at end of file --- > Waiting for root device /dev/mmcblk0... > dcdc4: disabling > dc5ldo: disabling > vcc5v0: disabling \ No newline at end of file The first mmc device should be mmc0, but the linux kernel named it as mmcblk1. So it always 'Waiting for root device /dev/mmcblk0...', that make the rootfs can not mounted. I'm not make sure where the problem came from. > > Thomas
在 2023/6/30 14:15, qianfan 写道: > > > 在 2023/6/29 19:35, Thomas Huth 写道: >> On 06/06/2023 11.47, Peter Maydell wrote: >>> From: qianfan Zhao <qianfanguijin@163.com> >>> >>> Add test case for booting from initrd and sd card. >>> >>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com> >>> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>> Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >>> --- >>> tests/avocado/boot_linux_console.py | 176 >>> ++++++++++++++++++++++++++++ >>> 1 file changed, 176 insertions(+) >> ... >>> + def test_arm_bpim2u_gmac(self): >>> + """ >>> + :avocado: tags=arch:arm >>> + :avocado: tags=accel:tcg >>> + :avocado: tags=machine:bpim2u >>> + :avocado: tags=device:sd >>> + """ >>> + self.require_netdev('user') >>> + >>> + deb_url = >>> ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' >>> + 'linux-image-current-sunxi_21.02.2_armhf.deb') >>> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' >>> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) >>> + kernel_path = self.extract_from_deb(deb_path, >>> + '/boot/vmlinuz-5.10.16-sunxi') >>> + dtb_path = ('/usr/lib/linux-image-current-sunxi/' >>> + 'sun8i-r40-bananapi-m2-ultra.dtb') >>> + dtb_path = self.extract_from_deb(deb_path, dtb_path) >>> + rootfs_url = >>> ('http://storage.kernelci.org/images/rootfs/buildroot/' >>> + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') >>> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' >>> + rootfs_path_xz = self.fetch_asset(rootfs_url, >>> asset_hash=rootfs_hash) >>> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') >>> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) >>> + image_pow2ceil_expand(rootfs_path) >>> + >>> + self.vm.set_console() >>> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>> + 'console=ttyS0,115200 ' >>> + 'root=/dev/mmcblk0 rootwait rw ' >>> + 'panic=-1 noreboot') >>> + self.vm.add_args('-kernel', kernel_path, >>> + '-dtb', dtb_path, >>> + '-drive', 'file=' + rootfs_path + >>> ',if=sd,format=raw', >>> + '-net', 'nic,model=gmac,netdev=host_gmac', >>> + '-netdev', 'user,id=host_gmac', >>> + '-append', kernel_command_line, >>> + '-no-reboot') >>> + self.vm.launch() >>> + shell_ready = "/bin/sh: can't access tty; job control >>> turned off" >>> + self.wait_for_console_pattern(shell_ready) >>> + >>> + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', >>> + 'Allwinner sun8i >>> Family') >>> + exec_command_and_wait_for_pattern(self, 'cat >>> /proc/partitions', >>> + 'mmcblk0') >>> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', >>> + 'eth0: Link is Up') >>> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', >>> + 'udhcpc: lease of 10.0.2.15 obtained') >>> + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', >>> + '3 packets transmitted, 3 packets received, 0% packet >>> loss') >>> + exec_command_and_wait_for_pattern(self, 'reboot', >>> + 'reboot: Restarting >>> system') >>> + # Wait for VM to shut down gracefully >>> + self.vm.wait() >> >> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: >> >> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 >> >> Looking at the debug.log in the artifacts, it looks like the kernel >> was hanging during boot: >> >> 10:53:56 DEBUG| of_cfs_init >> 10:53:56 DEBUG| of_cfs_init: OK >> 10:53:56 DEBUG| ALSA device list: >> 10:53:56 DEBUG| No soundcards found. >> 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... >> 10:54:26 DEBUG| dcdc4: disabling >> 10:54:26 DEBUG| dc5ldo: disabling >> 10:54:26 DEBUG| vcc5v0: disabling >> 10:55:15 ERROR| >> ... >> 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM >> >> I can reproduce the problem locally on my laptop when running the >> test repeatedly, e.g. with: >> >> make check-venv >> for ((x=0;x<10;x++)); do \ >> ./tests/venv/bin/avocado run \ >> tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ >> done >> >> 1 out of 10 runs were failing. >> >> Any ideas what could be wrong in those failing cases? > Hi: > > I can reproduce this issue based on master > code(v8.0.0-rc1-2442-g4d541f63e9) with your's > test scripts, and I have tested 50 times only failed once. > > Copy liunx boot logs and make a diff: > > $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt > 3c3 > < Linux version 5.10.16-sunxi (root@beast) (arm-linux-gnueabihf-gcc > (GNU Toolchain for the A-profile Architecture 8.3-2019.03 > (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile > Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #21.02.2 SMP > Sun Feb 14 21:12:17 CET 2021 > --- > > Linux version 5.10.16-sunxi (root@beast) (arm-linux-gnueabihf-gcc > (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm- > 28c28 > < Memory: 890856K/1048576K available (9216K kernel code, 1457K rwdata, > 3216K rodata, 1024K init, 331K bss, 26648K reserved, 131072K > cma-reserved, 131072K highmem) > --- > > Memory: 890856K/1048576K available (9216K kernel code, 1457K rwdata, > 3216K rodata, 1024K init, 331K bss, 26648K reserved, 131072K > 74c74 > < audit: type=2000 audit(0.156:1): state=initialized audit_enabled=0 > res=1 > --- > > audit: type=2000 audit(0.152:1): state=initialized audit_enabled=0 > res=1 > 83,93c83,93 > < raid6: neonx8 gen() 1684 MB/s > < raid6: neonx8 xor() 630 MB/s > < raid6: neonx4 gen() 1103 MB/s > < raid6: neonx4 xor() 939 MB/s > < raid6: neonx2 gen() 1966 MB/s > < raid6: neonx2 xor() 928 MB/s > < raid6: neonx1 gen() 1471 MB/s > < raid6: neonx1 xor() 403 MB/s > < raid6: int32x8 gen() 464 MB/s > < raid6: int32x8 xor() 273 MB/s > < raid6: int32x4 gen() 449 MB/s > --- > > raid6: neonx8 gen() 1677 MB/s > > raid6: neonx8 xor() 646 MB/s > > raid6: neonx4 gen() 1111 MB/s > > raid6: neonx4 xor() 924 MB/s > > raid6: neonx2 gen() 1973 MB/s > > raid6: neonx2 xor() 929 MB/s > > raid6: neonx1 gen() 1505 MB/s > > raid6: neonx1 xor() 407 MB/s > > raid6: int32x8 gen() 457 MB/s > > raid6: int32x8 xor() 275 MB/s > > raid6: int32x4 gen() 444 MB/s > 95,100c95,100 > < raid6: int32x2 gen() 1029 MB/s > < raid6: int32x2 xor() 557 MB/s > < raid6: int32x1 gen() 840 MB/s > < raid6: int32x1 xor() 452 MB/s > < raid6: using algorithm neonx2 gen() 1966 MB/s > < raid6: .... xor() 928 MB/s, rmw enabled > --- > > raid6: int32x2 gen() 1018 MB/s > > raid6: int32x2 xor() 553 MB/s > > raid6: int32x1 gen() 837 MB/s > > raid6: int32x1 xor() 446 MB/s > > raid6: using algorithm neonx2 gen() 1973 MB/s > > raid6: .... xor() 929 MB/s, rmw enabled > 138,142c138,142 > < arm4regs : 1530 MB/sec > < 8regs : 1764 MB/sec > < 32regs : 1508 MB/sec > < neon : 1761 MB/sec > < xor: using function: 8regs (1764 MB/sec) > --- > > arm4regs : 1526 MB/sec > > 8regs : 1765 MB/sec > > 32regs : 1587 MB/sec > > neon : 1768 MB/sec > > xor: using function: neon (1768 MB/sec) > 194c194 > < bridge: filtering via arp/ip/ip6tables is no longer available by > default. Update your scripts to load br_netfilter if you need this. > --- > > bridge: filtering via arp/ip/ip6tables is no longer available by > default. Update your scripts to load br_netfilter if you need th > 288a289,291 > > mmc1: host does not support reading read-only switch, assuming > write-enable > > mmc1: new high speed SD card at address 4567 > > mmcblk1: mmc1:4567 QEMU! 64.0 MiB > 296,298d298 > < mmc0: host does not support reading read-only switch, assuming > write-enable > < mmc0: new high speed SD card at address 4567 > < mmcblk0: mmc0:4567 QEMU! 64.0 MiB > 322,331c322,325 > < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem > < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) > < VFS: Mounted root (ext2 filesystem) on device 179:0. > < devtmpfs: mounted > < Freeing unused kernel memory: 1024K > < Run /sbin/init as init process > < EXT4-fs (mmcblk0): re-mounted. Opts: (null) > < Starting syslogd: OK > < Starting klogd: OK > < Running sysctl: OK > \ No newline at end of file > --- > > Waiting for root device /dev/mmcblk0... > > dcdc4: disabling > > dc5ldo: disabling > > vcc5v0: disabling > \ No newline at end of file > > The first mmc device should be mmc0, but the linux kernel named it as > mmcblk1. > So it always 'Waiting for root device /dev/mmcblk0...', that make the > rootfs > can not mounted. > > I'm not make sure where the problem came from. >> >> Thomas > Sorry the qemu_bpi_bad.txt in the last message was not completed. Let me fix it and diff again. $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt 73c73 < audit: type=2000 audit(0.156:1): state=initialized audit_enabled=0 res=1 --- > audit: type=2000 audit(0.152:1): state=initialized audit_enabled=0 res=1 82,92c82,92 < raid6: neonx8 gen() 1684 MB/s < raid6: neonx8 xor() 630 MB/s < raid6: neonx4 gen() 1103 MB/s < raid6: neonx4 xor() 939 MB/s < raid6: neonx2 gen() 1966 MB/s < raid6: neonx2 xor() 928 MB/s < raid6: neonx1 gen() 1471 MB/s < raid6: neonx1 xor() 403 MB/s < raid6: int32x8 gen() 464 MB/s < raid6: int32x8 xor() 273 MB/s < raid6: int32x4 gen() 449 MB/s --- > raid6: neonx8 gen() 1677 MB/s > raid6: neonx8 xor() 646 MB/s > raid6: neonx4 gen() 1111 MB/s > raid6: neonx4 xor() 924 MB/s > raid6: neonx2 gen() 1973 MB/s > raid6: neonx2 xor() 929 MB/s > raid6: neonx1 gen() 1505 MB/s > raid6: neonx1 xor() 407 MB/s > raid6: int32x8 gen() 457 MB/s > raid6: int32x8 xor() 275 MB/s > raid6: int32x4 gen() 444 MB/s 94,99c94,99 < raid6: int32x2 gen() 1029 MB/s < raid6: int32x2 xor() 557 MB/s < raid6: int32x1 gen() 840 MB/s < raid6: int32x1 xor() 452 MB/s < raid6: using algorithm neonx2 gen() 1966 MB/s < raid6: .... xor() 928 MB/s, rmw enabled --- > raid6: int32x2 gen() 1018 MB/s > raid6: int32x2 xor() 553 MB/s > raid6: int32x1 gen() 837 MB/s > raid6: int32x1 xor() 446 MB/s > raid6: using algorithm neonx2 gen() 1973 MB/s > raid6: .... xor() 929 MB/s, rmw enabled 137,141c137,141 < arm4regs : 1530 MB/sec < 8regs : 1764 MB/sec < 32regs : 1508 MB/sec < neon : 1761 MB/sec < xor: using function: 8regs (1764 MB/sec) --- > arm4regs : 1526 MB/sec > 8regs : 1765 MB/sec > 32regs : 1587 MB/sec > neon : 1768 MB/sec > xor: using function: neon (1768 MB/sec) 287a288,290 > mmc1: host does not support reading read-only switch, assuming write-enable > mmc1: new high speed SD card at address 4567 > mmcblk1: mmc1:4567 QEMU! 64.0 MiB 295,297d297 < mmc0: host does not support reading read-only switch, assuming write-enable < mmc0: new high speed SD card at address 4567 < mmcblk0: mmc0:4567 QEMU! 64.0 MiB 321,330c321,325 < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) < VFS: Mounted root (ext2 filesystem) on device 179:0. < devtmpfs: mounted < Freeing unused kernel memory: 1024K < Run /sbin/init as init process < EXT4-fs (mmcblk0): re-mounted. Opts: (null) < Starting syslogd: OK < Starting klogd: OK < Running sysctl: OK \ No newline at end of file --- > Waiting for root device /dev/mmcblk0... > dcdc4: disabling > dc5ldo: disabling > vcc5v0: disabling > vcc5v0: disabling \ No newline at end of file
On 30/06/2023 08.15, qianfan wrote: > > > 在 2023/6/29 19:35, Thomas Huth 写道: >> On 06/06/2023 11.47, Peter Maydell wrote: >>> From: qianfan Zhao <qianfanguijin@163.com> >>> >>> Add test case for booting from initrd and sd card. >>> >>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com> >>> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>> Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >>> --- >>> tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++ >>> 1 file changed, 176 insertions(+) >> ... >>> + def test_arm_bpim2u_gmac(self): >>> + """ >>> + :avocado: tags=arch:arm >>> + :avocado: tags=accel:tcg >>> + :avocado: tags=machine:bpim2u >>> + :avocado: tags=device:sd >>> + """ >>> + self.require_netdev('user') >>> + >>> + deb_url = >>> ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' >>> + 'linux-image-current-sunxi_21.02.2_armhf.deb') >>> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' >>> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) >>> + kernel_path = self.extract_from_deb(deb_path, >>> + '/boot/vmlinuz-5.10.16-sunxi') >>> + dtb_path = ('/usr/lib/linux-image-current-sunxi/' >>> + 'sun8i-r40-bananapi-m2-ultra.dtb') >>> + dtb_path = self.extract_from_deb(deb_path, dtb_path) >>> + rootfs_url = >>> ('http://storage.kernelci.org/images/rootfs/buildroot/' >>> + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') >>> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' >>> + rootfs_path_xz = self.fetch_asset(rootfs_url, >>> asset_hash=rootfs_hash) >>> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') >>> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) >>> + image_pow2ceil_expand(rootfs_path) >>> + >>> + self.vm.set_console() >>> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>> + 'console=ttyS0,115200 ' >>> + 'root=/dev/mmcblk0 rootwait rw ' >>> + 'panic=-1 noreboot') >>> + self.vm.add_args('-kernel', kernel_path, >>> + '-dtb', dtb_path, >>> + '-drive', 'file=' + rootfs_path + >>> ',if=sd,format=raw', >>> + '-net', 'nic,model=gmac,netdev=host_gmac', >>> + '-netdev', 'user,id=host_gmac', >>> + '-append', kernel_command_line, >>> + '-no-reboot') >>> + self.vm.launch() >>> + shell_ready = "/bin/sh: can't access tty; job control turned off" >>> + self.wait_for_console_pattern(shell_ready) >>> + >>> + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', >>> + 'Allwinner sun8i Family') >>> + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', >>> + 'mmcblk0') >>> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', >>> + 'eth0: Link is Up') >>> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', >>> + 'udhcpc: lease of 10.0.2.15 obtained') >>> + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', >>> + '3 packets transmitted, 3 packets received, 0% packet loss') >>> + exec_command_and_wait_for_pattern(self, 'reboot', >>> + 'reboot: Restarting >>> system') >>> + # Wait for VM to shut down gracefully >>> + self.vm.wait() >> >> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: >> >> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 >> >> Looking at the debug.log in the artifacts, it looks like the kernel was >> hanging during boot: >> >> 10:53:56 DEBUG| of_cfs_init >> 10:53:56 DEBUG| of_cfs_init: OK >> 10:53:56 DEBUG| ALSA device list: >> 10:53:56 DEBUG| No soundcards found. >> 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... >> 10:54:26 DEBUG| dcdc4: disabling >> 10:54:26 DEBUG| dc5ldo: disabling >> 10:54:26 DEBUG| vcc5v0: disabling >> 10:55:15 ERROR| >> ... >> 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM >> >> I can reproduce the problem locally on my laptop when running the test >> repeatedly, e.g. with: >> >> make check-venv >> for ((x=0;x<10;x++)); do \ >> ./tests/venv/bin/avocado run \ >> tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ >> done >> >> 1 out of 10 runs were failing. >> >> Any ideas what could be wrong in those failing cases? > Hi: > > I can reproduce this issue based on master code(v8.0.0-rc1-2442-g4d541f63e9) > with your's > test scripts, and I have tested 50 times only failed once. > > Copy liunx boot logs and make a diff: > > $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt ... > 288a289,291 > > mmc1: host does not support reading read-only switch, assuming write-enable > > mmc1: new high speed SD card at address 4567 > > mmcblk1: mmc1:4567 QEMU! 64.0 MiB > 296,298d298 > < mmc0: host does not support reading read-only switch, assuming write-enable > < mmc0: new high speed SD card at address 4567 > < mmcblk0: mmc0:4567 QEMU! 64.0 MiB > 322,331c322,325 > < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem > < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) > < VFS: Mounted root (ext2 filesystem) on device 179:0. > < devtmpfs: mounted > < Freeing unused kernel memory: 1024K > < Run /sbin/init as init process > < EXT4-fs (mmcblk0): re-mounted. Opts: (null) > < Starting syslogd: OK > < Starting klogd: OK > < Running sysctl: OK > \ No newline at end of file > --- > > Waiting for root device /dev/mmcblk0... > > dcdc4: disabling > > dc5ldo: disabling > > vcc5v0: disabling > \ No newline at end of file > > The first mmc device should be mmc0, but the linux kernel named it as mmcblk1. > So it always 'Waiting for root device /dev/mmcblk0...', that make the rootfs > can not mounted. > > I'm not make sure where the problem came from. Oh, that's ugly, I think the problem is likely that the numbering of device names that are directly in /dev/ is never guaranteed by the Linux kernel. Could you please try whether this work more reliably for you instead: diff a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -869,7 +869,7 @@ def test_arm_bpim2u_gmac(self): self.vm.set_console() kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0,115200 ' - 'root=/dev/mmcblk0 rootwait rw ' + 'root=b300 rootwait rw ' 'panic=-1 noreboot') self.vm.add_args('-kernel', kernel_path, '-dtb', dtb_path, ? Thomas
在 2023/6/30 15:27, Thomas Huth 写道: > On 30/06/2023 08.15, qianfan wrote: >> >> >> 在 2023/6/29 19:35, Thomas Huth 写道: >>> On 06/06/2023 11.47, Peter Maydell wrote: >>>> From: qianfan Zhao <qianfanguijin@163.com> >>>> >>>> Add test case for booting from initrd and sd card. >>>> >>>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com> >>>> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>>> Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >>>> --- >>>> tests/avocado/boot_linux_console.py | 176 >>>> ++++++++++++++++++++++++++++ >>>> 1 file changed, 176 insertions(+) >>> ... >>>> + def test_arm_bpim2u_gmac(self): >>>> + """ >>>> + :avocado: tags=arch:arm >>>> + :avocado: tags=accel:tcg >>>> + :avocado: tags=machine:bpim2u >>>> + :avocado: tags=device:sd >>>> + """ >>>> + self.require_netdev('user') >>>> + >>>> + deb_url = >>>> ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' >>>> + 'linux-image-current-sunxi_21.02.2_armhf.deb') >>>> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' >>>> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) >>>> + kernel_path = self.extract_from_deb(deb_path, >>>> + '/boot/vmlinuz-5.10.16-sunxi') >>>> + dtb_path = ('/usr/lib/linux-image-current-sunxi/' >>>> + 'sun8i-r40-bananapi-m2-ultra.dtb') >>>> + dtb_path = self.extract_from_deb(deb_path, dtb_path) >>>> + rootfs_url = >>>> ('http://storage.kernelci.org/images/rootfs/buildroot/' >>>> + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') >>>> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' >>>> + rootfs_path_xz = self.fetch_asset(rootfs_url, >>>> asset_hash=rootfs_hash) >>>> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') >>>> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) >>>> + image_pow2ceil_expand(rootfs_path) >>>> + >>>> + self.vm.set_console() >>>> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>>> + 'console=ttyS0,115200 ' >>>> + 'root=/dev/mmcblk0 rootwait rw ' >>>> + 'panic=-1 noreboot') >>>> + self.vm.add_args('-kernel', kernel_path, >>>> + '-dtb', dtb_path, >>>> + '-drive', 'file=' + rootfs_path + >>>> ',if=sd,format=raw', >>>> + '-net', 'nic,model=gmac,netdev=host_gmac', >>>> + '-netdev', 'user,id=host_gmac', >>>> + '-append', kernel_command_line, >>>> + '-no-reboot') >>>> + self.vm.launch() >>>> + shell_ready = "/bin/sh: can't access tty; job control >>>> turned off" >>>> + self.wait_for_console_pattern(shell_ready) >>>> + >>>> + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', >>>> + 'Allwinner sun8i >>>> Family') >>>> + exec_command_and_wait_for_pattern(self, 'cat >>>> /proc/partitions', >>>> + 'mmcblk0') >>>> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', >>>> + 'eth0: Link is Up') >>>> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', >>>> + 'udhcpc: lease of 10.0.2.15 obtained') >>>> + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', >>>> + '3 packets transmitted, 3 packets received, 0% packet >>>> loss') >>>> + exec_command_and_wait_for_pattern(self, 'reboot', >>>> + 'reboot: >>>> Restarting system') >>>> + # Wait for VM to shut down gracefully >>>> + self.vm.wait() >>> >>> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI >>> runs: >>> >>> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 >>> >>> Looking at the debug.log in the artifacts, it looks like the kernel >>> was hanging during boot: >>> >>> 10:53:56 DEBUG| of_cfs_init >>> 10:53:56 DEBUG| of_cfs_init: OK >>> 10:53:56 DEBUG| ALSA device list: >>> 10:53:56 DEBUG| No soundcards found. >>> 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... >>> 10:54:26 DEBUG| dcdc4: disabling >>> 10:54:26 DEBUG| dc5ldo: disabling >>> 10:54:26 DEBUG| vcc5v0: disabling >>> 10:55:15 ERROR| >>> ... >>> 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM >>> >>> I can reproduce the problem locally on my laptop when running the >>> test repeatedly, e.g. with: >>> >>> make check-venv >>> for ((x=0;x<10;x++)); do \ >>> ./tests/venv/bin/avocado run \ >>> tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ >>> done >>> >>> 1 out of 10 runs were failing. >>> >>> Any ideas what could be wrong in those failing cases? >> Hi: >> >> I can reproduce this issue based on master >> code(v8.0.0-rc1-2442-g4d541f63e9) with your's >> test scripts, and I have tested 50 times only failed once. >> >> Copy liunx boot logs and make a diff: >> >> $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt > ... >> 288a289,291 >> > mmc1: host does not support reading read-only switch, assuming >> write-enable >> > mmc1: new high speed SD card at address 4567 >> > mmcblk1: mmc1:4567 QEMU! 64.0 MiB >> 296,298d298 >> < mmc0: host does not support reading read-only switch, assuming >> write-enable >> < mmc0: new high speed SD card at address 4567 >> < mmcblk0: mmc0:4567 QEMU! 64.0 MiB >> 322,331c322,325 >> < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem >> < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) >> < VFS: Mounted root (ext2 filesystem) on device 179:0. >> < devtmpfs: mounted >> < Freeing unused kernel memory: 1024K >> < Run /sbin/init as init process >> < EXT4-fs (mmcblk0): re-mounted. Opts: (null) >> < Starting syslogd: OK >> < Starting klogd: OK >> < Running sysctl: OK >> \ No newline at end of file >> --- >> > Waiting for root device /dev/mmcblk0... >> > dcdc4: disabling >> > dc5ldo: disabling >> > vcc5v0: disabling >> \ No newline at end of file >> >> The first mmc device should be mmc0, but the linux kernel named it as >> mmcblk1. >> So it always 'Waiting for root device /dev/mmcblk0...', that make the >> rootfs >> can not mounted. >> >> I'm not make sure where the problem came from. > > Oh, that's ugly, I think the problem is likely that the numbering > of device names that are directly in /dev/ is never guaranteed by > the Linux kernel. > > Could you please try whether this work more reliably for you > instead: > > diff a/tests/avocado/boot_linux_console.py > b/tests/avocado/boot_linux_console.py > --- a/tests/avocado/boot_linux_console.py > +++ b/tests/avocado/boot_linux_console.py > @@ -869,7 +869,7 @@ def test_arm_bpim2u_gmac(self): > self.vm.set_console() > kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + > 'console=ttyS0,115200 ' > - 'root=/dev/mmcblk0 rootwait rw ' > + 'root=b300 rootwait rw ' > 'panic=-1 noreboot') > self.vm.add_args('-kernel', kernel_path, > '-dtb', dtb_path, > > ? Yes, this patch is useful. The rootfs can mount successful even if the mmc block enumed as mmcblk1, next is the kernel logs: mmc1: new high speed SD card at address 4567 mmcblk1: mmc1:4567 QEMU! 64.0 MiB EXT4-fs (mmcblk1): mounting ext2 file system using the ext4 subsystem EXT4-fs (mmcblk1): mounted filesystem without journal. Opts: (null) VFS: Mounted root (ext2 filesystem) on device 179:0. But the test scripts still fail due to it always waiting mmc0blk: exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', 'mmcblk0') Could you please explain where is the "b300" come from? Thanks. > > Thomas
On 30/06/2023 10.45, qianfan wrote: > > > 在 2023/6/30 15:27, Thomas Huth 写道: >> On 30/06/2023 08.15, qianfan wrote: >>> >>> >>> 在 2023/6/29 19:35, Thomas Huth 写道: >>>> On 06/06/2023 11.47, Peter Maydell wrote: >>>>> From: qianfan Zhao <qianfanguijin@163.com> >>>>> >>>>> Add test case for booting from initrd and sd card. >>>>> >>>>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com> >>>>> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>>>> Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >>>>> --- >>>>> tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++ >>>>> 1 file changed, 176 insertions(+) >>>> ... >>>>> + def test_arm_bpim2u_gmac(self): >>>>> + """ >>>>> + :avocado: tags=arch:arm >>>>> + :avocado: tags=accel:tcg >>>>> + :avocado: tags=machine:bpim2u >>>>> + :avocado: tags=device:sd >>>>> + """ >>>>> + self.require_netdev('user') >>>>> + >>>>> + deb_url = >>>>> ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' >>>>> + 'linux-image-current-sunxi_21.02.2_armhf.deb') >>>>> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' >>>>> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) >>>>> + kernel_path = self.extract_from_deb(deb_path, >>>>> + '/boot/vmlinuz-5.10.16-sunxi') >>>>> + dtb_path = ('/usr/lib/linux-image-current-sunxi/' >>>>> + 'sun8i-r40-bananapi-m2-ultra.dtb') >>>>> + dtb_path = self.extract_from_deb(deb_path, dtb_path) >>>>> + rootfs_url = >>>>> ('http://storage.kernelci.org/images/rootfs/buildroot/' >>>>> + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') >>>>> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' >>>>> + rootfs_path_xz = self.fetch_asset(rootfs_url, >>>>> asset_hash=rootfs_hash) >>>>> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') >>>>> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) >>>>> + image_pow2ceil_expand(rootfs_path) >>>>> + >>>>> + self.vm.set_console() >>>>> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>>>> + 'console=ttyS0,115200 ' >>>>> + 'root=/dev/mmcblk0 rootwait rw ' >>>>> + 'panic=-1 noreboot') >>>>> + self.vm.add_args('-kernel', kernel_path, >>>>> + '-dtb', dtb_path, >>>>> + '-drive', 'file=' + rootfs_path + >>>>> ',if=sd,format=raw', >>>>> + '-net', 'nic,model=gmac,netdev=host_gmac', >>>>> + '-netdev', 'user,id=host_gmac', >>>>> + '-append', kernel_command_line, >>>>> + '-no-reboot') >>>>> + self.vm.launch() >>>>> + shell_ready = "/bin/sh: can't access tty; job control turned off" >>>>> + self.wait_for_console_pattern(shell_ready) >>>>> + >>>>> + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', >>>>> + 'Allwinner sun8i Family') >>>>> + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', >>>>> + 'mmcblk0') >>>>> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', >>>>> + 'eth0: Link is Up') >>>>> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', >>>>> + 'udhcpc: lease of 10.0.2.15 obtained') >>>>> + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', >>>>> + '3 packets transmitted, 3 packets received, 0% packet loss') >>>>> + exec_command_and_wait_for_pattern(self, 'reboot', >>>>> + 'reboot: Restarting >>>>> system') >>>>> + # Wait for VM to shut down gracefully >>>>> + self.vm.wait() >>>> >>>> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: >>>> >>>> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 >>>> >>>> Looking at the debug.log in the artifacts, it looks like the kernel was >>>> hanging during boot: >>>> >>>> 10:53:56 DEBUG| of_cfs_init >>>> 10:53:56 DEBUG| of_cfs_init: OK >>>> 10:53:56 DEBUG| ALSA device list: >>>> 10:53:56 DEBUG| No soundcards found. >>>> 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... >>>> 10:54:26 DEBUG| dcdc4: disabling >>>> 10:54:26 DEBUG| dc5ldo: disabling >>>> 10:54:26 DEBUG| vcc5v0: disabling >>>> 10:55:15 ERROR| >>>> ... >>>> 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM >>>> >>>> I can reproduce the problem locally on my laptop when running the test >>>> repeatedly, e.g. with: >>>> >>>> make check-venv >>>> for ((x=0;x<10;x++)); do \ >>>> ./tests/venv/bin/avocado run \ >>>> tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ >>>> done >>>> >>>> 1 out of 10 runs were failing. >>>> >>>> Any ideas what could be wrong in those failing cases? >>> Hi: >>> >>> I can reproduce this issue based on master >>> code(v8.0.0-rc1-2442-g4d541f63e9) with your's >>> test scripts, and I have tested 50 times only failed once. >>> >>> Copy liunx boot logs and make a diff: >>> >>> $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt >> ... >>> 288a289,291 >>> > mmc1: host does not support reading read-only switch, assuming >>> write-enable >>> > mmc1: new high speed SD card at address 4567 >>> > mmcblk1: mmc1:4567 QEMU! 64.0 MiB >>> 296,298d298 >>> < mmc0: host does not support reading read-only switch, assuming >>> write-enable >>> < mmc0: new high speed SD card at address 4567 >>> < mmcblk0: mmc0:4567 QEMU! 64.0 MiB >>> 322,331c322,325 >>> < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem >>> < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) >>> < VFS: Mounted root (ext2 filesystem) on device 179:0. >>> < devtmpfs: mounted >>> < Freeing unused kernel memory: 1024K >>> < Run /sbin/init as init process >>> < EXT4-fs (mmcblk0): re-mounted. Opts: (null) >>> < Starting syslogd: OK >>> < Starting klogd: OK >>> < Running sysctl: OK >>> \ No newline at end of file >>> --- >>> > Waiting for root device /dev/mmcblk0... >>> > dcdc4: disabling >>> > dc5ldo: disabling >>> > vcc5v0: disabling >>> \ No newline at end of file >>> >>> The first mmc device should be mmc0, but the linux kernel named it as >>> mmcblk1. >>> So it always 'Waiting for root device /dev/mmcblk0...', that make the rootfs >>> can not mounted. >>> >>> I'm not make sure where the problem came from. >> >> Oh, that's ugly, I think the problem is likely that the numbering >> of device names that are directly in /dev/ is never guaranteed by >> the Linux kernel. >> >> Could you please try whether this work more reliably for you >> instead: >> >> diff a/tests/avocado/boot_linux_console.py >> b/tests/avocado/boot_linux_console.py >> --- a/tests/avocado/boot_linux_console.py >> +++ b/tests/avocado/boot_linux_console.py >> @@ -869,7 +869,7 @@ def test_arm_bpim2u_gmac(self): >> self.vm.set_console() >> kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >> 'console=ttyS0,115200 ' >> - 'root=/dev/mmcblk0 rootwait rw ' >> + 'root=b300 rootwait rw ' >> 'panic=-1 noreboot') >> self.vm.add_args('-kernel', kernel_path, >> '-dtb', dtb_path, >> >> ? > Yes, this patch is useful. > > The rootfs can mount successful even if the mmc block enumed as mmcblk1, > next is the > kernel logs: > > mmc1: new high speed SD card at address 4567 > mmcblk1: mmc1:4567 QEMU! 64.0 MiB > EXT4-fs (mmcblk1): mounting ext2 file system using the ext4 subsystem > EXT4-fs (mmcblk1): mounted filesystem without journal. Opts: (null) > VFS: Mounted root (ext2 filesystem) on device 179:0. Great! > But the test scripts still fail due to it always waiting mmc0blk: > > exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', 'mmcblk0') Ok, so the "0" likely got to be dropped here? > Could you please explain where is the "b300" come from? I ran the kernel once without the "root=/dev/mmcblk0 rootwait" part in its command line. Then it prints out something like this: VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions: 0100 4096 ram0 (driver?) 0101 4096 ram1 (driver?) 0102 4096 ram2 (driver?) 0103 4096 ram3 (driver?) b300 65536 mmcblk0 driver: mmcblk Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) Seems like the "b300" is stable here, no matter whether its mmcblk0 or mmcblk1. Thomas
在 2023/6/30 16:53, Thomas Huth 写道: > On 30/06/2023 10.45, qianfan wrote: >> >> >> 在 2023/6/30 15:27, Thomas Huth 写道: >>> On 30/06/2023 08.15, qianfan wrote: >>>> >>>> >>>> 在 2023/6/29 19:35, Thomas Huth 写道: >>>>> On 06/06/2023 11.47, Peter Maydell wrote: >>>>>> From: qianfan Zhao <qianfanguijin@163.com> >>>>>> >>>>>> Add test case for booting from initrd and sd card. >>>>>> >>>>>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com> >>>>>> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>>>>> Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> >>>>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> >>>>>> --- >>>>>> tests/avocado/boot_linux_console.py | 176 >>>>>> ++++++++++++++++++++++++++++ >>>>>> 1 file changed, 176 insertions(+) >>>>> ... >>>>>> + def test_arm_bpim2u_gmac(self): >>>>>> + """ >>>>>> + :avocado: tags=arch:arm >>>>>> + :avocado: tags=accel:tcg >>>>>> + :avocado: tags=machine:bpim2u >>>>>> + :avocado: tags=device:sd >>>>>> + """ >>>>>> + self.require_netdev('user') >>>>>> + >>>>>> + deb_url = >>>>>> ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' >>>>>> + 'linux-image-current-sunxi_21.02.2_armhf.deb') >>>>>> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' >>>>>> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) >>>>>> + kernel_path = self.extract_from_deb(deb_path, >>>>>> + '/boot/vmlinuz-5.10.16-sunxi') >>>>>> + dtb_path = ('/usr/lib/linux-image-current-sunxi/' >>>>>> + 'sun8i-r40-bananapi-m2-ultra.dtb') >>>>>> + dtb_path = self.extract_from_deb(deb_path, dtb_path) >>>>>> + rootfs_url = >>>>>> ('http://storage.kernelci.org/images/rootfs/buildroot/' >>>>>> + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') >>>>>> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' >>>>>> + rootfs_path_xz = self.fetch_asset(rootfs_url, >>>>>> asset_hash=rootfs_hash) >>>>>> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') >>>>>> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) >>>>>> + image_pow2ceil_expand(rootfs_path) >>>>>> + >>>>>> + self.vm.set_console() >>>>>> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>>>>> + 'console=ttyS0,115200 ' >>>>>> + 'root=/dev/mmcblk0 rootwait rw ' >>>>>> + 'panic=-1 noreboot') >>>>>> + self.vm.add_args('-kernel', kernel_path, >>>>>> + '-dtb', dtb_path, >>>>>> + '-drive', 'file=' + rootfs_path + >>>>>> ',if=sd,format=raw', >>>>>> + '-net', 'nic,model=gmac,netdev=host_gmac', >>>>>> + '-netdev', 'user,id=host_gmac', >>>>>> + '-append', kernel_command_line, >>>>>> + '-no-reboot') >>>>>> + self.vm.launch() >>>>>> + shell_ready = "/bin/sh: can't access tty; job control >>>>>> turned off" >>>>>> + self.wait_for_console_pattern(shell_ready) >>>>>> + >>>>>> + exec_command_and_wait_for_pattern(self, 'cat >>>>>> /proc/cpuinfo', >>>>>> + 'Allwinner sun8i Family') >>>>>> + exec_command_and_wait_for_pattern(self, 'cat >>>>>> /proc/partitions', >>>>>> + 'mmcblk0') >>>>>> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', >>>>>> + 'eth0: Link is >>>>>> Up') >>>>>> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', >>>>>> + 'udhcpc: lease of 10.0.2.15 obtained') >>>>>> + exec_command_and_wait_for_pattern(self, 'ping -c 3 >>>>>> 10.0.2.2', >>>>>> + '3 packets transmitted, 3 packets received, 0% >>>>>> packet loss') >>>>>> + exec_command_and_wait_for_pattern(self, 'reboot', >>>>>> + 'reboot: Restarting system') >>>>>> + # Wait for VM to shut down gracefully >>>>>> + self.vm.wait() >>>>> >>>>> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI >>>>> runs: >>>>> >>>>> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 >>>>> >>>>> Looking at the debug.log in the artifacts, it looks like the >>>>> kernel was hanging during boot: >>>>> >>>>> 10:53:56 DEBUG| of_cfs_init >>>>> 10:53:56 DEBUG| of_cfs_init: OK >>>>> 10:53:56 DEBUG| ALSA device list: >>>>> 10:53:56 DEBUG| No soundcards found. >>>>> 10:53:56 DEBUG| Waiting for root device /dev/mmcblk0... >>>>> 10:54:26 DEBUG| dcdc4: disabling >>>>> 10:54:26 DEBUG| dc5ldo: disabling >>>>> 10:54:26 DEBUG| vcc5v0: disabling >>>>> 10:55:15 ERROR| >>>>> ... >>>>> 10:55:15 ERROR| RuntimeError: Test interrupted by SIGTERM >>>>> >>>>> I can reproduce the problem locally on my laptop when running the >>>>> test repeatedly, e.g. with: >>>>> >>>>> make check-venv >>>>> for ((x=0;x<10;x++)); do \ >>>>> ./tests/venv/bin/avocado run \ >>>>> tests/avocado/boot_linux_console.py:test_arm_bpim2u_gmac ; \ >>>>> done >>>>> >>>>> 1 out of 10 runs were failing. >>>>> >>>>> Any ideas what could be wrong in those failing cases? >>>> Hi: >>>> >>>> I can reproduce this issue based on master >>>> code(v8.0.0-rc1-2442-g4d541f63e9) with your's >>>> test scripts, and I have tested 50 times only failed once. >>>> >>>> Copy liunx boot logs and make a diff: >>>> >>>> $ diff ~/a/qemu_bpi_good.txt ~/a/qemu_bpi_bad.txt >>> ... >>>> 288a289,291 >>>> > mmc1: host does not support reading read-only switch, assuming >>>> write-enable >>>> > mmc1: new high speed SD card at address 4567 >>>> > mmcblk1: mmc1:4567 QEMU! 64.0 MiB >>>> 296,298d298 >>>> < mmc0: host does not support reading read-only switch, assuming >>>> write-enable >>>> < mmc0: new high speed SD card at address 4567 >>>> < mmcblk0: mmc0:4567 QEMU! 64.0 MiB >>>> 322,331c322,325 >>>> < EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 >>>> subsystem >>>> < EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) >>>> < VFS: Mounted root (ext2 filesystem) on device 179:0. >>>> < devtmpfs: mounted >>>> < Freeing unused kernel memory: 1024K >>>> < Run /sbin/init as init process >>>> < EXT4-fs (mmcblk0): re-mounted. Opts: (null) >>>> < Starting syslogd: OK >>>> < Starting klogd: OK >>>> < Running sysctl: OK >>>> \ No newline at end of file >>>> --- >>>> > Waiting for root device /dev/mmcblk0... >>>> > dcdc4: disabling >>>> > dc5ldo: disabling >>>> > vcc5v0: disabling >>>> \ No newline at end of file >>>> >>>> The first mmc device should be mmc0, but the linux kernel named it >>>> as mmcblk1. >>>> So it always 'Waiting for root device /dev/mmcblk0...', that make >>>> the rootfs >>>> can not mounted. >>>> >>>> I'm not make sure where the problem came from. >>> >>> Oh, that's ugly, I think the problem is likely that the numbering >>> of device names that are directly in /dev/ is never guaranteed by >>> the Linux kernel. >>> >>> Could you please try whether this work more reliably for you >>> instead: >>> >>> diff a/tests/avocado/boot_linux_console.py >>> b/tests/avocado/boot_linux_console.py >>> --- a/tests/avocado/boot_linux_console.py >>> +++ b/tests/avocado/boot_linux_console.py >>> @@ -869,7 +869,7 @@ def test_arm_bpim2u_gmac(self): >>> self.vm.set_console() >>> kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>> 'console=ttyS0,115200 ' >>> - 'root=/dev/mmcblk0 rootwait rw ' >>> + 'root=b300 rootwait rw ' >>> 'panic=-1 noreboot') >>> self.vm.add_args('-kernel', kernel_path, >>> '-dtb', dtb_path, >>> >>> ? >> Yes, this patch is useful. >> >> The rootfs can mount successful even if the mmc block enumed as >> mmcblk1, next is the >> kernel logs: >> >> mmc1: new high speed SD card at address 4567 >> mmcblk1: mmc1:4567 QEMU! 64.0 MiB >> EXT4-fs (mmcblk1): mounting ext2 file system using the ext4 subsystem >> EXT4-fs (mmcblk1): mounted filesystem without journal. Opts: (null) >> VFS: Mounted root (ext2 filesystem) on device 179:0. > > Great! > >> But the test scripts still fail due to it always waiting mmc0blk: >> >> exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', >> 'mmcblk0') > > Ok, so the "0" likely got to be dropped here? > >> Could you please explain where is the "b300" come from? > > I ran the kernel once without the "root=/dev/mmcblk0 rootwait" > part in its command line. Then it prints out something like this: > > VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 > Please append a correct "root=" boot option; here are the available > partitions: > 0100 4096 ram0 > (driver?) > 0101 4096 ram1 > (driver?) > 0102 4096 ram2 > (driver?) > 0103 4096 ram3 > (driver?) > b300 65536 mmcblk0 > driver: mmcblk > Kernel panic - not syncing: VFS: Unable to mount root fs on > unknown-block(0,0) > > Seems like the "b300" is stable here, no matter whether > its mmcblk0 or mmcblk1. This way is really hack. And who case this issue, linux kernel or qemu? I can't make sure. > > Thomas
On 30/06/2023 11.04, qianfan wrote: > > > 在 2023/6/30 16:53, Thomas Huth 写道: >> On 30/06/2023 10.45, qianfan wrote: >>> >>> >>> 在 2023/6/30 15:27, Thomas Huth 写道: >>>> On 30/06/2023 08.15, qianfan wrote: >>>>> >>>>> >>>>> 在 2023/6/29 19:35, Thomas Huth 写道: >>>>>> On 06/06/2023 11.47, Peter Maydell wrote: >>>>>>> From: qianfan Zhao <qianfanguijin@163.com> >>>>>>> >>>>>>> Add test case for booting from initrd and sd card. ... >>>>>> >>>>>> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: >>>>>> >>>>>> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 ... >>>> Oh, that's ugly, I think the problem is likely that the numbering >>>> of device names that are directly in /dev/ is never guaranteed by >>>> the Linux kernel. >>>> >>>> Could you please try whether this work more reliably for you >>>> instead: >>>> >>>> diff a/tests/avocado/boot_linux_console.py >>>> b/tests/avocado/boot_linux_console.py >>>> --- a/tests/avocado/boot_linux_console.py >>>> +++ b/tests/avocado/boot_linux_console.py >>>> @@ -869,7 +869,7 @@ def test_arm_bpim2u_gmac(self): >>>> self.vm.set_console() >>>> kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + >>>> 'console=ttyS0,115200 ' >>>> - 'root=/dev/mmcblk0 rootwait rw ' >>>> + 'root=b300 rootwait rw ' >>>> 'panic=-1 noreboot') >>>> self.vm.add_args('-kernel', kernel_path, >>>> '-dtb', dtb_path, >>>> >>>> ? >>> Yes, this patch is useful. >>> >>> The rootfs can mount successful even if the mmc block enumed as mmcblk1, >>> next is the >>> kernel logs: >>> >>> mmc1: new high speed SD card at address 4567 >>> mmcblk1: mmc1:4567 QEMU! 64.0 MiB >>> EXT4-fs (mmcblk1): mounting ext2 file system using the ext4 subsystem >>> EXT4-fs (mmcblk1): mounted filesystem without journal. Opts: (null) >>> VFS: Mounted root (ext2 filesystem) on device 179:0. >> >> Great! >> >>> But the test scripts still fail due to it always waiting mmc0blk: >>> >>> exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', >>> 'mmcblk0') >> >> Ok, so the "0" likely got to be dropped here? >> >>> Could you please explain where is the "b300" come from? >> >> I ran the kernel once without the "root=/dev/mmcblk0 rootwait" >> part in its command line. Then it prints out something like this: >> >> VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 >> Please append a correct "root=" boot option; here are the available >> partitions: >> 0100 4096 ram0 >> (driver?) >> 0101 4096 ram1 >> (driver?) >> 0102 4096 ram2 >> (driver?) >> 0103 4096 ram3 >> (driver?) >> b300 65536 mmcblk0 >> driver: mmcblk >> Kernel panic - not syncing: VFS: Unable to mount root fs on >> unknown-block(0,0) >> >> Seems like the "b300" is stable here, no matter whether >> its mmcblk0 or mmcblk1. > This way is really hack. Ack, it's not really nice - but it's still better than a flaky, unreliable test, isn't it? I'll send it as a proper patch for discussion. > And who case this issue, linux kernel or qemu? I > can't make sure. It's likely the Linux kernel - I think the numbering of entries in /dev/ is not guaranteed. Thomas
On Fri, 30 Jun 2023 at 16:45, Thomas Huth <thuth@redhat.com> wrote: > > On 30/06/2023 11.04, qianfan wrote: > > > > > > 在 2023/6/30 16:53, Thomas Huth 写道: > >> On 30/06/2023 10.45, qianfan wrote: > >>> > >>> > >>> 在 2023/6/30 15:27, Thomas Huth 写道: > >>>> On 30/06/2023 08.15, qianfan wrote: > >>>>> > >>>>> > >>>>> 在 2023/6/29 19:35, Thomas Huth 写道: > >>>>>> On 06/06/2023 11.47, Peter Maydell wrote: > >>>>>>> From: qianfan Zhao <qianfanguijin@163.com> > >>>>>>> > >>>>>>> Add test case for booting from initrd and sd card. > ... > >>>>>> > >>>>>> FYI, the test_arm_bpim2u_gmac test just failed during one of my CI runs: > >>>>>> > >>>>>> https://gitlab.com/thuth/qemu/-/jobs/4565108610#L300 > ... > >>>> Oh, that's ugly, I think the problem is likely that the numbering > >>>> of device names that are directly in /dev/ is never guaranteed by > >>>> the Linux kernel. > >>>> > >>>> Could you please try whether this work more reliably for you > >>>> instead: > >>>> > >>>> diff a/tests/avocado/boot_linux_console.py > >>>> b/tests/avocado/boot_linux_console.py > >>>> --- a/tests/avocado/boot_linux_console.py > >>>> +++ b/tests/avocado/boot_linux_console.py > >>>> @@ -869,7 +869,7 @@ def test_arm_bpim2u_gmac(self): > >>>> self.vm.set_console() > >>>> kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + > >>>> 'console=ttyS0,115200 ' > >>>> - 'root=/dev/mmcblk0 rootwait rw ' > >>>> + 'root=b300 rootwait rw ' > >>>> 'panic=-1 noreboot') > >>>> self.vm.add_args('-kernel', kernel_path, > >>>> '-dtb', dtb_path, > >>>> > >>>> ? > >>> Yes, this patch is useful. > >>> > >>> The rootfs can mount successful even if the mmc block enumed as mmcblk1, > >>> next is the > >>> kernel logs: > >>> > >>> mmc1: new high speed SD card at address 4567 > >>> mmcblk1: mmc1:4567 QEMU! 64.0 MiB > >>> EXT4-fs (mmcblk1): mounting ext2 file system using the ext4 subsystem > >>> EXT4-fs (mmcblk1): mounted filesystem without journal. Opts: (null) > >>> VFS: Mounted root (ext2 filesystem) on device 179:0. > >> > >> Great! > >> > >>> But the test scripts still fail due to it always waiting mmc0blk: > >>> > >>> exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', > >>> 'mmcblk0') > >> > >> Ok, so the "0" likely got to be dropped here? > >> > >>> Could you please explain where is the "b300" come from? > >> > >> I ran the kernel once without the "root=/dev/mmcblk0 rootwait" > >> part in its command line. Then it prints out something like this: > >> > >> VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 > >> Please append a correct "root=" boot option; here are the available > >> partitions: > >> 0100 4096 ram0 > >> (driver?) > >> 0101 4096 ram1 > >> (driver?) > >> 0102 4096 ram2 > >> (driver?) > >> 0103 4096 ram3 > >> (driver?) > >> b300 65536 mmcblk0 > >> driver: mmcblk > >> Kernel panic - not syncing: VFS: Unable to mount root fs on > >> unknown-block(0,0) > >> > >> Seems like the "b300" is stable here, no matter whether > >> its mmcblk0 or mmcblk1. > > This way is really hack. > > Ack, it's not really nice - but it's still better than a flaky, unreliable > test, isn't it? > > I'll send it as a proper patch for discussion. > > > And who case this issue, linux kernel or qemu? I > > can't make sure. > > It's likely the Linux kernel - I think the numbering of entries in /dev/ is > not guaranteed. See the thread https://lore.kernel.org/qemu-devel/01087628-44c0-2b15-61bc-8677b7d1b459@roeck-us.net/ where Guenter concluded that this is a bug in the device tree: it tells the kernel to probe all 3 MMC controllers in parallel and doesn't give them specific names, so the order is always random. The fix is probably for the kernel to update its DT and then our test case can be updated to use a fixed DT. thanks -- PMM
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py index c0675809e64..6ed660611fe 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -769,6 +769,182 @@ def test_arm_quanta_gsj_initrd(self): self.wait_for_console_pattern( 'Give root password for system maintenance') + def test_arm_bpim2u(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:bpim2u + :avocado: tags=accel:tcg + """ + deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' + 'linux-image-current-sunxi_21.02.2_armhf.deb') + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-5.10.16-sunxi') + dtb_path = ('/usr/lib/linux-image-current-sunxi/' + 'sun8i-r40-bananapi-m2-ultra.dtb') + dtb_path = self.extract_from_deb(deb_path, dtb_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200n8 ' + 'earlycon=uart,mmio32,0x1c28000') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + + def test_arm_bpim2u_initrd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=accel:tcg + :avocado: tags=machine:bpim2u + """ + deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' + 'linux-image-current-sunxi_21.02.2_armhf.deb') + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-5.10.16-sunxi') + dtb_path = ('/usr/lib/linux-image-current-sunxi/' + 'sun8i-r40-bananapi-m2-ultra.dtb') + dtb_path = self.extract_from_deb(deb_path, dtb_path) + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' + 'arm/rootfs-armv7a.cpio.gz') + initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c' + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + initrd_path = os.path.join(self.workdir, 'rootfs.cpio') + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200 ' + 'panic=-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'Allwinner sun8i Family') + exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', + 'system-control@1c00000') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + # Wait for VM to shut down gracefully + self.vm.wait() + + def test_arm_bpim2u_gmac(self): + """ + :avocado: tags=arch:arm + :avocado: tags=accel:tcg + :avocado: tags=machine:bpim2u + :avocado: tags=device:sd + """ + self.require_netdev('user') + + deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/' + 'linux-image-current-sunxi_21.02.2_armhf.deb') + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-5.10.16-sunxi') + dtb_path = ('/usr/lib/linux-image-current-sunxi/' + 'sun8i-r40-bananapi-m2-ultra.dtb') + dtb_path = self.extract_from_deb(deb_path, dtb_path) + rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/' + 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' + rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) + image_pow2ceil_expand(rootfs_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200 ' + 'root=/dev/mmcblk0 rootwait rw ' + 'panic=-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', + '-net', 'nic,model=gmac,netdev=host_gmac', + '-netdev', 'user,id=host_gmac', + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + shell_ready = "/bin/sh: can't access tty; job control turned off" + self.wait_for_console_pattern(shell_ready) + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'Allwinner sun8i Family') + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', + 'mmcblk0') + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', + 'eth0: Link is Up') + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', + 'udhcpc: lease of 10.0.2.15 obtained') + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + '3 packets transmitted, 3 packets received, 0% packet loss') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + # Wait for VM to shut down gracefully + self.vm.wait() + + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') + def test_arm_bpim2u_openwrt_22_03_3(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:bpim2u + :avocado: tags=device:sd + """ + + # This test download a 8.9 MiB compressed image and expand it + # to 127 MiB. + image_url = ('https://downloads.openwrt.org/releases/22.03.3/targets/' + 'sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-' + 'sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz') + image_hash = ('5b41b4e11423e562c6011640f9a7cd3b' + 'dd0a3d42b83430f7caa70a432e6cd82c') + image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash, + algorithm='sha256') + image_path = archive.extract(image_path_gz, self.workdir) + image_pow2ceil_expand(image_path) + + self.vm.set_console() + self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw', + '-nic', 'user', + '-no-reboot') + self.vm.launch() + + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'usbcore.nousb ' + 'noreboot') + + self.wait_for_console_pattern('U-Boot SPL') + + interrupt_interactive_console_until_pattern( + self, 'Hit any key to stop autoboot:', '=>') + exec_command_and_wait_for_pattern(self, "setenv extraargs '" + + kernel_command_line + "'", '=>') + exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...'); + + self.wait_for_console_pattern( + 'Please press Enter to activate this console.') + + exec_command_and_wait_for_pattern(self, ' ', 'root@') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'Allwinner sun8i Family') + exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', + 'system-control@1c00000') + def test_arm_orangepi(self): """ :avocado: tags=arch:arm