On 2015-02-24 10:41 PM, greg.freemyer@xxxxxxxxx wrote: > > > On February 24, 2015 10:07:59 PM EST, manty kuma <mantykuma@xxxxxxxxx> wrote: >> Dear All, >> >> What happens if an interrupt comes while in middle of printk execution >> and >> the interrupt handler has a printk in it? >> >> There is a chance that the log_buf could be corrupted. isn't it? >> >> Best Regards, >> Manty >> >> > Manty, > > I admit to never looking, but I think you will find printk is atomic in someway. You should review the source code to be sure. > > Also remember the kernel is smp (symmetric multi-processing), so if printks were not atomic you would have line corruption far more frequently than just when an interrupt hits at the wrong time. > > I've never seen corruption of that type. (Or at least not recently. I seem to remember that issue in the 1980's, but that was the UNIX kernel.) > > Greg > Greg, You are right here as printk works anywhere needed after console is enabled in the boot of the kernel. The only issue is if you are too early in the kernel's boot cycle you need to use early_printk, to my knowledge through most architectures support this function including x86. Nick _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies