From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Jindrich Makovicka <makovick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: kvm-37 problem w/ 64-bit division in lapic.c
Date: Wed, 12 Sep 2007 11:05:30 +0300 [thread overview]
Message-ID: <46E79DCA.70101@qumranet.com> (raw)
In-Reply-To: <20070910182628.5fc7090f@holly>
Jindrich Makovicka wrote:
> On Mon, 10 Sep 2007 11:49:02 +0200
> "Jindrich Makovicka" <makovick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>> On 9/10/07, Dong, Eddie <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> div64_32 is enough, does this function exist?
>>>
>> afaik, __div64_32 is architecture specific, but do_div() could be
>> actually used here.
>>
>
> This version should be faster.
>
>
[please don't post patches with extensions like ".diff2", which don't
show in the mail reader]
> - u32 counter_passed;
> + u64 counter_passed;
> ktime_t passed, now = apic->timer.dev.base->get_time();
> u32 tmcct = apic_get_reg(apic, APIC_TMICT);
>
> @@ -512,8 +512,8 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
> } else
> passed = ktime_sub(now, apic->timer.last_update);
>
> - counter_passed = div64_64(ktime_to_ns(passed),
> - (APIC_BUS_CYCLE_NS *
> apic->timer.divide_count));
> + counter_passed = ktime_to_ns(passed);
> + do_div(counter_passed, APIC_BUS_CYCLE_NS *
> apic->timer.divide_count);
> tmcct -= counter_passed;
What if counter_passed overflows? Sure, that means kvm wasn't scheduled
for 4 seconds, but it could happen.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2007-09-12 8:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-09 11:05 [ANNOUNCE] kvm-37 release Avi Kivity
2007-09-09 14:26 ` Jindrich Makovicka
[not found] ` <46E3D369.8000401-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-09 15:36 ` kvm-37 problem w/ 64-bit division in lapic.c Jindrich Makovicka
2007-09-09 15:45 ` Avi Kivity
2007-09-10 9:20 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A02108583-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-10 9:49 ` Jindrich Makovicka
[not found] ` <5f0e26840709100249y239692c2gcdd3938fc6b23b6c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-10 16:26 ` Jindrich Makovicka
2007-09-12 8:05 ` Avi Kivity [this message]
[not found] ` <46E79DCA.70101-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-12 9:43 ` Dong, Eddie
[not found] ` <10EA09EFD8728347A513008B6B0DA77A0210915A-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-12 9:56 ` Avi Kivity
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=46E79DCA.70101@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=makovick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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