Skip to contentSkip to conversation

pit-div_round.patch

PATCH New Arun Sharma 1 participant 1 message Apr 21, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pit-div_round.patch

Truly round off the div result to get right PIT frequency for guest. Otherwise, the guest's idea of time drifts away from that of the host.

xen/include/xen/lib.h +1 -1
Index: trunk/xen/include/xen/lib.h
===================================================================
@@ -21,7 +21,7 @@
 #define SWAP(_a, _b) \
    do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
 
-#define DIV_ROUND(x, y) (((x) + (y) - 1) / (y))
+#define DIV_ROUND(x, y) (((x) + (y) / 2) / (y))
 
 #define reserve_bootmem(_p,_l) ((void)0)