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-devel

[Xen-devel] [PATCH 1 of 3] xentrace: correct formula to calculate t_info

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1 of 3] xentrace: correct formula to calculate t_info_pages
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Wed, 30 Mar 2011 20:04:33 +0200
Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
Delivery-date: Wed, 30 Mar 2011 11:06:20 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1301508278; l=1461; s=domk; d=aepfle.de; h=Cc:To:From:Date:References:In-Reply-To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:X-RZG-CLASS-ID: X-RZG-AUTH; bh=bq2y44hj427JkyevBXp6s1kBiLQ=; b=k2V/2ZV065FPCMsDmXy6AoHs1YHpF1En9LWtOrrVyTZl8YVD0f76FCGZqrbMm5Jw6Rg uy2us1r7XQ/gG6QaOWiCdIaGQoxUP07DE+rZXXsHCAjaffCaZsP8SZ0707Eia6R79DBIn lCJXzsE8EtrA7h9IY7HJyv6Zm4JlO+MlCTk=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1301508272@localhost>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1301508272@localhost>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.8
# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1301423840 -7200
# Node ID 8a2ce5e49b2c5f2e013734b5d53eae37572f4101
# Parent  45eeeb6d0481efaab2a59941e1b8e061aead37d4
xentrace: correct formula to calculate t_info_pages

The current formula to calculate t_info_pages, based on the initial
code, is slightly incorrect. It may allocate more than needed.
Each cpu has some pages/mfns stored as uint32_t.
That list is stored with an offset at tinfo.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

---
 xen/common/trace.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff -r 45eeeb6d0481 -r 8a2ce5e49b2c xen/common/trace.c
--- a/xen/common/trace.c        Tue Mar 29 16:34:01 2011 +0100
+++ b/xen/common/trace.c        Tue Mar 29 20:37:20 2011 +0200
@@ -110,7 +110,7 @@
 {
     struct t_buf dummy;
     typeof(dummy.prod) size;
-    unsigned int t_info_words, t_info_bytes;
+    unsigned int t_info_words;
 
     /* force maximum value for an unsigned type */
     size = -1;
@@ -125,9 +125,8 @@
         pages = size;
     }
 
-    t_info_words = num_online_cpus() * pages + t_info_first_offset;
-    t_info_bytes = t_info_words * sizeof(uint32_t);
-    t_info_pages = PFN_UP(t_info_bytes);
+    t_info_words = num_online_cpus() * pages * sizeof(uint32_t);
+    t_info_pages = PFN_UP(t_info_first_offset + t_info_words);
     printk(XENLOG_INFO "xentrace: requesting %u t_info pages "
            "for %u trace pages on %u cpus\n",
            t_info_pages, pages, num_online_cpus());

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

<Prev in Thread] Current Thread [Next in Thread>