public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: Matt Mackall <mpm@selenic.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	linux kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Jon Smirl <jonsmirl@yahoo.com>
Subject: Re: IRQ off latency of printk is very high
Date: Thu, 25 Oct 2007 16:41:55 -0700	[thread overview]
Message-ID: <472129C3.6040405@am.sony.com> (raw)
In-Reply-To: <20071025231237.GT19691@waste.org>

Matt Mackall wrote:
> On Thu, Oct 25, 2007 at 03:52:28PM -0700, Tim Bird wrote:
>> Mathieu Desnoyers wrote:
>>> It might help to read this thread I posted on LKML in January 2006
>>> explaining the problem, which led to some discussion about the issue.
>>>
>>> http://lkml.org/lkml/2006/6/3/48
>> This is very helpful.  Jon Smirl's answer seems to give the
>> rationale for supporting printk output in interrupt context.
>> I'm not sure, however, if extending the interrupt off period
>> to cover the console output is required.  It didn't until
>> Ingo changed it in 2.6.17.
> 
> Hmm, I see this at the beginning of the post-BK era (2.6.12-rc2):
> 
> 	        spin_lock_irqsave(&logbuf_lock, flags);
> 		...
> 		spin_unlock(&logbuf_lock);
> 		call_console_drivers(_con_start, _log_end);
> 		local_irq_restore(flags);
> 

Well, I need to do some more research.  This must be in
release_console_sem().  I was looking at vprintk, through
the ages.  At 2.6.16, it looked like this:

        spin_lock_irqsave(&logbuf_lock, flags);
        ...
              spin_unlock_irqrestore(&logbuf_lock, flags);
              console_may_schedule = 0;
              release_console_sem();

but the irq restore has been moving around to different places
in that function over the last few years.  I suspect that in the
common case the irqsave in vprintk is the one that disables
ints.

It appears that formerly interrupts were enabled in vprintk but
re-disabled immediately upon entering release_console_sem().
As it is now, they're held during formatting, buffering,
and output, which seems excessive.

It seems draconian to drain the entire buffer with ints disabled.
Is it possible to break this up and send out smaller chunks
at a time?  Maybe by putting a chunk loop in release_console_sem()?

Just an idea.  I can see that there are a lot of requirements
for this code, and the concurrency control has gotten
complex over the years.
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================


  reply	other threads:[~2007-10-25 23:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 19:44 IRQ off latency of printk is very high Tim Bird
2007-10-25 20:19 ` Matt Mackall
2007-10-25 21:15   ` Tim Bird
2007-10-25 22:28 ` Mathieu Desnoyers
2007-10-25 22:52   ` Tim Bird
2007-10-25 23:12     ` Matt Mackall
2007-10-25 23:41       ` Tim Bird [this message]
2007-10-26  1:23         ` Matt Mackall
2007-10-26 12:57           ` Benny Amorsen
2007-10-26 20:28             ` Matt Mackall
2007-10-29 18:54         ` Pavel Machek
2007-11-01 15:27           ` Mathieu Desnoyers
2007-11-01 21:11             ` Pavel Machek
2007-11-01 22:19               ` Mathieu Desnoyers

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=472129C3.6040405@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=jonsmirl@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@redhat.com \
    --cc=mpm@selenic.com \
    /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