diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-11-22 06:04:18 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-11-25 03:15:41 -0500 |
commit | 8adbf78ec4839c1dc4ff20c9a1f332a7bc99e6e6 (patch) | |
tree | 303b6c395fd521916b999aa11f65738a68f68315 /arch | |
parent | 79c74ecbebf76732f91b82a62ce7fc8a88326962 (diff) |
s390,time: revert direct ktime path for s390 clockevent device
Git commit 4f37a68cdaf6dea833cfdded2a3e0c47c0f006da
"s390: Use direct ktime path for s390 clockevent device" makes use
of the CLOCK_EVT_FEAT_KTIME clockevent option to avoid the delta
calculation with ktime_get() in clockevents_program_event and the
get_tod_clock() in s390_next_event. This is based on the assumption
that the difference between the internal ktime and the hardware
clock is reflected in the wall_to_monotonic delta. But this is not
true, the ntp corrections are applied via changes to the tk->mult
multiplier and this is not reflected in wall_to_monotonic.
In theory this could be solved by using the raw monotonic clock
but it is simpler to switch back to the standard clock delta
calculation.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/kernel/time.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index 60a508a9b981..dd95f1631621 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -108,20 +108,10 @@ static void fixup_clock_comparator(unsigned long long delta) | |||
108 | set_clock_comparator(S390_lowcore.clock_comparator); | 108 | set_clock_comparator(S390_lowcore.clock_comparator); |
109 | } | 109 | } |
110 | 110 | ||
111 | static int s390_next_ktime(ktime_t expires, | 111 | static int s390_next_event(unsigned long delta, |
112 | struct clock_event_device *evt) | 112 | struct clock_event_device *evt) |
113 | { | 113 | { |
114 | struct timespec ts; | 114 | S390_lowcore.clock_comparator = get_tod_clock() + delta; |
115 | u64 nsecs; | ||
116 | |||
117 | ts.tv_sec = ts.tv_nsec = 0; | ||
118 | monotonic_to_bootbased(&ts); | ||
119 | nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires)); | ||
120 | do_div(nsecs, 125); | ||
121 | S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs << 9); | ||
122 | /* Program the maximum value if we have an overflow (== year 2042) */ | ||
123 | if (unlikely(S390_lowcore.clock_comparator < sched_clock_base_cc)) | ||
124 | S390_lowcore.clock_comparator = -1ULL; | ||
125 | set_clock_comparator(S390_lowcore.clock_comparator); | 115 | set_clock_comparator(S390_lowcore.clock_comparator); |
126 | return 0; | 116 | return 0; |
127 | } | 117 | } |
@@ -146,15 +136,14 @@ void init_cpu_timer(void) | |||
146 | cpu = smp_processor_id(); | 136 | cpu = smp_processor_id(); |
147 | cd = &per_cpu(comparators, cpu); | 137 | cd = &per_cpu(comparators, cpu); |
148 | cd->name = "comparator"; | 138 | cd->name = "comparator"; |
149 | cd->features = CLOCK_EVT_FEAT_ONESHOT | | 139 | cd->features = CLOCK_EVT_FEAT_ONESHOT; |
150 | CLOCK_EVT_FEAT_KTIME; | ||
151 | cd->mult = 16777; | 140 | cd->mult = 16777; |
152 | cd->shift = 12; | 141 | cd->shift = 12; |
153 | cd->min_delta_ns = 1; | 142 | cd->min_delta_ns = 1; |
154 | cd->max_delta_ns = LONG_MAX; | 143 | cd->max_delta_ns = LONG_MAX; |
155 | cd->rating = 400; | 144 | cd->rating = 400; |
156 | cd->cpumask = cpumask_of(cpu); | 145 | cd->cpumask = cpumask_of(cpu); |
157 | cd->set_next_ktime = s390_next_ktime; | 146 | cd->set_next_event = s390_next_event; |
158 | cd->set_mode = s390_set_mode; | 147 | cd->set_mode = s390_set_mode; |
159 | 148 | ||
160 | clockevents_register_device(cd); | 149 | clockevents_register_device(cd); |