Re: printk while interrupts are disabled

From: Crutcher Dunnavant (crutcher@datastacks.com)
Date: Tue Oct 02 2001 - 09:22:10 EST


++ 02/10/01 13:37 +0200 - Norbert Roos:
> Hello!
>
> Simple question: Do printk()s get printed while interrupts are disabled
> (after cli)?

They get stuffed into a buffer to be printed later. It is possible to
overflow that buffer, and lose some of your printk messages.

from krenel/printk.c:
/*
 * This is printk. It can be called from any context. We want it to
 * work.
 *
 * We try to grab the console_sem. If we succeed, it's easy - we log
 * the output and
 * call the console drivers. If we fail to get the semaphore we place
 * the output
 * into the log buffer and return. The current holder of the
 * console_sem will
 * notice the new output in release_console_sem() and will send it to
 * the
 * consoles before releasing the semaphore.
 *
 * One effect of this deferred printing is that code which calls
 * printk() and
 * then changes console_loglevel may break. This is because
 * console_loglevel
 * is inspected when the actual printing occurs.
 */
...
        /* This stops the holder of console_sem just where we want him
 * */
        spin_lock_irqsave(&logbuf_lock, flags);

-- 
Crutcher        <crutcher@datastacks.com>
GCS d--- s+:>+:- a-- C++++$ UL++++$ L+++$>++++ !E PS+++ PE Y+ PGP+>++++
    R-(+++) !tv(+++) b+(++++) G+ e>++++ h+>++ r* y+>*$
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 07 2001 - 21:00:22 EST