summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0080-timekeeping-Maintain-ktime_t-based-offsets-for-hrtim.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0080-timekeeping-Maintain-ktime_t-based-offsets-for-hrtim.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0080-timekeeping-Maintain-ktime_t-based-offsets-for-hrtim.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0080-timekeeping-Maintain-ktime_t-based-offsets-for-hrtim.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0080-timekeeping-Maintain-ktime_t-based-offsets-for-hrtim.patch
new file mode 100644
index 00000000..f00962df
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0080-timekeeping-Maintain-ktime_t-based-offsets-for-hrtim.patch
@@ -0,0 +1,104 @@
1From 711cebfd4050d5a41606f9f8ad56986d0377df08 Mon Sep 17 00:00:00 2001
2From: Thomas Gleixner <tglx@linutronix.de>
3Date: Tue, 10 Jul 2012 18:43:21 -0400
4Subject: [PATCH 080/109] timekeeping: Maintain ktime_t based offsets for
5 hrtimers
6
7This is a backport of 5b9fe759a678e05be4937ddf03d50e950207c1c0
8
9We need to update the hrtimer clock offsets from the hrtimer interrupt
10context. To avoid conversions from timespec to ktime_t maintain a
11ktime_t based representation of those offsets in the timekeeper. This
12puts the conversion overhead into the code which updates the
13underlying offsets and provides fast accessible values in the hrtimer
14interrupt.
15
16Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17Signed-off-by: John Stultz <johnstul@us.ibm.com>
18Reviewed-by: Ingo Molnar <mingo@kernel.org>
19Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
20Acked-by: Prarit Bhargava <prarit@redhat.com>
21Link: http://lkml.kernel.org/r/1341960205-56738-4-git-send-email-johnstul@us.ibm.com
22Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
23[John Stultz: Backported to 3.2]
24Cc: Prarit Bhargava <prarit@redhat.com>
25Cc: Thomas Gleixner <tglx@linutronix.de>
26Cc: Linux Kernel <linux-kernel@vger.kernel.org>
27Signed-off-by: John Stultz <johnstul@us.ibm.com>
28Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
29---
30 kernel/time/timekeeping.c | 25 ++++++++++++++++++++++++-
31 1 files changed, 24 insertions(+), 1 deletions(-)
32
33diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
34index 8958ad7..d5d0e5d 100644
35--- a/kernel/time/timekeeping.c
36+++ b/kernel/time/timekeeping.c
37@@ -161,18 +161,34 @@ static struct timespec xtime __attribute__ ((aligned (16)));
38 static struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
39 static struct timespec total_sleep_time;
40
41+/* Offset clock monotonic -> clock realtime */
42+static ktime_t offs_real;
43+
44+/* Offset clock monotonic -> clock boottime */
45+static ktime_t offs_boot;
46+
47 /*
48 * The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock.
49 */
50 static struct timespec raw_time;
51
52 /* must hold write on xtime_lock */
53+static void update_rt_offset(void)
54+{
55+ struct timespec tmp, *wtm = &wall_to_monotonic;
56+
57+ set_normalized_timespec(&tmp, -wtm->tv_sec, -wtm->tv_nsec);
58+ offs_real = timespec_to_ktime(tmp);
59+}
60+
61+/* must hold write on xtime_lock */
62 static void timekeeping_update(bool clearntp)
63 {
64 if (clearntp) {
65 timekeeper.ntp_error = 0;
66 ntp_clear();
67 }
68+ update_rt_offset();
69 update_vsyscall(&xtime, &wall_to_monotonic,
70 timekeeper.clock, timekeeper.mult);
71 }
72@@ -587,6 +603,7 @@ void __init timekeeping_init(void)
73 }
74 set_normalized_timespec(&wall_to_monotonic,
75 -boot.tv_sec, -boot.tv_nsec);
76+ update_rt_offset();
77 total_sleep_time.tv_sec = 0;
78 total_sleep_time.tv_nsec = 0;
79 write_sequnlock_irqrestore(&xtime_lock, flags);
80@@ -595,6 +612,12 @@ void __init timekeeping_init(void)
81 /* time in seconds when suspend began */
82 static struct timespec timekeeping_suspend_time;
83
84+static void update_sleep_time(struct timespec t)
85+{
86+ total_sleep_time = t;
87+ offs_boot = timespec_to_ktime(t);
88+}
89+
90 /**
91 * __timekeeping_inject_sleeptime - Internal function to add sleep interval
92 * @delta: pointer to a timespec delta value
93@@ -612,7 +635,7 @@ static void __timekeeping_inject_sleeptime(struct timespec *delta)
94
95 xtime = timespec_add(xtime, *delta);
96 wall_to_monotonic = timespec_sub(wall_to_monotonic, *delta);
97- total_sleep_time = timespec_add(total_sleep_time, *delta);
98+ update_sleep_time(timespec_add(total_sleep_time, *delta));
99 }
100
101
102--
1031.7.7.6
104