mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: linux-kernel@vger.kernel.org, jasonuhl@sgi.com
Subject: Re: CONFIG_PRINTK_TIME woes
Date: Sun, 21 Aug 2005 02:13:22 -0700	[thread overview]
Message-ID: <20050821021322.3986dd4a.akpm@osdl.org> (raw)
In-Reply-To: <B8E391BBE9FE384DAA4C5C003888BE6F042C7DA7@scsmsx401.amr.corp.intel.com>

"Luck, Tony" <tony.luck@intel.com> wrote:
>
> It has been pointed out to me that ia64 doesn't boot
> with CONFIG_PRINTK_TIME=y.  The issue is the call to
> sched_clock() ... which on ia64 accesses some per-cpu
> data to adjust for possible variations in processor
> speed between different cpus.  Since the per-cpu page
> is not set up for the first few printk() calls, we die.
> 
> Is this an issue on any other architecture?  Most versions
> of sched_clock() seem to just scale jiffies into nanoseconds,
> so I guess they don't.  s390, sparc64, x86 and x86_64 all
> have more sophisticated versions but they don't appear to me
> to have limitations on how early they might be called.
> 
> Possible solutions:
> 
> 1) Fix ia64 version of sched_clock() to check whether
> the per-cpu page hase been initialized before using it.
> 
> I don't like this solution as it will make sched_clock()
> slower for its primary uses in kernel/sched.c ... none of
> which can be called before the per-cpu area is initialized.
> 
> 
> 2) Add some test to the printk() path along the lines of:
> 
>   t = (can_call_sched_clock) ? sched_clock() : 0;
> 
> This is somewhat ugly ... perhaps too unpleasant for words in
> that can_call_sched_clock is a per-cpu concept!
> 
> 3) Make the printk() code get the time in some other way.
> 
> Using sched_clock() here seems wrong.  The ia64 version
> has a big fat comment about not comparing the results of
> two calls from different cpus ... but since printk() calls
> can come from any cpu ... it seems likely that a user who
> turns on PRINTK_TIME might subtract timestamps from two
> lines to see how long it was between the messages.  This
> could have significant error on a system that has been up
> for a long time.
> 
> But I don't have a better suggestion from existing code.
> I assume that sched_clock() was picked as it is both fast and
> lockless.

Yes, using sched_clock() there is a bit abusive.

It's not terribly performance-sensitive in printk().

How about we give each arch a printk_clock()?

  reply	other threads:[~2005-08-21  9:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-18 18:47 Luck, Tony
2005-08-21  9:13 ` Andrew Morton [this message]
2005-08-21  9:16   ` Andrew Morton
2005-08-21  9:27     ` Nick Piggin
2005-08-21  9:32       ` Andrew Morton
2005-08-21 11:25         ` Nick Piggin
2005-08-21 18:01           ` Andrew Morton
2005-08-24  0:04             ` Tim Bird
2005-08-22 17:42     ` tony.luck
2005-08-22 17:50       ` Andrew Morton
2005-08-22 20:52         ` tony.luck
2005-08-22 20:20       ` David S. Miller
2005-08-22 20:33         ` Jason Uhlenkott
2005-08-22 20:42           ` David S. Miller
2005-08-22 21:10             ` tony.luck
2005-08-22 21:15             ` Andrew Morton
2005-08-22 22:33               ` tony.luck
2005-08-22 22:38                 ` Andrew Morton
2005-08-22 23:27                   ` tony.luck
2005-08-23  1:52                     ` Paul Mackerras
2005-08-23 15:01             ` Nick Piggin
2005-08-24  0:36     ` Tim Bird
2005-08-23  7:18   ` Tony Lindgren
2005-08-23 14:07 Luck, Tony

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=20050821021322.3986dd4a.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=jasonuhl@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.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

all inboxes | Powered by JetHome®