From mboxrd@z Thu Jan 1 00:00:00 1970 From: anupam.kapoor@gmail.com (anupam kapoor) Date: Wed, 25 Feb 2015 11:08:39 +0530 Subject: What happens when an interrupt comes while in middle of printk? In-Reply-To: References: Message-ID: <87y4nm7dpc.fsf@fatcat.parallelwireless> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org >>>>> [2015-02-25T08:37:59+0530]: "manty kuma" (manty-kuma): ,----[ manty-kuma ] | 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? `---- no this doesn't happen. look at vprintk_emit(...) which invokes local_irq_save(...). essentially, printk tries to acquire console_lock. if it succeeds all is well. otherwise, output is dumped to a log buffer. when the current holder of console_lock, unlocks it, log buffer is emptied... --- thanks anupam