[PATCH] proposed changes to hvc_console for interrupt driven console

Ryan Arnold rsa at us.ibm.com
Thu Apr 1 08:16:37 EST 2004

The patch located at:


contains proposed changes to the hvc_console device driver.  I would
appreciate any comments that could be given.

This patch adds an interrupt driven console I/O mechanism along side the
polling I/O mechanism that is already in place in the hvc_console
driver.  The interrupt driven mechanism is initialized to execute in
place of the polling mechanism if the hardware supports virtual terminal
interrupts (i.e. Power5).  The polling mechanism will continue to
function on legacy hardware.

Additionally this patch fixes a latent data loss bug when writing to the
driver's tty interface during massive console output.  This bug is
easily reproducible on Power5 hardware using the HMC's terminal console
and a simple "ls -la /dev" output test.

There is one nuisance that I'd like some help looking at.  I have
enabled the "Sleep-inside-spinlock checking" kernel config option.  When
I boot a kernel with the patched driver I get the following output
message in the bootlog even though the console works fine:

Debug: sleeping function called from invalid context at mm/slab.c:1931
in_atomic():1, irqs_disabled():1
Call Trace:
[c000000000094788] .kmem_cache_alloc+0xb8/0xc0
[c000000000225ae0] .radix_tree_node_alloc+0x2c/0xa4
[c000000000225cf8] .radix_tree_extend+0x74/0xd4
[c000000000225ea0] .radix_tree_insert+0x148/0x15c
[c00000000003b5d4] .xics_startup+0x48/0x8c
[c0000000000133b4] .setup_irq+0x1e4/0x240
[c0000000000136b8] .request_irq+0x9c/0x124
[c0000000002581e0] .hvc_open+0xfc/0x160
[c00000000023e504] .tty_open+0x318/0x49c
[c0000000000c6f80] .chrdev_open+0x224/0x474
[c0000000000b6a08] .dentry_open+0x224/0x38c
[c0000000000b67dc] .filp_open+0x70/0x78
[c0000000000b6f9c] .sys_open+0x9c/0xd8
[c00000000000c604] .init+0x110/0x1c8
[c0000000000194ac] .kernel_thread+0x4c/0x68

This seems to be due to requesting an irq inside of hvc_open() [patch
line 58].  I request the irq outside of a spinlock and the tty_open()
invoking function doesn't hold a spinlock when it calls hvc_open().  So
I don't see the problem.

Barring resolution of the previous problem I will checked these changes
into the Ameslab bitkeeper tree in the near future if there are no

The patch is against Linux-2.6.5-rc2-ames kernel source.

Ryan S. Arnold
IBM Linux Technology Center

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/

More information about the Linuxppc64-dev mailing list