Skip to content

Commit ab93e98

Browse files
committed
Merge tag 'timers-urgent-2020-03-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fix from Thomas Gleixner: "A single fix for the Hyper-V clocksource driver to make sched clock actually return nanoseconds and not the virtual clock value which increments at 10e7 HZ (100ns)" * tag 'timers-urgent-2020-03-29' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/hyper-v: Make sched clock return nanoseconds correctly
2 parents 01af08b + 749da8c commit ab93e98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/clocksource/hyperv_timer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ static u64 notrace read_hv_clock_tsc_cs(struct clocksource *arg)
343343

344344
static u64 read_hv_sched_clock_tsc(void)
345345
{
346-
return read_hv_clock_tsc() - hv_sched_clock_offset;
346+
return (read_hv_clock_tsc() - hv_sched_clock_offset) *
347+
(NSEC_PER_SEC / HV_CLOCK_HZ);
347348
}
348349

349350
static void suspend_hv_clock_tsc(struct clocksource *arg)
@@ -398,7 +399,8 @@ static u64 notrace read_hv_clock_msr_cs(struct clocksource *arg)
398399

399400
static u64 read_hv_sched_clock_msr(void)
400401
{
401-
return read_hv_clock_msr() - hv_sched_clock_offset;
402+
return (read_hv_clock_msr() - hv_sched_clock_offset) *
403+
(NSEC_PER_SEC / HV_CLOCK_HZ);
402404
}
403405

404406
static struct clocksource hyperv_cs_msr = {

0 commit comments

Comments
 (0)