Skip to contentSkip to conversation

KVM serial8250: too much work for irq3

Qemu-devel Denys Zagorui 3 participants 3 messages Sep 22, 2017 – Jan 11, 2019

lore
Share & tools
lore
#0 lore raw

Hello

This is known issue, it was mentioned at first time about 9 years ago.

https://lkml.org/lkml/2008/2/5/401

https://bugzilla.redhat.com/show_bug.cgi?id=986761

But it seems not fixed. I tested on my setup.

My Host machine Debian Stretch (kernel 4.9-30), Guest vanilla kernel 4.4-76. Tried on Qemu  2.8 and 2.10

qemu-system-x86_64 -name guest=guest,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-7-guest/master-key.aes -machine pc-i440fx-2.8,accel=kvm,usb=off,dump-guest-core=off -cpu SkylakeClient,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds_cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,osxsave=on,tsc_adjust=on,clflushopt=on,pdpe1gb=on -m 4096 -realtime mlock=off -smp 4,sockets=1,cores=4,threads=1 -uuid 4537ca29-73b2-40c3-9b43-666de182ba5f -display none -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-7-guest/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x8.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x8 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x8.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x8.0x2 -drive file=/home/dzagorui/csr/csr_disk.qcow2,format=qcow2,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -netdev tap,fd=25,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:a9:4c:86,bus=pci.0,addr=0x3 -netdev tap,fd=27,id=hostnet1 -device e1000,netdev=hostnet1,id=net1,mac=52:54:00:d4:7f:fa,bus=pci.0,addr=0x4 -netdev tap,fd=28,id=hostnet2 -device e1000,netdev=hostnet2,id=net2,mac=52:54:00:d6:ec:f6,bus=pci.0,addr=0x5 -netdev tap,fd=29,id=hostnet3 -device e1000,netdev=hostnet3,id=net3,mac=52:54:00:99:2b:46,bus=pci.0,addr=0xa -chardev socket,id=charserial0,host=127.0.0.1,port=4000,telnet,server,nowait -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charserial1,host=127.0.0.1,port=4001,telnet,server,nowait -device isa-serial,chardev=charserial1,id=serial1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 -msg timestamp=on

With this 100% reproduce:

dd if=/dev/zero of=/dev/ttyS1

And there is fix proposed by H. Peter Anvin in 2008

https://lkml.org/lkml/2008/2/7/485

So maybe it needs to be reworked?

Regards,

Denys

#1 lore raw
Quoted 7 lines · Denys Zagorui

Hello

This is known issue, it was mentioned at first time about 9 years ago.

https://lkml.org/lkml/2008/2/5/401

https://bugzilla.redhat.com/show_bug.cgi?id=986761

The issue is simply that QEMU disregards the baud rate that the guest programs into the serial port. H. Peter Anvin's patch, which you mention, is only a band aid that is geared specifically at avoiding Linux's error.

It was fixed for real in commit 6936bfe514bbac7af4b24fad9ed9688b78b5be69 by implementing a baud rate timer (May 2008), but then undone in fcfb4d6aae611d1f804d486d3c998000912c4c81 (March 2013) when the serial port got flow control support.

Part of the reason may have been laziness, but also there are reasons to keep it this way. Basically, the baud rate timer was implemented also in order to mitigate the problem with losing characters sent by the guest on the serial console; and thanks to flow control, QEMU will already slow down the transmit so that the other side never loses characters. And because looking at logs on a serial console bps is slow and mildly annoying even at 115200 bps, it was decided that the "too much work" error was the lesser evil.

Thanks,

Paolo

#2 lore raw
Quoted 32 lines · Paolo Bonzini
Quoted 3 lines · Denys Zagorui

Hello

This is known issue, it was mentioned at first time about 9 years

ago.

Quoted 4 lines

https://lkml.org/lkml/2008/2/5/401

https://bugzilla.redhat.com/show_bug.cgi?id=986761

The issue is simply that QEMU disregards the baud rate that the guest programs into the serial port. H. Peter Anvin's patch, which you mention, is only a band aid that is geared specifically at avoiding Linux's error.

It was fixed for real in commit 6936bfe514bbac7af4b24fad9ed9688b78b5be69
by implementing a baud rate timer (May 2008), but then undone in fcfb4d6aae611d1f804d486d3c998000912c4c81 (March 2013) when the serial port got flow control support.

Part of the reason may have been laziness, but also there are reasons to
keep it this way. Basically, the baud rate timer was implemented also in order to mitigate the problem with losing characters sent by the guest on the serial console; and thanks to flow control, QEMU will already slow down the transmit so that the other side never loses characters. And because looking at logs on a serial console bps is slow
and mildly annoying even at 115200 bps, it was decided that the "too much work" error was the lesser evil.

Quoted 3 lines

Thanks,

Paolo

In the case of the lesser evil it would seem that the hack I did would be good enough.

A hardware high bandwidth UART simulating device would have to do the best same in some way.

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.