kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm tools: Fix serial port probing
@ 2011-12-09 11:16 Sasha Levin
  2011-12-09 11:47 ` Pekka Enberg
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2011-12-09 11:16 UTC (permalink / raw)
  To: penberg; +Cc: mingo, gorcunov, asias.hejun, kvm, 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 <levinsasha928@gmail.com>
---
 tools/kvm/hw/serial.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
index 67a2007..8cd47cf 100644
--- a/tools/kvm/hw/serial.c
+++ b/tools/kvm/hw/serial.c
@@ -233,6 +233,7 @@ static bool serial8250_out(struct ioport *ioport, struct kvm *kvm, u16 port, voi
 			break;
 		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);
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm tools: Fix serial port probing
  2011-12-09 11:16 [PATCH] kvm tools: Fix serial port probing Sasha Levin
@ 2011-12-09 11:47 ` Pekka Enberg
  2011-12-09 20:10   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Pekka Enberg @ 2011-12-09 11:47 UTC (permalink / raw)
  To: Sasha Levin; +Cc: mingo, gorcunov, asias.hejun, kvm

On Fri, Dec 9, 2011 at 1:16 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> 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 <levinsasha928@gmail.com>
> ---
>  tools/kvm/hw/serial.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
> index 67a2007..8cd47cf 100644
> --- a/tools/kvm/hw/serial.c
> +++ b/tools/kvm/hw/serial.c
> @@ -233,6 +233,7 @@ static bool serial8250_out(struct ioport *ioport, struct kvm *kvm, u16 port, voi
>                        break;
>                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);

Applied, thanks!

Ingo, does this fix the occasional slowdowns you are seeing?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm tools: Fix serial port probing
  2011-12-09 11:47 ` Pekka Enberg
@ 2011-12-09 20:10   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2011-12-09 20:10 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, gorcunov, asias.hejun, kvm


* Pekka Enberg <penberg@kernel.org> wrote:

> >                        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);
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-09 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09 11:16 [PATCH] kvm tools: Fix serial port probing Sasha Levin
2011-12-09 11:47 ` Pekka Enberg
2011-12-09 20:10   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).