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] xentrace: reduce trace buffer size to som

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xentrace: reduce trace buffer size to something mfn_offset can reach
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Thu, 16 Jun 2011 11:11:49 +0100
Delivery-date: Thu, 16 Jun 2011 03:17:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Olaf Hering <olaf@xxxxxxxxx>
# Date 1306409684 -3600
# Node ID dd0eb070ee44835324084a343140c87c6b08265c
# Parent  08a17b468c17084e4765bb0f330c0c71f50902b8
xentrace: reduce trace buffer size to something mfn_offset can reach

The start of the array which holds the list of mfns for each cpus
tracebuffer is stored in an unsigned short. This limits the total
amount of pages for each cpu as the number of active cpus increases.

Update the math in calculate_tbuf_size() to apply also this rule to
the max number of trace pages. Without this change the index can
overflow.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
---


diff -r 08a17b468c17 -r dd0eb070ee44 xen/common/trace.c
--- a/xen/common/trace.c        Thu May 26 08:21:00 2011 +0100
+++ b/xen/common/trace.c        Thu May 26 12:34:44 2011 +0100
@@ -112,11 +112,14 @@
     typeof(dummy_size.prod) max_size;
     struct t_info dummy_pages;
     typeof(dummy_pages.tbuf_size) max_pages;
+    typeof(dummy_pages.mfn_offset[0]) max_mfn_offset;
+    unsigned int max_cpus = num_online_cpus();
     unsigned int t_info_words;
 
     /* force maximum value for an unsigned type */
     max_size = -1;
     max_pages = -1;
+    max_mfn_offset = -1;
 
     /* max size holds up to n pages */
     max_size /= PAGE_SIZE;
@@ -124,6 +127,18 @@
     if ( max_size < max_pages )
         max_pages = max_size;
 
+    /*
+     * max mfn_offset holds up to n pages per cpu
+     * The array of mfns for the highest cpu can start at the maximum value
+     * mfn_offset can hold. So reduce the number of cpus and also the 
mfn_offset.
+     */
+    max_mfn_offset -= t_info_first_offset - 1;
+    max_cpus--;
+    if ( max_cpus )
+        max_mfn_offset /= max_cpus;
+    if ( max_mfn_offset < max_pages )
+        max_pages = max_mfn_offset;
+
     if ( pages > max_pages )
     {
         printk(XENLOG_INFO "xentrace: requested number of %u pages "

_______________________________________________
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] xentrace: reduce trace buffer size to something mfn_offset can reach, Xen patchbot-unstable <=