[PATCH 05/35] tick: Move core only declarations and functions to core

2015-02-16 Thread Peter Zijlstra
From: Thomas Gleixner 

No point to expose everything to the world. People just believe such
functions can be abused for whatever purposes. Sigh.

Signed-off-by: Thomas Gleixner 
Cc: Nicolas Pitre 
---
 include/linux/clockchips.h  |   15 ++---
 include/linux/tick.h|  130 +---
 kernel/time/clocksource.c   |2 
 kernel/time/hrtimer.c   |2 
 kernel/time/tick-internal.h |   15 +
 kernel/time/tick-sched.c|7 ++
 kernel/time/tick-sched.h|   64 +
 kernel/time/timer_list.c|2 
 8 files changed, 110 insertions(+), 127 deletions(-)

Index: linux/include/linux/clockchips.h
===
--- linux.orig/include/linux/clockchips.h
+++ linux/include/linux/clockchips.h
@@ -158,15 +158,6 @@ extern void clockevents_config_and_regis
 
 extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq);
 
-extern void clockevents_exchange_device(struct clock_event_device *old,
-   struct clock_event_device *new);
-extern void clockevents_set_mode(struct clock_event_device *dev,
-enum clock_event_mode mode);
-extern int clockevents_program_event(struct clock_event_device *dev,
-ktime_t expires, bool force);
-
-extern void clockevents_handle_noop(struct clock_event_device *dev);
-
 static inline void
 clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 
minsec)
 {
@@ -174,6 +165,12 @@ clockevents_calc_mult_shift(struct clock
  freq, minsec);
 }
 
+/* Should be core only, but is abused by arm bl_switcher */
+extern void clockevents_set_mode(struct clock_event_device *dev,
+enum clock_event_mode mode);
+extern int clockevents_program_event(struct clock_event_device *dev,
+ktime_t expires, bool force);
+
 extern void clockevents_suspend(void);
 extern void clockevents_resume(void);
 
Index: linux/include/linux/tick.h
===
--- linux.orig/include/linux/tick.h
+++ linux/include/linux/tick.h
@@ -1,7 +1,5 @@
-/*  linux/include/linux/tick.h
- *
- *  This file contains the structure definitions for tick related functions
- *
+/*
+ * Tick related global functions
  */
 #ifndef _LINUX_TICK_H
 #define _LINUX_TICK_H
@@ -9,13 +7,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 
+/* ARM BL switcher abuse support */
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
-
 enum tick_device_mode {
TICKDEV_MODE_PERIODIC,
TICKDEV_MODE_ONESHOT,
@@ -25,128 +22,34 @@ struct tick_device {
struct clock_event_device *evtdev;
enum tick_device_mode mode;
 };
-
-enum tick_nohz_mode {
-   NOHZ_MODE_INACTIVE,
-   NOHZ_MODE_LOWRES,
-   NOHZ_MODE_HIGHRES,
-};
-
-/**
- * struct tick_sched - sched tick emulation and no idle tick control/stats
- * @sched_timer:   hrtimer to schedule the periodic tick in high
- * resolution mode
- * @last_tick: Store the last tick expiry time when the tick
- * timer is modified for nohz sleeps. This is necessary
- * to resume the tick timer operation in the timeline
- * when the CPU returns from nohz sleep.
- * @tick_stopped:  Indicator that the idle tick has been stopped
- * @idle_jiffies:  jiffies at the entry to idle for idle time accounting
- * @idle_calls:Total number of idle calls
- * @idle_sleeps:   Number of idle calls, where the sched tick was stopped
- * @idle_entrytime:Time when the idle call was entered
- * @idle_waketime: Time when the idle was interrupted
- * @idle_exittime: Time when the idle state was left
- * @idle_sleeptime:Sum of the time slept in idle with sched tick stopped
- * @iowait_sleeptime:  Sum of the time slept in idle with sched tick stopped, 
with IO outstanding
- * @sleep_length:  Duration of the current idle sleep
- * @do_timer_lst:  CPU was the last one doing do_timer before going idle
- */
-struct tick_sched {
-   struct hrtimer  sched_timer;
-   unsigned long   check_clocks;
-   enum tick_nohz_mode nohz_mode;
-   ktime_t last_tick;
-   int inidle;
-   int tick_stopped;
-   unsigned long   idle_jiffies;
-   unsigned long   idle_calls;
-   unsigned long   idle_sleeps;
-   int idle_active;
-   ktime_t idle_entrytime;
-   ktime_t idle_waketime;
-   ktime_t idle_exittime;
-   ktime_t idle_sleeptime;
-   

[PATCH 05/35] tick: Move core only declarations and functions to core

2015-02-16 Thread Peter Zijlstra
From: Thomas Gleixner t...@linutronix.de

No point to expose everything to the world. People just believe such
functions can be abused for whatever purposes. Sigh.

Signed-off-by: Thomas Gleixner t...@linutronix.de
Cc: Nicolas Pitre n...@linaro.org
---
 include/linux/clockchips.h  |   15 ++---
 include/linux/tick.h|  130 +---
 kernel/time/clocksource.c   |2 
 kernel/time/hrtimer.c   |2 
 kernel/time/tick-internal.h |   15 +
 kernel/time/tick-sched.c|7 ++
 kernel/time/tick-sched.h|   64 +
 kernel/time/timer_list.c|2 
 8 files changed, 110 insertions(+), 127 deletions(-)

Index: linux/include/linux/clockchips.h
===
--- linux.orig/include/linux/clockchips.h
+++ linux/include/linux/clockchips.h
@@ -158,15 +158,6 @@ extern void clockevents_config_and_regis
 
 extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq);
 
-extern void clockevents_exchange_device(struct clock_event_device *old,
-   struct clock_event_device *new);
-extern void clockevents_set_mode(struct clock_event_device *dev,
-enum clock_event_mode mode);
-extern int clockevents_program_event(struct clock_event_device *dev,
-ktime_t expires, bool force);
-
-extern void clockevents_handle_noop(struct clock_event_device *dev);
-
 static inline void
 clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 
minsec)
 {
@@ -174,6 +165,12 @@ clockevents_calc_mult_shift(struct clock
  freq, minsec);
 }
 
+/* Should be core only, but is abused by arm bl_switcher */
+extern void clockevents_set_mode(struct clock_event_device *dev,
+enum clock_event_mode mode);
+extern int clockevents_program_event(struct clock_event_device *dev,
+ktime_t expires, bool force);
+
 extern void clockevents_suspend(void);
 extern void clockevents_resume(void);
 
Index: linux/include/linux/tick.h
===
--- linux.orig/include/linux/tick.h
+++ linux/include/linux/tick.h
@@ -1,7 +1,5 @@
-/*  linux/include/linux/tick.h
- *
- *  This file contains the structure definitions for tick related functions
- *
+/*
+ * Tick related global functions
  */
 #ifndef _LINUX_TICK_H
 #define _LINUX_TICK_H
@@ -9,13 +7,12 @@
 #include linux/clockchips.h
 #include linux/irqflags.h
 #include linux/percpu.h
-#include linux/hrtimer.h
 #include linux/context_tracking_state.h
 #include linux/cpumask.h
 #include linux/sched.h
 
+/* ARM BL switcher abuse support */
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
-
 enum tick_device_mode {
TICKDEV_MODE_PERIODIC,
TICKDEV_MODE_ONESHOT,
@@ -25,128 +22,34 @@ struct tick_device {
struct clock_event_device *evtdev;
enum tick_device_mode mode;
 };
-
-enum tick_nohz_mode {
-   NOHZ_MODE_INACTIVE,
-   NOHZ_MODE_LOWRES,
-   NOHZ_MODE_HIGHRES,
-};
-
-/**
- * struct tick_sched - sched tick emulation and no idle tick control/stats
- * @sched_timer:   hrtimer to schedule the periodic tick in high
- * resolution mode
- * @last_tick: Store the last tick expiry time when the tick
- * timer is modified for nohz sleeps. This is necessary
- * to resume the tick timer operation in the timeline
- * when the CPU returns from nohz sleep.
- * @tick_stopped:  Indicator that the idle tick has been stopped
- * @idle_jiffies:  jiffies at the entry to idle for idle time accounting
- * @idle_calls:Total number of idle calls
- * @idle_sleeps:   Number of idle calls, where the sched tick was stopped
- * @idle_entrytime:Time when the idle call was entered
- * @idle_waketime: Time when the idle was interrupted
- * @idle_exittime: Time when the idle state was left
- * @idle_sleeptime:Sum of the time slept in idle with sched tick stopped
- * @iowait_sleeptime:  Sum of the time slept in idle with sched tick stopped, 
with IO outstanding
- * @sleep_length:  Duration of the current idle sleep
- * @do_timer_lst:  CPU was the last one doing do_timer before going idle
- */
-struct tick_sched {
-   struct hrtimer  sched_timer;
-   unsigned long   check_clocks;
-   enum tick_nohz_mode nohz_mode;
-   ktime_t last_tick;
-   int inidle;
-   int tick_stopped;
-   unsigned long   idle_jiffies;
-   unsigned long   idle_calls;
-   unsigned long   idle_sleeps;
-   int idle_active;
-   ktime_t idle_entrytime;
-