kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: anupam.kapoor@gmail.com (anupam kapoor)
To: kernelnewbies@lists.kernelnewbies.org
Subject: What happens when an interrupt comes while in middle of printk?
Date: Wed, 25 Feb 2015 11:08:39 +0530	[thread overview]
Message-ID: <87y4nm7dpc.fsf@fatcat.parallelwireless> (raw)
In-Reply-To: <CAB6A5-ApwcFhvo-vUGJwsRuLXaxeC5FN_cC8JwLyCfALBnLZUg@mail.gmail.com>


>>>>> [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

      parent reply	other threads:[~2015-02-25  5:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25  3:07 What happens when an interrupt comes while in middle of printk? manty kuma
2015-02-25  3:41 ` greg.freemyer at gmail.com
2015-02-25  3:47   ` nick
2015-02-25  5:38 ` anupam kapoor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4nm7dpc.fsf@fatcat.parallelwireless \
    --to=anupam.kapoor@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).