[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC 04/25] Replace "/" operand with div64



On 07/12/2011 09:12, "Keir Fraser" <keir.xen@xxxxxxxxx> wrote:

> Also, I assume the gcc arm target can at least do 64-bit arithmetic via
> library calls, which you could then implement in arch/arm. __divdi3 etc.
> Perhaps you intend to do this anyway and do_div() here is a bandaid.

Of course we already implement __divdi3/__udivdi3 in common/lib.c. That
should already have been sufficient so not sure why this timer.c change
would be needed at all?

>  -- Keir
> 
> On 07/12/2011 07:00, "Zhang, Xiantao" <xiantao.zhang@xxxxxxxxx> wrote:
> 
>> Hi, Stefano 
>> Great work from you guys!  One quick comment:  Just found the below logic's
>> change maybe wrong and probably  break current things.
>> Original logic is  A+B -(C%D), but it is changed to  (A+B-C)%D,  so if it is
>> not an intended fix, it should be an issue.
>> Thanks!
>> Xiantao  
>> 
>>> diff --git a/xen/common/timer.c b/xen/common/timer.c index 0547ea3..043250e
>>> 100644
>>> --- a/xen/common/timer.c
>>> +++ b/xen/common/timer.c
>>> @@ -23,6 +23,7 @@
>>> #include <xen/symbols.h>
>>> #include <asm/system.h>
>>> #include <asm/desc.h>
>>> +#include <asm/div64.h>
>>> #include <asm/atomic.h>
>>> 
>>> /* We program the time hardware this far behind the closest deadline. */ @@
>>> -503,16 +504,18 @@ static void timer_softirq_action(void)
>>> 
>>> s_time_t align_timer(s_time_t firsttick, uint64_t period)  {
>>> +    uint64_t n;
>>>    if ( !period )
>>>        return firsttick;
>>  
>>> -    return firsttick + (period - 1) - ((firsttick - 1) % period);
>>> +    n = firsttick + (period - 1) - (firsttick - 1);
>>> +    return do_div(n, period);
>>> }
>>  
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel
> 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.