Re: [PATCH 2.6.24.7-rt14 v2] rt: {queue,schedule}_work_prio() allowing work priorities other than caller's priority

From: Leon Woestenberg
Date: Wed Jul 09 2008 - 12:12:17 EST


Hello,

On Sat, Jul 5, 2008 at 2:59 PM, <leon.woestenberg@xxxxxxxxx> wrote:
> The faulty case was a non-FIFO serial driver that deferred LED blinking to
> a workqueue using schedule_work(). However, that work used GPIO bitbanged I2C,
> which uses 50 usecs udelay()s. With the work inheriting the serial IRQ priority,
> it easily missed the ~60 usec deadline of 115200 bps communications.
>
John Kacur asked forthe (custom) code showing this case on IRC.

I suspect the current kernel also has drivers that *also* depend on
workqueue's not pre-empting or delaying their calling interrupt
handler.


See http://www.sidebranch.com/leon/ for the code. A short file roadmap
and explanation of the analysis:

lowlevel_16550.c: non-FIFO UART driver
axonbus.c: protocol handler
max7311.c: I2C -> GPIO extender, driving a few LEDs.

Queueing the "blink a LED" work happens in this code path:

lowlevel_16550.c:axonbus_isr() -> axonbus.c:ab_cmd_receive() ->
boardsupport.c:ll_blink()

The queued work then performs this code path, running at the same
real-time priority as the originating IRQ:
ll_blink_work() -> do_max7311_read() -> i2c-algo-bit.c:* -> udelay(50)

The udelay(50) thus keeps the 16550 interrupt from being serviced.

Scheduling the work at lower priority solved this.

Regards,

Leon.

p.s. we will submit the max7311 driver for upstream.
--
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/