From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Sharma Subject: [PATCH] pit-div_round.patch Date: Wed, 20 Apr 2005 17:03:54 -0700 Message-ID: <20050421000354.GA18222@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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. Signed-off-by: Edwin Zhai Signed-off-by: Arun Sharma Index: trunk/xen/include/xen/lib.h =================================================================== --- trunk/xen/include/xen/lib.h (revision 688) +++ trunk/xen/include/xen/lib.h (working copy) @@ -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)