printk inside an interrupt handler , is it really that bad?

前端 未结 2 1030
余生分开走
余生分开走 2020-12-29 08:14

everybody knows that interrupt handler should be short as possible. and adding functions like printk for debugging inside an interrupt handler is something that

2条回答
  •  渐次进展
    2020-12-29 08:42

    The printk function is not just inserting into a queue/buffer -- assuming the log level is high enough, the output from printk will be emitted to the console immediately, as part of the call to printk. This is especially slow if the console is, say, on a serial port. But in any case, printk does introduce pretty substantial overhead and can affect timing.

    If you have a timing critical place where you want to get some debug output, you can look at using the trace_printk function in modern kernels. This actually does just put input into the trace ringbuffer, and you can read it later. Take a look at this article for full details.

提交回复
热议问题