kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: xerofoify@gmail.com (nick)
To: kernelnewbies@lists.kernelnewbies.org
Subject: What happens when an interrupt comes while in middle of printk?
Date: Tue, 24 Feb 2015 22:47:01 -0500	[thread overview]
Message-ID: <54ED45B5.9060205@gmail.com> (raw)
In-Reply-To: <69471850-3FBD-4A67-AABC-5212BE4741B4@gmail.com>



On 2015-02-24 10:41 PM, greg.freemyer at gmail.com wrote:
> 
> 
> On February 24, 2015 10:07:59 PM EST, manty kuma <mantykuma@gmail.com> 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
 

  reply	other threads:[~2015-02-25  3:47 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 [this message]
2015-02-25  5:38 ` anupam kapoor

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=54ED45B5.9060205@gmail.com \
    --to=xerofoify@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).