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

Re: [Xen-devel] [PATCH]Fixes for overflowed calculation in vHPET



It sounds like a theoretical problem to me. You’d have to set the period, or single-shot timeout, to many years to have it wrap around in the 64th bit and appear negative. Noone will do that.

 -- Keir

On 9/1/08 01:19, "Shan, Haitao" <haitao.shan@xxxxxxxxx> wrote:

I think it is OK for normal usage and for 32bit timer operation.
But if a timer is programmed at 64bit mode, and the period programmed is sufficiently large, say 0xf000_0000_0000_0000, the code introduces trouble. Actually the timer should never be fired. However, (int64_s)0xf000_0000_0000_0000 < 0, then the period is forced to 0 and the timer is fired immediately.
Best Regards
Haitao Shan

 


From: Keir Fraser [mailto:Keir.Fraser@xxxxxxxxxxxx]
Sent: 2008年1月8日 22:15
To: Shan, Haitao; xen-devel@xxxxxxxxxxxxxxxxxxx
Cc: Mark McLoughlin; Cui, Dexuan
Subject: Re: [Xen-devel] [PATCH]Fixes for overflowed calculation in vHPET

On 4/1/08 03:21, "Shan, Haitao" <haitao.shan@xxxxxxxxx> wrote:

This patch will  fix the bugs in hpet_set_timer. Currently in hpet_tick_to_ns, the approach is  multiplying first, which easily causes overflow when tick is quite large. The  patch cannot handle arbitrate large ticks duo to the precision requirement and  64bit's value range. But by optimize the equation, a larger ticks than current  code can be supported. Also an overflow check is added before the calculation.  
This patch will also fix the wrong handling of wrap around case when timer  is in 64bit mode.
 

What’s wrong with the handling of the wrap-around case? It looks okay to me.

 -- Keir


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