From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Randy Dunlap <rdunlap@xenotime.net>,
linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Liu >> \"Liu, Jinsong\"" <jinsong.liu@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>
Subject: [PATCH] KVM: x86: Use do_div for tsc deadline calculation
Date: Fri, 30 Sep 2011 13:50:20 +0200 [thread overview]
Message-ID: <4E85ACFC.1090509@siemens.com> (raw)
In-Reply-To: <20110930085810.11bc8e2e38e1400a8b0b4cec@canb.auug.org.au>
Required on i386 hosts.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
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);
--
1.7.3.4
next prev parent reply other threads:[~2011-09-30 11:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 6:57 linux-next: Tree for Sept 29 Stephen Rothwell
2011-09-29 19:50 ` linux-next: Tree for Sept 29 (kvm) Randy Dunlap
2011-09-29 22:58 ` Stephen Rothwell
2011-09-30 11:50 ` Jan Kiszka [this message]
2011-09-30 17:35 ` [PATCH] KVM: x86: Use do_div for tsc deadline calculation Randy Dunlap
2011-10-02 9:05 ` Avi Kivity
2011-09-29 20:17 ` [PATCH] olpc: olpc-xo1-sci.c is an input driver, depends on INPUT Randy Dunlap
2011-09-29 20:34 ` Andres Salomon
2011-09-29 20:36 ` Randy Dunlap
2011-10-06 17:12 ` Randy Dunlap
2011-09-29 20:35 ` [PATCH -next] x86 mrst: fix build error when X86_MRST is not enabled Randy Dunlap
2011-09-29 22:57 ` Alan Cox
2011-09-29 23:10 ` Andrew Morton
2011-09-30 9:07 ` Alan Cox
2011-09-29 23:16 ` Randy Dunlap
2011-09-30 9:04 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E85ACFC.1090509@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=jinsong.liu@intel.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=rdunlap@xenotime.net \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).