summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2014-12-21 19:47:06 +0100
committerDavid S. Miller <davem@davemloft.net>2014-12-30 18:29:27 -0500
commit2eebdde6528a722fbf8e2cffcf7aa52cbb4c2de0 (patch)
treec4b176d1e40eecb2caa00952eae95ecb2b2a046b /virt
parentf25a30be359d0535fb1c7c1619cabb0ad17cfbf1 (diff)
timecounter: keep track of accumulated fractional nanoseconds
The current timecounter implementation will drop a variable amount of resolution, depending on the magnitude of the time delta. In other words, reading the clock too often or too close to a time stamp conversion will introduce errors into the time values. This patch fixes the issue by introducing a fractional nanosecond field that accumulates the low order bits. Reported-by: Janusz Użycki <j.uzycki@elproma.com.pl> Signed-off-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/arch_timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 1c0772b340d8..6e54f3542126 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -152,7 +152,8 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu)
return;
}
- ns = cyclecounter_cyc2ns(timecounter->cc, cval - now);
+ ns = cyclecounter_cyc2ns(timecounter->cc, cval - now, timecounter->mask,
+ &timecounter->frac);
timer_arm(timer, ns);
}