[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 12:23, "Stefano Stabellini" <stefano.stabellini@xxxxxxxxxxxxx>
wrote:

> On Wed, 7 Dec 2011, Zhang, Xiantao 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  
> 
> True! Thanks for spotting this!

For the avoidance of doubt: this patch 04/25 is wrongheaded, and I will nack
it if it appears in the final patch series. You probably got this impression
from me already. ;-)

>>> 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®.