WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] hvm: Fix multiplication overflow in hvm/p

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: Fix multiplication overflow in hvm/pmtimer.c
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jun 2007 07:31:12 -0700
Delivery-date: Fri, 15 Jun 2007 07:29:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1181896959 -3600
# Node ID b4c16658ca30b05964888aff65dec0561ade2714
# Parent  276b48771f1e1b926dc478271fcc249a0788dc75
hvm: Fix multiplication overflow in hvm/pmtimer.c

Too many ACPI events (SCI) are raised on hvm because of
multiplication overflow.

FREQUENCE_PMTIMER=3579545
(1000000000ULL << 32) / FREQUENCE_PMTIMER = 0xae9a7b1663a
pmt_cycles_until_flip =~ 0x80000000
0xae9a7b1663a*0x80000000 = overflow!!!

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/pmtimer.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff -r 276b48771f1e -r b4c16658ca30 xen/arch/x86/hvm/pmtimer.c
--- a/xen/arch/x86/hvm/pmtimer.c        Fri Jun 15 09:32:22 2007 +0100
+++ b/xen/arch/x86/hvm/pmtimer.c        Fri Jun 15 09:42:39 2007 +0100
@@ -50,7 +50,6 @@
 #define TMR_VAL_MASK  (0xffffffff)
 #define TMR_VAL_MSB   (0x80000000)
 
-
 /* Dispatch SCIs based on the PM1a_STS and PM1a_EN registers */
 static void pmt_update_sci(PMTState *s)
 {
@@ -89,19 +88,19 @@ static void pmt_timer_callback(void *opa
     PMTState *s = opaque;
     uint32_t pmt_cycles_until_flip;
     uint64_t time_until_flip;
-    
+
     /* Recalculate the timer and make sure we get an SCI if we need one */
     pmt_update_time(s);
-    
+
     /* How close are we to the next MSB flip? */
     pmt_cycles_until_flip = TMR_VAL_MSB - (s->pm.tmr_val & (TMR_VAL_MSB - 1));
-    
+
     /* Overall time between MSB flips */
-    time_until_flip = (1000000000ULL << 31) / FREQUENCE_PMTIMER;
-    
+    time_until_flip = (1000000000ULL << 23) / FREQUENCE_PMTIMER;
+
     /* Reduced appropriately */
-    time_until_flip = (time_until_flip * pmt_cycles_until_flip) / (1ULL<<31);
-    
+    time_until_flip = (time_until_flip * pmt_cycles_until_flip) >> 23;
+
     /* Wake up again near the next bit-flip */
     set_timer(&s->timer, NOW() + time_until_flip + MILLISECS(1));
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: Fix multiplication overflow in hvm/pmtimer.c, Xen patchbot-unstable <=