]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/s390-17-perf-12-get_clock_monotonic.patch
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / s390-17-perf-12-get_clock_monotonic.patch
CommitLineData
82094b55
AF
1From: Gerald Schaefer <geraldsc@de.ibm.com>
2Subject: [PATCH] introduce get_clock_monotonic
3References: bnc#532063,LTC#55526
4
5From: Heiko Carstens <heiko.carstens@de.ibm.com>
6
7Introduce get_clock_monotonic() function which can be used to get a
8(fast) timestamp. Resolution is the same as for get_clock(). The
9only difference is that the timestamps are monotonic and don't jump
10backward or forward.
11
12Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
14
15Acked-by: John Jolly <jjolly@suse.de>
16---
17
18 arch/s390/include/asm/timex.h | 16 ++++++++++++++++
19 arch/s390/kernel/time.c | 3 ++-
20 2 files changed, 18 insertions(+), 1 deletion(-)
21
22Index: linux-sles11/arch/s390/include/asm/timex.h
23===================================================================
24--- linux-sles11.orig/arch/s390/include/asm/timex.h
25+++ linux-sles11/arch/s390/include/asm/timex.h
26@@ -85,4 +85,20 @@ int get_sync_clock(unsigned long long *c
27 void init_cpu_timer(void);
28 unsigned long long monotonic_clock(void);
29
30+extern u64 jiffies_timer_cc;
31+
32+/**
33+ * get_clock_monotonic - returns current time in clock rate units
34+ *
35+ * The caller must ensure that preemption is disabled.
36+ * The clock and sched_clock_base get changed via stop_machine.
37+ * Therefore preemption must be disabled when calling this
38+ * function, otherwise the returned value is not guaranteed to
39+ * be monotonic.
40+ */
41+static inline unsigned long long get_clock_monotonic(void)
42+{
43+ return get_clock_xt() - jiffies_timer_cc;
44+}
45+
46 #endif
47Index: linux-sles11/arch/s390/kernel/time.c
48===================================================================
49--- linux-sles11.orig/arch/s390/kernel/time.c
50+++ linux-sles11/arch/s390/kernel/time.c
51@@ -63,7 +63,8 @@
52
53 static ext_int_info_t ext_int_info_cc;
54 static ext_int_info_t ext_int_etr_cc;
55-static u64 jiffies_timer_cc;
56+u64 jiffies_timer_cc;
57+EXPORT_SYMBOL(jiffies_timer_cc);
58
59 static DEFINE_PER_CPU(struct clock_event_device, comparators);
60