[EMAIL PROTECTED] wrote:
> Jindrich Makovicka wrote:
>> On Mon, 10 Sep 2007 11:49:02 +0200
>> "Jindrich Makovicka" <[EMAIL PROTECTED]> wrote:
>> 
>> 
>>> On 9/10/07, Dong, Eddie <[EMAIL PROTECTED]> 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.
> 
> 
It won't happen. see
 passed = ktime_sub(now, apic->timer.last_update);

-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to