Bug 11269 - sched: revert cpu_clock to pre-27ec4407790d075c325e1f4da0a19c56953cce23 state
sched: revert cpu_clock to pre-27ec4407790d075c325e1f4da0a19c56953cce23 state
Status: CLOSED CODE_FIX
Product: Process Management
Classification: Unclassified
Component: Scheduler
All Linux
: P1 normal
Assigned To: Ingo Molnar
:
Depends on:
Blocks: Regressions-2.6.26
  Show dependency treegraph
 
Reported: 2008-08-07 12:40 UTC by Rafael J. Wysocki
Modified: 2008-08-12 11:12 UTC (History)
3 users (show)

See Also:
Kernel Version: commit 27ec4407790d075c325e1f4da0a19c56953cce23
Tree: Mainline
Regression: Yes


Attachments

Description Rafael J. Wysocki 2008-08-07 12:40:25 UTC
Subject    : [BISECTION RESULT] sched: revert cpu_clock to pre-27ec4407790d075c325e1f4da0a19c56953cce23 state
Submitter  : Nishanth Aravamudan <nacc@us.ibm.com>
Date       : 2008-08-04 19:46
References : http://marc.info/?l=linux-kernel&m=121787924917646&w=4
Handled-By : Peter Zijlstra <peterz@infradead.org>
Patch      : http://marc.info/?l=linux-kernel&m=121792660313276&w=4

This entry is being used for tracking a regression from 2.6.26.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 Peter Zijlstra 2008-08-08 04:14:26 UTC
On Thu, 2008-08-07 at 12:41 -0700, bugme-daemon@bugzilla.kernel.org
wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=11269
> 
> 
> rjw@sisk.pl changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |a.p.zijlstra@chello.nl
> 
> 
> 
> 

Subject: sched_clock: delay using sched_clock()

Some arch's can't handle sched_clock() being called too early - delay
this until sched_clock_init() has been called.

Reported-by: Bill Gatliff <bgat@billgatliff.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: Nishanth Aravamudan <nacc@us.ibm.com>
CC: Russell King - ARM Linux <linux@arm.linux.org.uk>
---
 include/linux/sched.h |   14 +++-----------
 kernel/sched_clock.c  |   18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 13 deletions(-)

Index: linux-2.6/include/linux/sched.h
===================================================================
--- linux-2.6.orig/include/linux/sched.h
+++ linux-2.6/include/linux/sched.h
@@ -1551,16 +1551,10 @@ static inline int set_cpus_allowed(struc
 
 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)
 {
 }
@@ -1584,8 +1578,6 @@ static inline void sched_clock_tick_star
 #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);
Index: linux-2.6/kernel/sched_clock.c
===================================================================
--- linux-2.6.orig/kernel/sched_clock.c
+++ linux-2.6/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 *c
 	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 d
 }
 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
 
 /*


Comment 3 Adrian Bunk 2008-08-12 11:12:05 UTC
fixed by commit c1955a3d4762e7a9bf84035eb3c4886a900f0d15

Note You need to log in before you can comment on or make changes to this bug.