summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0078-hrtimer-Provide-clock_was_set_delayed.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0078-hrtimer-Provide-clock_was_set_delayed.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0078-hrtimer-Provide-clock_was_set_delayed.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0078-hrtimer-Provide-clock_was_set_delayed.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0078-hrtimer-Provide-clock_was_set_delayed.patch
new file mode 100644
index 00000000..90b76394
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0078-hrtimer-Provide-clock_was_set_delayed.patch
@@ -0,0 +1,118 @@
1From b6da5d5a3a7e128fd17b15dc64fda7c1aea694e6 Mon Sep 17 00:00:00 2001
2From: John Stultz <johnstul@us.ibm.com>
3Date: Tue, 10 Jul 2012 18:43:19 -0400
4Subject: [PATCH 078/109] hrtimer: Provide clock_was_set_delayed()
5
6commit f55a6faa384304c89cfef162768e88374d3312cb upstream.
7
8clock_was_set() cannot be called from hard interrupt context because
9it calls on_each_cpu().
10
11For fixing the widely reported leap seconds issue it is necessary to
12call it from hard interrupt context, i.e. the timer tick code, which
13does the timekeeping updates.
14
15Provide a new function which denotes it in the hrtimer cpu base
16structure of the cpu on which it is called and raise the hrtimer
17softirq. We then execute the clock_was_set() notificiation from
18softirq context in run_hrtimer_softirq(). The hrtimer softirq is
19rarely used, so polling the flag there is not a performance issue.
20
21[ tglx: Made it depend on CONFIG_HIGH_RES_TIMERS. We really should get
22 rid of all this ifdeffery ASAP ]
23
24Signed-off-by: John Stultz <johnstul@us.ibm.com>
25Reported-by: Jan Engelhardt <jengelh@inai.de>
26Reviewed-by: Ingo Molnar <mingo@kernel.org>
27Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
28Acked-by: Prarit Bhargava <prarit@redhat.com>
29Link: http://lkml.kernel.org/r/1341960205-56738-2-git-send-email-johnstul@us.ibm.com
30Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
31Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
32---
33 include/linux/hrtimer.h | 9 ++++++++-
34 kernel/hrtimer.c | 20 ++++++++++++++++++++
35 2 files changed, 28 insertions(+), 1 deletions(-)
36
37diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
38index fd0dc30..c9ec940 100644
39--- a/include/linux/hrtimer.h
40+++ b/include/linux/hrtimer.h
41@@ -165,6 +165,7 @@ enum hrtimer_base_type {
42 * @lock: lock protecting the base and associated clock bases
43 * and timers
44 * @active_bases: Bitfield to mark bases with active timers
45+ * @clock_was_set: Indicates that clock was set from irq context.
46 * @expires_next: absolute time of the next event which was scheduled
47 * via clock_set_next_event()
48 * @hres_active: State of high resolution mode
49@@ -177,7 +178,8 @@ enum hrtimer_base_type {
50 */
51 struct hrtimer_cpu_base {
52 raw_spinlock_t lock;
53- unsigned long active_bases;
54+ unsigned int active_bases;
55+ unsigned int clock_was_set;
56 #ifdef CONFIG_HIGH_RES_TIMERS
57 ktime_t expires_next;
58 int hres_active;
59@@ -286,6 +288,8 @@ extern void hrtimer_peek_ahead_timers(void);
60 # define MONOTONIC_RES_NSEC HIGH_RES_NSEC
61 # define KTIME_MONOTONIC_RES KTIME_HIGH_RES
62
63+extern void clock_was_set_delayed(void);
64+
65 #else
66
67 # define MONOTONIC_RES_NSEC LOW_RES_NSEC
68@@ -306,6 +310,9 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
69 {
70 return 0;
71 }
72+
73+static inline void clock_was_set_delayed(void) { }
74+
75 #endif
76
77 extern void clock_was_set(void);
78diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
79index ae34bf5..3c24fb2 100644
80--- a/kernel/hrtimer.c
81+++ b/kernel/hrtimer.c
82@@ -717,6 +717,19 @@ static int hrtimer_switch_to_hres(void)
83 return 1;
84 }
85
86+/*
87+ * Called from timekeeping code to reprogramm the hrtimer interrupt
88+ * device. If called from the timer interrupt context we defer it to
89+ * softirq context.
90+ */
91+void clock_was_set_delayed(void)
92+{
93+ struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
94+
95+ cpu_base->clock_was_set = 1;
96+ __raise_softirq_irqoff(HRTIMER_SOFTIRQ);
97+}
98+
99 #else
100
101 static inline int hrtimer_hres_active(void) { return 0; }
102@@ -1395,6 +1408,13 @@ void hrtimer_peek_ahead_timers(void)
103
104 static void run_hrtimer_softirq(struct softirq_action *h)
105 {
106+ struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
107+
108+ if (cpu_base->clock_was_set) {
109+ cpu_base->clock_was_set = 0;
110+ clock_was_set();
111+ }
112+
113 hrtimer_peek_ahead_timers();
114 }
115
116--
1171.7.7.6
118