public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* serial8250_interrupt idea
@ 2008-11-13 15:03 George Spelvin
  2008-11-14  5:30 ` [PATCH 1/2] serial/8250.c: Change to singly linked handler chain George Spelvin
  2008-11-17  9:51 ` serial8250_interrupt idea Tosoni
  0 siblings, 2 replies; 9+ messages in thread
From: George Spelvin @ 2008-11-13 15:03 UTC (permalink / raw)
  To: linux-serial; +Cc: alan, linux

When ISA-style edge-sensitive interrupts are shared (as is commonly done
on multi-serial cards), it's essential that all interrupt sources are
quieted before returning from the interrupt handler, so there will be
an inactive-to-active edge to trigger on next time.

This requires repeatedly polling all of the ports sharing one IRQ until
you've done a full pass during which nobody had an interrupt pending.
That ensures that there was an interval (between emptying the last
busy port and checking the status of the first empty port in the final
all-empty pass) during which the interrupt line was not asserted.

The current code keeps all the ports in a linked list and polls them
in a loop, remembering the position of the last busy port, until that
position has been reached again without seeing a non-empty port.

However, it seems to me that it's possible to improve on this.
Which would be valuable, given that ISA I/O port reads (usually on a
super-IO chip via an LPC bus these days) are quite time-consuming.

If you could predict which ports were going to be busy, you could check
them first on the first pass, allowing you to start the final verification
pass as early as possible.

This could be done very easily via a self-organizing list.  When a
port is polled busy, move it up to the front of the list so it will be
checked earlier next time.  The inactive ports would migrate to the end
of the list.  The struct uart_8250_port list is already locked for the
duration of the interrupt, so there is no need for additional locking.


I was thinking about preparing a patch to do this, but I have one style
question: it would be easier to do the list rearrangement if the
list were singly-linked.  Removing a port would require walking the
whole list, but we already do that each interrupt so it's hardly
a frightening cost.

Is there any reason to preserve the "struct list" configuration?

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

end of thread, other threads:[~2008-11-17 15:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-13 15:03 serial8250_interrupt idea George Spelvin
2008-11-14  5:30 ` [PATCH 1/2] serial/8250.c: Change to singly linked handler chain George Spelvin
2008-11-14  5:33   ` [PATCH 2/2] serial/8250.c: Use self-adjusting list for port poll order George Spelvin
2008-11-17  9:51 ` serial8250_interrupt idea Tosoni
2008-11-17 10:56   ` George Spelvin
2008-11-17 12:45     ` Tosoni
2008-11-17 13:45       ` George Spelvin
2008-11-17 14:08         ` Chris Doré
2008-11-17 15:25         ` Tosoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox