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

Re: [Xen-devel] [PATCH 1 of 4] xentrace: reduce trace buffer size to som

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 1 of 4] xentrace: reduce trace buffer size to something mfn_offset can reach
From: George Dunlap <dunlapg@xxxxxxxxx>
Date: Thu, 26 May 2011 11:05:14 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, George Dunlap <george.dunlap@xxxxxxxxxx>
Delivery-date: Thu, 26 May 2011 03:06:44 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rbh0phsrHzSTgZqODAj5N14sYxYTvkSUWyNL8zCIhAY=; b=FHkT5Bh05z1XhYucjFlX7iuBERnM2+qkZRlaynUstqQzzLFeiET0hSFZrYMgKgaYf0 wQljH40mOacN41rjwaOqWdZ7KqaOPYqYw6M4n9cM3jlOknKeSwhJPbaMSC/ZQSqQaklW GG31OLNJLvqYu7l0+QLu4nrt3XttCqIy6Iwu0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=iooUWHgNSL7s2iHiA3Ad6TDFQrGdZFPbtK/SbzMVALpVCmssu1oDiIxk/LQDmp63kD r99ORF3PBgVXmOKaZJOZDWcBgShRHOIsc7DHaLTju2cBxbQaXDPEciY3DJmARkB4xEqd C9f4m6ptDNoE9wdY/YO7B3uUSPRKd4n1y2Qcg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <8ac937fa527b28243227.1305037956@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.1305037955@localhost> <8ac937fa527b28243227.1305037956@localhost>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

Sorry for the delay!
 -George

On Tue, May 10, 2011 at 3:32 PM, Olaf Hering <olaf@xxxxxxxxx> wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@xxxxxxxxx>
> # Date 1305037380 -7200
> # Node ID 8ac937fa527b28243227193bf4749feb3a234c2c
> # Parent  19452acd23045f40c4e18437f0a60f016757e5bd
> 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>
>
> diff -r 19452acd2304 -r 8ac937fa527b xen/common/trace.c
> --- a/xen/common/trace.c        Fri May 06 11:15:35 2011 +0100
> +++ b/xen/common/trace.c        Tue May 10 16:23:00 2011 +0200
> @@ -112,11 +112,14 @@ static int calculate_tbuf_size(unsigned
>     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 @@ static int calculate_tbuf_size(unsigned
>     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-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

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