public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: "George Spelvin" <linux@horizon.com>
To: linux-serial@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk, linux@horizon.com
Subject: serial8250_interrupt idea
Date: Thu, 13 Nov 2008 10:03:08 -0500	[thread overview]
Message-ID: <20081113150308.3590.qmail@science.horizon.com> (raw)

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?

             reply	other threads:[~2008-11-13 15:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-13 15:03 George Spelvin [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081113150308.3590.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox