lkml.org 
[lkml]   [2008]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: Fwd: Commit 76a2a6ee8a0660a29127f05989ac59ae1ce865fa breaks PXA270 (at least)?
From
Date
On Thu, 2008-07-31 at 23:37 +0200, Ingo Molnar wrote:
> * Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Tue, 29 Jul 2008 23:31:05 +0100
> > Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> >
> > > But then some bright spark thought it would be a good idea to get
> > > rid of printk_clock().
> >
> > <does git-log, searches for printk_clock>
>
> i think this is a fresh regression via the introduction of
> kernel/sched_clock.c. We lost the (known) early-init behavior of
> cpu_clock() in the !UNSTABLE_SCHED_CLOCK case. The fix would be to
> restore that, not to reintroduce printk_clock().
>
> Peter, any ideas?

How about something like this, it builds an atificial delay, exactly
like we already have for the HAVE_UNSTABLE_SCHED_CLOCK case.

This keeps cpu_clock() 0 until after sched_clock_init().

Russell, Bill, is this sufficient?

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1b26ed2..d13264b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1550,16 +1550,10 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)

extern unsigned long long sched_clock(void);

-#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
-static inline void sched_clock_init(void)
-{
-}
-
-static inline u64 sched_clock_cpu(int cpu)
-{
- return sched_clock();
-}
+extern void sched_clock_init(void);
+extern u64 sched_clock_cpu(int cpu);

+#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
static inline void sched_clock_tick(void)
{
}
@@ -1583,8 +1577,6 @@ static inline void sched_clock_tick_start(int cpu)
#endif

#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
-extern void sched_clock_init(void);
-extern u64 sched_clock_cpu(int cpu);
extern void sched_clock_tick(void);
extern void sched_clock_idle_sleep_event(void);
extern void sched_clock_idle_wakeup_event(u64 delta_ns);
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 22ed55d..a804582 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -32,6 +32,7 @@
#include <linux/ktime.h>
#include <linux/module.h>

+static __read_mostly int sched_clock_running;

#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK

@@ -71,8 +72,6 @@ static inline struct sched_clock_data *cpu_sdc(int cpu)
return &per_cpu(sched_clock_data, cpu);
}

-static __read_mostly int sched_clock_running;
-
void sched_clock_init(void)
{
u64 ktime_now = ktime_to_ns(ktime_get());
@@ -319,6 +318,21 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
}
EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);

+#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
+
+void sched_clock_init(void)
+{
+ sched_clock_running = 1;
+}
+
+u64 sched_clock_cpu(int cpu)
+{
+ if (unlikely(!sched_clock_running))
+ return 0;
+
+ return sched_clock();
+}
+
#endif

/*



\
 
 \ /
  Last update: 2008-07-31 23:51    [from the cache]
©2003-2011 Jasper Spaans