Re: 2.4.21: Sharing interrupts with serial console

From: Russell King
Date: Thu Aug 04 2005 - 02:56:21 EST


On Wed, Aug 03, 2005 at 06:36:51PM -0700, Chris Budd wrote:
> 1. The rs_init function in ./linux-2.4.21/drivers/char/serial.c
> explicitly states "The interrupt of the serial console port can't be
> shared." Does this include *ALL* interrupts? The code checks for
> sharing only with other serial devices, not *ALL* types of devices
> like I2C, RTC, etc.

I think you'll find that older versions of the serial driver did not
allow the IRQ to be shared by other devices. It probably got changed
with the addition of PCI card support.

> 2. While the presence of the comment about not sharing was nice, it
> does not explain "why?"

Connecting a level-active interrupt output to an edge-triggered
interrupt controller input is Bad News(tm) for missing interrupts.

The situation is as follows:
- serial port asserts interrupt output which triggers an interrupt
to the CPU. You enter the serial handler.

- Before you clear the serial interrupt, the other device sharing
this interrupt asserts its interrupt output - so there was no
edge transition.

- You complete service the serial port, and move on to service the
other device.

- Before you clear it's interrupt, the serial port re-asserts its
interrupt output, and again there was no edge transition as far
as the interrupt controller can tell.

- You complete servicing the other device and leave return from
interrupt mode.

>From this point on, neither device can cause an interrupt to be sent
to the CPU again.

The above is rather long to put in a comment.

> Why can't we share the serial console interrupt?
> The serial console seems to work when I alter serial.c to
> skip this check for the sharing of interrupts with the serial console.

If the interrupt is shared, it's possible for the interrupt handler to
service the serial port while it's being used to send a kernel message,
and thereby disrupt the kernel message output.

> 3. Does the hardware platform matter? We are running Linux 2.4.21 on
> an embedded XScale(ARM)-based board.

Depends how you've connected the serial port interrupt. Edge triggered
inputs bad, level triggered good.

If your Intel hardware doesn't have level triggered input capabilities,
please apply customer pressure to Intel to ensure that they consider it
for their future ARM-based designs.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/