lkml.org 
[lkml]   [2011]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: x86: Use do_div for tsc deadline calculation
On 09/30/11 04:50, Jan Kiszka wrote:
> Required on i386 hosts.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>

Thanks.

> ---
> arch/x86/kvm/lapic.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index f9385ec..92390dc 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -740,9 +740,10 @@ static void start_apic_timer(struct kvm_lapic *apic)
>
> now = apic->lapic_timer.timer.base->get_time();
> guest_tsc = kvm_x86_ops->read_l1_tsc(vcpu);
> - if (likely(tscdeadline > guest_tsc))
> - ns = (tscdeadline - guest_tsc)
> - * 1000000L / this_tsc_khz;
> + if (likely(tscdeadline > guest_tsc)) {
> + ns = (tscdeadline - guest_tsc) * 1000000ULL;
> + do_div(ns, this_tsc_khz);
> + }
> hrtimer_start(&apic->lapic_timer.timer,
> ktime_add_ns(now, ns), HRTIMER_MODE_ABS);
>


--
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***


\
 
 \ /
  Last update: 2011-09-30 19:39    [from the cache]
©2003-2011 Jasper Spaans