kvm tools: Fix serial port probing
PATCH 1/1 kvm tools: Fix serial port probing
The process of probing the 8250 serial port is as follows:
1. Start detecting IRQs
2. Enable the IER register [At this point, the port is supposed to light the INTR].
3. Stop detecting IRQs [At this point, the driver detects which IRQ belongs to that port].
4. Disable IER register.
Since we weren't enabling and disabling the IRQ based on IER writes, we would often fail the probing since the driver couldn't detect which IRQ is used by the port, and would just default that to 0.
This would cause slowness and may have caused hangs. For me there is a significant increase in speed of the terminal after this patch.
--- tools/kvm/hw/serial.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
tools/kvm/hw/serial.c +1 -0
@@ -233,6 +233,7 @@ static bool serial8250_out(struct ioport *ioport, struct kvm *kvm, u16 port, voibreak ;case UART_IER : dev->ier =ioport__read8 (data) &0x3f ; +kvm__irq_line (kvm, dev->irq, dev->ier?1 :0 );break ;case UART_LCR : dev->lcr =ioport__read8 (data);
Signature · 1 line
1.7.8
Pekka Enberg
AppliedQuoted 27 lines · Sasha Levin
The process of probing the 8250 serial port is as follows:
1. Start detecting IRQs
2. Enable the IER register [At this point, the port is supposed to light the INTR].
3. Stop detecting IRQs [At this point, the driver detects which IRQ belongs to that port].
4. Disable IER register.Since we weren't enabling and disabling the IRQ based on IER writes, we would often fail the probing since the driver couldn't detect which IRQ is used by the port, and would just default that to 0.
This would cause slowness and may have caused hangs. For me there is a significant increase in speed of the terminal after this patch.
Signed-off-by Sasha Levin <[email protected]>---
tools/kvm/hw/serial.c | 1 +1 files changed, 1 insertions(+), 0 deletions(-)tools/kvm/hw/serial.c +0
-0@@ -233,6 +233,7 @@ static bool serial8250_out(struct ioport *ioport, struct kvm *kvm, u16 port, voi break;
Quoted 6 lines
case
UART_IER:
dev->ier =ioport__read8(data)&0x3f;
+kvm__irq_line(kvm, dev->irq, dev->ier?1:0); break;
caseUART_LCR:
dev->lcr =ioport__read8(data);
Applied, thanks!
Ingo, does this fix the occasional slowdowns you are seeing?
Quoted 9 lines · Pekka Enberg
Quoted 5 lines
dev->ier =
ioport__read8(data)&0x3f;
+kvm__irq_line(kvm, dev->irq, dev->ier?1:0); break;
caseUART_LCR:
dev->lcr =ioport__read8(data);Applied, thanks!
Ingo, does this fix the occasional slowdowns you are seeing?
Indeed it does!
I still see things like 'top' refreshes progressing - i.e. taking something like 100-200 msecs to finish, but it's a *lot* faster now.
Thanks,
Ingo