oeqa/qemurunner: Add newlines serial workaround
PATCH 1/2 oeqa/qemurunner: Add newlines serial workaround
We're struggling with the 6.5 kernel as the serial port getty doesn't appears sometimes leading to failures in CI. Add a workaround of sending some newlines as a way of unblocking the kernel/release issues whilst we try and work out how to get to the bottom of the issue.
Signed-off-by Richard Purdie <[email protected]>
--- meta/lib/oeqa/utils/qemurunner.py | 9 +++++++++ 1 file changed, 9 insertions(+)
meta/lib/oeqa/utils/qemurunner.py +9 -0
@@ -444,9 +444,11 @@ class QemuRunner: self.logger.debug("Waiting at most %d seconds for login banner (%s)" % (self.boottime, time.strftime("%D %H:%M:%S"))) endtime = time.time() + self.boottime + newlinetime = time.time() + 120 filelist = [self.server_socket, self.runqemu.stdout] reachedlogin = False stopread = False + sentnewlines = False qemusock = None bootlog = b'' data = b''
@@ -455,6 +457,13 @@ class QemuRunner: sread, swrite, serror = select.select(filelist, [], [], 5) except InterruptedError: continue + # With the 6.5 kernel, the serial port getty sometimes fails to appear, the data + # appears lost in some buffer somewhere. Wait two minutes, then if we've not had a login, + # try and provoke one. This is a workaround until we can work out the root cause. + if time.time() > newlinetime and not sentnewlines: + self.logger.warning('Probing the serial port to wake it up!') + self.server_socket.sendall(bytes("\n\n", "utf-8")) + sentnewlines = True for file in sread: if file is self.server_socket: qemusock, addr = self.server_socket.accept()
Signature · 1 line
2.39.2
PATCH 2/2 runqemu/qemurunner: Use nodelay with tcp serial connections
This disables Nagle's algorithm for our tcp serial connections which may be causing data transfer issues.
Signed-off-by Richard Purdie <[email protected]>
--- meta/conf/machine/include/loongarch/qemuloongarch.inc | 2 +- meta/conf/machine/include/riscv/qemuriscv.inc | 2 +- meta/conf/machine/qemuarm.conf | 2 +- meta/conf/machine/qemuarm64.conf | 2 +- meta/lib/oeqa/utils/qemurunner.py | 1 + scripts/runqemu | 4 ++-- 6 files changed, 7 insertions(+), 6 deletions(-)
meta/conf/machine/include/loongarch/qemuloongarch.inc +1 -1
@@ -30,6 +30,6 @@ QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@" QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" QB_SERIAL_OPT = "-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon" -QB_TCPSERIAL_OPT = " -device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon" +QB_TCPSERIAL_OPT = " -device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon" # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy QB_OPT_APPEND = " -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0"
meta/conf/machine/include/riscv/qemuriscv.inc +1 -1
@@ -33,6 +33,6 @@ QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@" QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon" -QB_TCPSERIAL_OPT = " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon" +QB_TCPSERIAL_OPT = " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon" QB_GRAPHICS = "-device bochs-display" QB_OPT_APPEND = "-device virtio-tablet-pci -device virtio-keyboard-pci"
meta/conf/machine/qemuarm.conf +1 -1
@@ -26,6 +26,6 @@ QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@" QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" # Virtio serial console QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon" -QB_TCPSERIAL_OPT = "-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon" +QB_TCPSERIAL_OPT = "-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon" KMACHINE:qemuarm = "qemuarma15"
meta/conf/machine/qemuarm64.conf +1 -1
@@ -27,4 +27,4 @@ QB_NETWORK_DEVICE = "-device virtio-net-pci,netdev=net0,mac=@MAC@" QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-pci,drive=disk0" # Virtio serial console QB_SERIAL_OPT = "-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon" -QB_TCPSERIAL_OPT = "-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon" +QB_TCPSERIAL_OPT = "-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon"
meta/lib/oeqa/utils/qemurunner.py +1 -0
@@ -97,6 +97,7 @@ class QemuRunner: try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setblocking(0) + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) sock.bind(("127.0.0.1",0)) sock.listen(2) port = sock.getsockname()[1]
scripts/runqemu +2 -2
@@ -842,11 +842,11 @@ to your build configuration. if self.get('QB_TCPSERIAL_OPT'): self.qemu_opt_script += ' ' + self.get('QB_TCPSERIAL_OPT').replace('@PORT@', port) else: - self.qemu_opt_script += ' -serial tcp:127.0.0.1:%s' % port + self.qemu_opt_script += ' -serial tcp:127.0.0.1:%s,nodelay=on' % port if len(ports) > 1: for port in ports[1:]: - self.qemu_opt_script += ' -serial tcp:127.0.0.1:%s' % port + self.qemu_opt_script += ' -serial tcp:127.0.0.1:%s,nodelay=on' % port def check_and_set(self): """Check configs sanity and set when needed"""
Signature · 1 line
2.39.2
Reviewed-by Mikko Rapeli <[email protected]>