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] [XEN] Truncate arithmetic for PERFSTATUS

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Truncate arithmetic for PERFSTATUS counters to the width of perfc_t.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Apr 2007 10:50:20 -0700
Delivery-date: Tue, 24 Apr 2007 10:50:24 -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 Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1177411153 -3600
# Node ID 8ff0df8ad5879596b38ecece8efda867285226bd
# Parent  fe4784ff9fd3996bc7960a4e2b42ad56ecf5aef9
[XEN] Truncate arithmetic for PERFSTATUS counters to the width of perfc_t.
Since these are all calculated per-cpu now, a status counter that is
incremented on one cpu and decremented on another will underflow on
the decrement.  When we add the per-cpu values to get the total, if
we don't truncate the sum it will be max-perfc + 1 instead of zero.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 xen/common/perfc.c |    8 ++++++++
 1 files changed, 8 insertions(+)

diff -r fe4784ff9fd3 -r 8ff0df8ad587 xen/common/perfc.c
--- a/xen/common/perfc.c        Tue Apr 24 10:34:47 2007 +0100
+++ b/xen/common/perfc.c        Tue Apr 24 11:39:13 2007 +0100
@@ -48,6 +48,8 @@ void perfc_printall(unsigned char key)
         case TYPE_S_SINGLE:
             for_each_online_cpu ( cpu )
                 sum += per_cpu(perfcounters, cpu)[j];
+            if ( perfc_info[i].type == TYPE_S_SINGLE ) 
+                sum = (perfc_t) sum;
             printk("TOTAL[%12Lu]", sum);
             if ( sum )
             {
@@ -71,6 +73,8 @@ void perfc_printall(unsigned char key)
                 for ( k = 0; k < perfc_info[i].nr_elements; k++ )
                     sum += counters[k];
             }
+            if ( perfc_info[i].type == TYPE_S_ARRAY ) 
+                sum = (perfc_t) sum;
             printk("TOTAL[%12Lu]", sum);
             if (sum)
             {
@@ -80,6 +84,8 @@ void perfc_printall(unsigned char key)
                     sum = 0;
                     for_each_online_cpu ( cpu )
                         sum += per_cpu(perfcounters, cpu)[j + k];
+                    if ( perfc_info[i].type == TYPE_S_ARRAY ) 
+                        sum = (perfc_t) sum;
                     if ( (k % 4) == 0 )
                         printk("\n%16s", "");
                     printk("  ARR%02u[%10Lu]", k, sum);
@@ -94,6 +100,8 @@ void perfc_printall(unsigned char key)
                     sum = 0;
                     for ( n = 0; n < perfc_info[i].nr_elements; n++ )
                         sum += counters[n];
+                    if ( perfc_info[i].type == TYPE_S_ARRAY ) 
+                        sum = (perfc_t) sum;
                     if ( k > 0 && (k % 4) == 0 )
                         printk("\n%46s", "");
                     printk("  CPU%02u[%10Lu]", cpu, sum);

_______________________________________________
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] [XEN] Truncate arithmetic for PERFSTATUS counters to the width of perfc_t., Xen patchbot-unstable <=