Commit 82e88ff1 authored by Thomas Gleixner's avatar Thomas Gleixner

hrtimer: Revert CLOCK_MONOTONIC_RAW support

Revert commits:
a6e707dd: KVM: arm/arm64: timer: Switch to CLOCK_MONOTONIC_RAW
9006a018: hrtimer: Catch illegal clockids
9c808765: hrtimer: Add support for CLOCK_MONOTONIC_RAW

Marc found out, that there are fundamental issues with that patch series
because __hrtimer_get_next_event() and hrtimer_forward() need support for
CLOCK_MONOTONIC_RAW. Nothing which is easily fixed, so revert the whole lot.
Reported-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Link: http://lkml.kernel.org/r/56D6CEF0.8060607@arm.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 232d2637
...@@ -151,7 +151,6 @@ enum hrtimer_base_type { ...@@ -151,7 +151,6 @@ enum hrtimer_base_type {
HRTIMER_BASE_REALTIME, HRTIMER_BASE_REALTIME,
HRTIMER_BASE_BOOTTIME, HRTIMER_BASE_BOOTTIME,
HRTIMER_BASE_TAI, HRTIMER_BASE_TAI,
HRTIMER_BASE_MONOTONIC_RAW,
HRTIMER_MAX_CLOCK_BASES, HRTIMER_MAX_CLOCK_BASES,
}; };
......
...@@ -90,30 +90,19 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = ...@@ -90,30 +90,19 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
.clockid = CLOCK_TAI, .clockid = CLOCK_TAI,
.get_time = &ktime_get_clocktai, .get_time = &ktime_get_clocktai,
}, },
{
.index = HRTIMER_BASE_MONOTONIC_RAW,
.clockid = CLOCK_MONOTONIC_RAW,
.get_time = &ktime_get_raw,
},
} }
}; };
static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
/* Make sure we catch unsupported clockids */
[0 ... MAX_CLOCKS - 1] = HRTIMER_MAX_CLOCK_BASES,
[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
[CLOCK_MONOTONIC_RAW] = HRTIMER_BASE_MONOTONIC_RAW,
[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
[CLOCK_TAI] = HRTIMER_BASE_TAI, [CLOCK_TAI] = HRTIMER_BASE_TAI,
}; };
static inline int hrtimer_clockid_to_base(clockid_t clock_id) static inline int hrtimer_clockid_to_base(clockid_t clock_id)
{ {
int base = hrtimer_clock_to_base_table[clock_id]; return hrtimer_clock_to_base_table[clock_id];
BUG_ON(base == HRTIMER_MAX_CLOCK_BASES);
return base;
} }
/* /*
...@@ -1279,10 +1268,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now) ...@@ -1279,10 +1268,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
if (!(active & 0x01)) if (!(active & 0x01))
continue; continue;
if (unlikely(base->index == HRTIMER_BASE_MONOTONIC_RAW)) basenow = ktime_add(now, base->offset);
basenow = ktime_get_raw();
else
basenow = ktime_add(now, base->offset);
while ((node = timerqueue_getnext(&base->active))) { while ((node = timerqueue_getnext(&base->active))) {
struct hrtimer *timer; struct hrtimer *timer;
......
...@@ -48,7 +48,7 @@ static bool timer_is_armed(struct arch_timer_cpu *timer) ...@@ -48,7 +48,7 @@ static bool timer_is_armed(struct arch_timer_cpu *timer)
static void timer_arm(struct arch_timer_cpu *timer, u64 ns) static void timer_arm(struct arch_timer_cpu *timer, u64 ns)
{ {
timer->armed = true; timer->armed = true;
hrtimer_start(&timer->timer, ktime_add_ns(ktime_get_raw(), ns), hrtimer_start(&timer->timer, ktime_add_ns(ktime_get(), ns),
HRTIMER_MODE_ABS); HRTIMER_MODE_ABS);
} }
...@@ -308,7 +308,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) ...@@ -308,7 +308,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
INIT_WORK(&timer->expired, kvm_timer_inject_irq_work); INIT_WORK(&timer->expired, kvm_timer_inject_irq_work);
hrtimer_init(&timer->timer, CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS); hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
timer->timer.function = kvm_timer_expire; timer->timer.function = kvm_timer_expire;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment