Skip to content

Commit 82e88ff

Browse files
committed
hrtimer: Revert CLOCK_MONOTONIC_RAW support
Revert commits: a6e707d: KVM: arm/arm64: timer: Switch to CLOCK_MONOTONIC_RAW 9006a01: hrtimer: Catch illegal clockids 9c80876: 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: Marc Zyngier <marc.zyngier@arm.com> Link: http://lkml.kernel.org/r/56D6CEF0.8060607@arm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 232d263 commit 82e88ff

3 files changed

Lines changed: 4 additions & 19 deletions

File tree

‎include/linux/hrtimer.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ enum hrtimer_base_type {
151151
HRTIMER_BASE_REALTIME,
152152
HRTIMER_BASE_BOOTTIME,
153153
HRTIMER_BASE_TAI,
154-
HRTIMER_BASE_MONOTONIC_RAW,
155154
HRTIMER_MAX_CLOCK_BASES,
156155
};
157156

‎kernel/time/hrtimer.c‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,30 +90,19 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
9090
.clockid = CLOCK_TAI,
9191
.get_time = &ktime_get_clocktai,
9292
},
93-
{
94-
.index = HRTIMER_BASE_MONOTONIC_RAW,
95-
.clockid = CLOCK_MONOTONIC_RAW,
96-
.get_time = &ktime_get_raw,
97-
},
9893
}
9994
};
10095

10196
static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
102-
/* Make sure we catch unsupported clockids */
103-
[0 ... MAX_CLOCKS - 1] = HRTIMER_MAX_CLOCK_BASES,
104-
10597
[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
10698
[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
107-
[CLOCK_MONOTONIC_RAW] = HRTIMER_BASE_MONOTONIC_RAW,
10899
[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
109100
[CLOCK_TAI] = HRTIMER_BASE_TAI,
110101
};
111102

112103
static inline int hrtimer_clockid_to_base(clockid_t clock_id)
113104
{
114-
int base = hrtimer_clock_to_base_table[clock_id];
115-
BUG_ON(base == HRTIMER_MAX_CLOCK_BASES);
116-
return base;
105+
return hrtimer_clock_to_base_table[clock_id];
117106
}
118107

119108
/*
@@ -1279,10 +1268,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
12791268
if (!(active & 0x01))
12801269
continue;
12811270

1282-
if (unlikely(base->index == HRTIMER_BASE_MONOTONIC_RAW))
1283-
basenow = ktime_get_raw();
1284-
else
1285-
basenow = ktime_add(now, base->offset);
1271+
basenow = ktime_add(now, base->offset);
12861272

12871273
while ((node = timerqueue_getnext(&base->active))) {
12881274
struct hrtimer *timer;

‎virt/kvm/arm/arch_timer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static bool timer_is_armed(struct arch_timer_cpu *timer)
4848
static void timer_arm(struct arch_timer_cpu *timer, u64 ns)
4949
{
5050
timer->armed = true;
51-
hrtimer_start(&timer->timer, ktime_add_ns(ktime_get_raw(), ns),
51+
hrtimer_start(&timer->timer, ktime_add_ns(ktime_get(), ns),
5252
HRTIMER_MODE_ABS);
5353
}
5454

@@ -308,7 +308,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
308308
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
309309

310310
INIT_WORK(&timer->expired, kvm_timer_inject_irq_work);
311-
hrtimer_init(&timer->timer, CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);
311+
hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
312312
timer->timer.function = kvm_timer_expire;
313313
}
314314

0 commit comments

Comments
 (0)