diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-03-25 08:07:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-01 08:22:58 -0400 |
commit | c1797baf6880174f899ce3960d0598f5bbeeb7ff (patch) | |
tree | c854e772dd2d01a998d732ce04dc0a4f748e458a /kernel/time | |
parent | b7475eb599ddb2e8cab2dc86ff38a9507463ad6b (diff) |
tick: Move core only declarations and functions to core
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 <tglx@linutronix.de>
[ Rebased on top of 4.0-rc5 ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/28017337.VbCUc39Gme@vostro.rjw.lan
[ Merged to latest timers/core ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/clocksource.c | 2 | ||||
-rw-r--r-- | kernel/time/hrtimer.c | 2 | ||||
-rw-r--r-- | kernel/time/tick-internal.h | 15 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 7 | ||||
-rw-r--r-- | kernel/time/tick-sched.h | 64 | ||||
-rw-r--r-- | kernel/time/timer_list.c | 2 |
6 files changed, 88 insertions, 4 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 8b4010f0b1b4..c3be3c71bbad 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/tick.h> | 31 | #include <linux/tick.h> |
32 | #include <linux/kthread.h> | 32 | #include <linux/kthread.h> |
33 | 33 | ||
34 | #include "timekeeping.h" | 34 | #include "tick-internal.h" |
35 | #include "timekeeping_internal.h" | 35 | #include "timekeeping_internal.h" |
36 | 36 | ||
37 | /** | 37 | /** |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index bee0c1f78091..721d29b99d10 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | #include <trace/events/timer.h> | 55 | #include <trace/events/timer.h> |
56 | 56 | ||
57 | #include "timekeeping.h" | 57 | #include "tick-internal.h" |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * The timer bases: | 60 | * The timer bases: |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index d86eb8d485e9..dd2c45d057b9 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/tick.h> | 5 | #include <linux/tick.h> |
6 | 6 | ||
7 | #include "timekeeping.h" | 7 | #include "timekeeping.h" |
8 | #include "tick-sched.h" | ||
8 | 9 | ||
9 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 10 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
10 | 11 | ||
@@ -26,6 +27,7 @@ extern void tick_resume(void); | |||
26 | extern bool tick_check_replacement(struct clock_event_device *curdev, | 27 | extern bool tick_check_replacement(struct clock_event_device *curdev, |
27 | struct clock_event_device *newdev); | 28 | struct clock_event_device *newdev); |
28 | extern void tick_install_replacement(struct clock_event_device *dev); | 29 | extern void tick_install_replacement(struct clock_event_device *dev); |
30 | extern int tick_is_oneshot_available(void); | ||
29 | 31 | ||
30 | extern int clockevents_tick_resume(struct clock_event_device *dev); | 32 | extern int clockevents_tick_resume(struct clock_event_device *dev); |
31 | /* Check, if the device is functional or a dummy for broadcast */ | 33 | /* Check, if the device is functional or a dummy for broadcast */ |
@@ -35,6 +37,9 @@ static inline int tick_device_is_functional(struct clock_event_device *dev) | |||
35 | } | 37 | } |
36 | 38 | ||
37 | extern void clockevents_shutdown(struct clock_event_device *dev); | 39 | extern void clockevents_shutdown(struct clock_event_device *dev); |
40 | extern void clockevents_exchange_device(struct clock_event_device *old, | ||
41 | struct clock_event_device *new); | ||
42 | extern void clockevents_handle_noop(struct clock_event_device *dev); | ||
38 | extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq); | 43 | extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq); |
39 | extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); | 44 | extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); |
40 | #endif /* GENERIC_CLOCKEVENTS */ | 45 | #endif /* GENERIC_CLOCKEVENTS */ |
@@ -49,6 +54,10 @@ extern void tick_oneshot_notify(void); | |||
49 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); | 54 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); |
50 | extern void tick_resume_oneshot(void); | 55 | extern void tick_resume_oneshot(void); |
51 | static inline bool tick_oneshot_possible(void) { return true; } | 56 | static inline bool tick_oneshot_possible(void) { return true; } |
57 | extern int tick_oneshot_mode_active(void); | ||
58 | extern void tick_clock_notify(void); | ||
59 | extern int tick_check_oneshot_change(int allow_nohz); | ||
60 | extern int tick_init_highres(void); | ||
52 | #else /* !ONESHOT */ | 61 | #else /* !ONESHOT */ |
53 | static inline | 62 | static inline |
54 | void tick_setup_oneshot(struct clock_event_device *newdev, | 63 | void tick_setup_oneshot(struct clock_event_device *newdev, |
@@ -58,6 +67,9 @@ static inline void tick_resume_oneshot(void) { BUG(); } | |||
58 | static inline int tick_program_event(ktime_t expires, int force) { return 0; } | 67 | static inline int tick_program_event(ktime_t expires, int force) { return 0; } |
59 | static inline void tick_oneshot_notify(void) { } | 68 | static inline void tick_oneshot_notify(void) { } |
60 | static inline bool tick_oneshot_possible(void) { return false; } | 69 | static inline bool tick_oneshot_possible(void) { return false; } |
70 | static inline int tick_oneshot_mode_active(void) { return 0; } | ||
71 | static inline void tick_clock_notify(void) { } | ||
72 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | ||
61 | #endif /* !TICK_ONESHOT */ | 73 | #endif /* !TICK_ONESHOT */ |
62 | 74 | ||
63 | /* Broadcasting support */ | 75 | /* Broadcasting support */ |
@@ -72,6 +84,8 @@ extern int tick_resume_broadcast(void); | |||
72 | extern void tick_broadcast_init(void); | 84 | extern void tick_broadcast_init(void); |
73 | extern void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); | 85 | extern void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); |
74 | extern int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq); | 86 | extern int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq); |
87 | extern struct tick_device *tick_get_broadcast_device(void); | ||
88 | extern struct cpumask *tick_get_broadcast_mask(void); | ||
75 | #else /* !BROADCAST */ | 89 | #else /* !BROADCAST */ |
76 | static inline void tick_install_broadcast_device(struct clock_event_device *dev) { } | 90 | static inline void tick_install_broadcast_device(struct clock_event_device *dev) { } |
77 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) { return 0; } | 91 | static inline int tick_is_broadcast_device(struct clock_event_device *dev) { return 0; } |
@@ -101,6 +115,7 @@ extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | |||
101 | extern int tick_broadcast_oneshot_active(void); | 115 | extern int tick_broadcast_oneshot_active(void); |
102 | extern void tick_check_oneshot_broadcast_this_cpu(void); | 116 | extern void tick_check_oneshot_broadcast_this_cpu(void); |
103 | bool tick_broadcast_oneshot_available(void); | 117 | bool tick_broadcast_oneshot_available(void); |
118 | extern struct cpumask *tick_get_broadcast_oneshot_mask(void); | ||
104 | #else /* BROADCAST && ONESHOT */ | 119 | #else /* BROADCAST && ONESHOT */ |
105 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } | 120 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } |
106 | static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; } | 121 | static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; } |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index a4c4edac4528..914259128145 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -34,7 +34,7 @@ | |||
34 | /* | 34 | /* |
35 | * Per cpu nohz control structure | 35 | * Per cpu nohz control structure |
36 | */ | 36 | */ |
37 | DEFINE_PER_CPU(struct tick_sched, tick_cpu_sched); | 37 | static DEFINE_PER_CPU(struct tick_sched, tick_cpu_sched); |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * The time, when the last jiffy update happened. Protected by jiffies_lock. | 40 | * The time, when the last jiffy update happened. Protected by jiffies_lock. |
@@ -416,6 +416,11 @@ static int __init setup_tick_nohz(char *str) | |||
416 | 416 | ||
417 | __setup("nohz=", setup_tick_nohz); | 417 | __setup("nohz=", setup_tick_nohz); |
418 | 418 | ||
419 | int tick_nohz_tick_stopped(void) | ||
420 | { | ||
421 | return __this_cpu_read(tick_cpu_sched.tick_stopped); | ||
422 | } | ||
423 | |||
419 | /** | 424 | /** |
420 | * tick_nohz_update_jiffies - update jiffies when idle was interrupted | 425 | * tick_nohz_update_jiffies - update jiffies when idle was interrupted |
421 | * | 426 | * |
diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h new file mode 100644 index 000000000000..930743249127 --- /dev/null +++ b/kernel/time/tick-sched.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef _TICK_SCHED_H | ||
2 | #define _TICK_SCHED_H | ||
3 | |||
4 | #include <linux/hrtimer.h> | ||
5 | |||
6 | enum tick_nohz_mode { | ||
7 | NOHZ_MODE_INACTIVE, | ||
8 | NOHZ_MODE_LOWRES, | ||
9 | NOHZ_MODE_HIGHRES, | ||
10 | }; | ||
11 | |||
12 | /** | ||
13 | * struct tick_sched - sched tick emulation and no idle tick control/stats | ||
14 | * @sched_timer: hrtimer to schedule the periodic tick in high | ||
15 | * resolution mode | ||
16 | * @last_tick: Store the last tick expiry time when the tick | ||
17 | * timer is modified for nohz sleeps. This is necessary | ||
18 | * to resume the tick timer operation in the timeline | ||
19 | * when the CPU returns from nohz sleep. | ||
20 | * @tick_stopped: Indicator that the idle tick has been stopped | ||
21 | * @idle_jiffies: jiffies at the entry to idle for idle time accounting | ||
22 | * @idle_calls: Total number of idle calls | ||
23 | * @idle_sleeps: Number of idle calls, where the sched tick was stopped | ||
24 | * @idle_entrytime: Time when the idle call was entered | ||
25 | * @idle_waketime: Time when the idle was interrupted | ||
26 | * @idle_exittime: Time when the idle state was left | ||
27 | * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped | ||
28 | * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding | ||
29 | * @sleep_length: Duration of the current idle sleep | ||
30 | * @do_timer_lst: CPU was the last one doing do_timer before going idle | ||
31 | */ | ||
32 | struct tick_sched { | ||
33 | struct hrtimer sched_timer; | ||
34 | unsigned long check_clocks; | ||
35 | enum tick_nohz_mode nohz_mode; | ||
36 | ktime_t last_tick; | ||
37 | int inidle; | ||
38 | int tick_stopped; | ||
39 | unsigned long idle_jiffies; | ||
40 | unsigned long idle_calls; | ||
41 | unsigned long idle_sleeps; | ||
42 | int idle_active; | ||
43 | ktime_t idle_entrytime; | ||
44 | ktime_t idle_waketime; | ||
45 | ktime_t idle_exittime; | ||
46 | ktime_t idle_sleeptime; | ||
47 | ktime_t iowait_sleeptime; | ||
48 | ktime_t sleep_length; | ||
49 | unsigned long last_jiffies; | ||
50 | unsigned long next_jiffies; | ||
51 | ktime_t idle_expires; | ||
52 | int do_timer_last; | ||
53 | }; | ||
54 | |||
55 | extern struct tick_sched *tick_get_tick_sched(int cpu); | ||
56 | |||
57 | extern void tick_setup_sched_timer(void); | ||
58 | #if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS | ||
59 | extern void tick_cancel_sched_timer(int cpu); | ||
60 | #else | ||
61 | static inline void tick_cancel_sched_timer(int cpu) { } | ||
62 | #endif | ||
63 | |||
64 | #endif | ||
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 05aa5590106a..e878c2e0ba45 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c | |||
@@ -16,10 +16,10 @@ | |||
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/seq_file.h> | 17 | #include <linux/seq_file.h> |
18 | #include <linux/kallsyms.h> | 18 | #include <linux/kallsyms.h> |
19 | #include <linux/tick.h> | ||
20 | 19 | ||
21 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
22 | 21 | ||
22 | #include "tick-internal.h" | ||
23 | 23 | ||
24 | struct timer_list_iter { | 24 | struct timer_list_iter { |
25 | int cpu; | 25 | int cpu; |