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] Re: [PATCH 2/6] trace: fix T_INFO_FIRST_OFFSET

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 2/6] trace: fix T_INFO_FIRST_OFFSET
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Wed, 30 Jun 2010 15:52:19 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 30 Jun 2010 07:53:57 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=Xbntq6j4M83Xg3rqy8g4VhsqWZTNE9svC3RJ/VBi74g=; b=hdv5zP/PtwmWgWZNzZUtH+sCJZkJEHNbr324V2bA6t+t5MLVTfzi1ap55NNZAlEmGi CUfCbFq8Ol83/QYyhcTEggSRFhX5j1gcg6nwZby9Y168zlqmzMcYUOsgDlms8v/oAJup r0C8aDajypyRbxu9vkzxLBlGjoql+aW4s9SVQ=
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; b=ehjXxKpEZjRwKLX0teCPukNvajVZ1X8MN3b8/88pxe28f0tLa5jzg95/zD1cUQCPT3 hxrr7P/yI4QZimUcLtAOKAbjidjoUMysFaWa3wOOZYGKDzzq7+kgm9JVaDEHs4ODIth2 +L9Ibfx7m747VghI9N2xQ4n96ftBwC50G8fus=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C2A2E370200007800008A61@xxxxxxxxxxxxxxxxxx>
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: <4C2A2E370200007800008A61@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Good catch.  This fix produces the correct index, but:
* It's not as clear, IMHO, where the math is coming from
* I think it may give the wrong result if the t_info struct ever
changes (e.g., more data before the cpu offset list)

The bug in the original math was that I should have added 3 to round
up, rather than 1.

I'm attaching a patch that will hopefully fix the bug and make it more
clear.  Thoughts?

 -George

On Tue, Jun 29, 2010 at 4:32 PM, Jan Beulich <JBeulich@xxxxxxxxxx> wrote:
> This wasn't defined correctly, thus allowing in the
> num_online_cpus() == NR_CPUS case to pass a corrupted MFN to
> Dom0.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
>
> --- 2010-06-15.orig/xen/common/trace.c  2010-06-28 11:58:37.000000000 +0200
> +++ 2010-06-15/xen/common/trace.c       2010-06-28 11:58:37.000000000 +0200
> @@ -51,7 +51,7 @@ static struct t_info *t_info;
>  #define T_INFO_PAGES 2  /* Size fixed at 2 pages for now. */
>  #define T_INFO_SIZE ((T_INFO_PAGES)*(PAGE_SIZE))
>  /* t_info.tbuf_size + list of mfn offsets + 1 to round up / sizeof uint32_t 
> */
> -#define T_INFO_FIRST_OFFSET ((sizeof(int16_t) + NR_CPUS * sizeof(int16_t) + 
> 1) / sizeof(uint32_t))
> +#define T_INFO_FIRST_OFFSET (((2 + NR_CPUS) * sizeof(uint16_t)) / 
> sizeof(uint32_t))
>  static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf *, t_bufs);
>  static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data);
>  static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock);
>
>
>
>

Attachment: trace-t_info-first-offset-v2.patch
Description: Text Data

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