mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: linux-kernel@vger.kernel.org
Subject: Re: radeon breaks with clocksource_jiffies
Date: Fri, 23 Feb 2007 14:03:28 -0800 (PST)	[thread overview]
Message-ID: <20070223.140328.74752162.davem@davemloft.net> (raw)
In-Reply-To: <20070223.134505.74749340.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Fri, 23 Feb 2007 13:45:05 -0800 (PST)

> While probeing PLL information via radeon_get_pllinfo(), it does a
> "gettimeofday(); do_something(); gettimeofday();" type sequence
> explicitly with interrupts disabled, so ends up with a zero
> measurement which then results in a bunch of divisions by zero.
> 
> We should decide whether gettimeofday() can be expected to advance with
> interrupts disabled, or that clocksource_jiffies is simply invalid because
> of this behavior.

Actually, with clocksource based gettimeofday(), radeon built-in cannot
work at all.

The reason is that the clocksource code will not jump over to a
clock source other than clocksource_jiffies until the late initcalls
are run, because of this code:

/* clocksource_done_booting - Called near the end of bootup
 *
 * Hack to avoid lots of clocksource churn at boot time
 */
static int __init clocksource_done_booting(void)
{
	finished_booting = 1;
	return 0;
}
late_initcall(clocksource_done_booting);
 ...
struct clocksource *clocksource_get_next(void)
{
	unsigned long flags;

	spin_lock_irqsave(&clocksource_lock, flags);
	if (next_clocksource && finished_booting) {
		curr_clocksource = next_clocksource;
		next_clocksource = NULL;
	}
	spin_unlock_irqrestore(&clocksource_lock, flags);

	return curr_clocksource;
}

So even if other clock sources are provided, they'll never show up until
after the radeon driver tries to initialize.

I understand the intention of the clocksource_get_next() code, it doesn't
want to hop onto several different clocksource implementations as the
drivers for those startup, but going through all the module_init() calls
for various drivers without a sane clocksource is just as bad of a problem
and is in fact fatal in this radeon case.

  reply	other threads:[~2007-02-23 22:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 21:45 David Miller
2007-02-23 22:03 ` David Miller [this message]
2007-02-23 22:10   ` john stultz-lkml
2007-02-23 22:32     ` David Miller
     [not found] ` <1f1b08da0702231408l19207805o5555ee3ebf6bd426@mail.gmail.com>
2007-02-23 22:13   ` john stultz

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=20070223.140328.74752162.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®