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

前端 未结 2 1010
余生分开走
余生分开走 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:21

    Yes, it is very bad since printf most probably is not reentrant. What can happen is that the main program calls printf, an interrupt arrives while printf is executing, and then the IRQ handler calls printf again: very bad things may happen (e.g., deadlock, corrupt internal buffers, etc.)

提交回复
热议问题