From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH RFC 04/25] Replace "/" operand with div64 Date: Wed, 07 Dec 2011 09:16:48 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Zhang, Xiantao" , "stefano.stabellini@eu.citrix.com" , "xen-devel@lists.xensource.com" Cc: Ian Campbell , Tim Deegan List-Id: xen-devel@lists.xenproject.org On 07/12/2011 09:12, "Keir Fraser" 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" 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 >>> #include >>> #include >>> +#include >>> #include >>> >>> /* 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@lists.xensource.com >> http://lists.xensource.com/xen-devel > >