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 5] xentrace: fix t_info_pages calculation fo

To: "Olaf Hering" <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 1 of 5] xentrace: fix t_info_pages calculation for the default case
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 23 Mar 2011 10:12:18 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, George Dunlap <george.dunlap@xxxxxxxxxx>
Delivery-date: Wed, 23 Mar 2011 03:12:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <08df96398bff82a8924a.1300821689@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.1300821688@localhost> <08df96398bff82a8924a.1300821689@localhost>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 22.03.11 at 20:21, Olaf Hering <olaf@xxxxxxxxx> wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@xxxxxxxxx>
> # Date 1300813685 -3600
> # Node ID 08df96398bff82a8924a37eda6ddffd1ada3f407
> # Parent  c81f0ef5a77d90fbf108d3efe489d08df45b63c2
> xentrace: fix t_info_pages calculation for the default case
> 
> The default tracebuffer size of 32 pages was not tested with the previous 
> patch.
> As a result, t_info_pages will become zero and alloc_xenheap_pages() fails.
> Catch this case and allocate at least one page.
> 
> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
> 
> diff -r c81f0ef5a77d -r 08df96398bff xen/common/trace.c
> --- a/xen/common/trace.c      Mon Mar 21 14:52:27 2011 +0000
> +++ b/xen/common/trace.c      Tue Mar 22 18:08:05 2011 +0100
> @@ -125,7 +125,7 @@
>      t_info_pages = num_online_cpus() * pages + t_info_first_offset;
>      t_info_pages *= sizeof(uint32_t);
>      t_info_pages /= PAGE_SIZE;
> -    if ( t_info_pages % PAGE_SIZE )
> +    if ( t_info_pages % PAGE_SIZE || t_info_pages == 0 )

While certainly not having a significant effect, to the unsuspecting
reader this looks like a bug - is it really meant to be a remainder
operation on the *result* of a division (rather than on the original
dividend)? Couldn't you just (ab)use PFN_UP() here?

Jan

>          t_info_pages++;
>      return pages;
>  }



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

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