]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: [PATCH] introduce get_clock_monotonic | |
3 | References: bnc#532063,LTC#55526 | |
4 | ||
5 | From: Heiko Carstens <heiko.carstens@de.ibm.com> | |
6 | ||
7 | Introduce get_clock_monotonic() function which can be used to get a | |
8 | (fast) timestamp. Resolution is the same as for get_clock(). The | |
9 | only difference is that the timestamps are monotonic and don't jump | |
10 | backward or forward. | |
11 | ||
12 | Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> | |
13 | Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> | |
14 | ||
15 | Acked-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 | ||
22 | Index: 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 | |
47 | Index: 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 |