lkml.org 
[lkml]   [2015]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Why linux console designed to work in polling mode?
From
Date

> On Jul 22, 2015, at 14:27, Arun KS <arunks.linux@gmail.com> wrote:
>
> When i checked how kernel printing works, i mentioned that it takes
> messages from log_buffer in console_unlock and gives it to
> call_console_drivers -> ...-> some uart bsp function. Basically, as i
> see this BSP realization tries to flush all message chars in busyloop
> ... so it waits until FIFO_NOT_FULL bit will be dropped by UART and it
> will be able to push the next byte. Basically, as i see userspace
> printing do something different. It puts N_FIFO_BYTES and exits, next,
> when FIFO will be freed - interrupt will be generated, and other
> characters will be put into UART FIFO.
> Can we do something similar for kernel printing? i.e. do not busyloop
> sending char after char, but put N_FIFO chars and flush other in
> interrupt. When panic will occur we can do busyloop printing again. Is
> it reliable? Suppose we have several cores.
>
>

i think it is because printk is very different from other printf function in user space,
printk() can be called in any context atomic / non- atomic / irq / soft-irq context ..

so your bsp->print function can’t be sleep, can’t call any sleep functions .

another reason is that in console_unlock() function, it call bas->print like this:
call_console_drivers(level, ext_text, ext_len, text, len);
print expect your bsp function print all the text as showed in parameters.
and it doesn’t check the return value ,
so if your driver doesn’t use POLL mode, you should only print N_FIFO_BYTES bytes,
this need prink to check return value or need your bsp function to use some special method
to send the remaining bytes after received FIFO empty interrupt.
it is not easy to implement in a context that you can’t call any sleep function.

Thanks

\
 
 \ /
  Last update: 2015-07-22 09:01    [W:0.063 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site