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/
Home Products Support Community News


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 12:45:51 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir.xen@xxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
Delivery-date: Wed, 23 Mar 2011 05:45:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110323112040.GB28535@xxxxxxxxx>
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: <4D89D5920200007800037DBE@xxxxxxxxxxxxxxxxxx> <C9AF7A58.15475%keir.xen@xxxxxxxxx> <20110323112040.GB28535@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 23.03.11 at 12:20, Olaf Hering <olaf@xxxxxxxxx> wrote:
> On Wed, Mar 23, Keir Fraser wrote:
>> On 23/03/2011 10:12, "Jan Beulich" <JBeulich@xxxxxxxxxx> wrote:
>> >>      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?
>> By which you mean to replace the division and subsequent if statement with
>> t_info_pages = PFN_UP(t_info_pages).
> I did not know about PFN_UP() until now, using it would work as well.

Note that one caveat with using it here is that you'd first need to
move its definition from include/asm-x86/page.h to somewhere
under include/xen/ - perhaps having a pfn.h like Linux does would
make sense.


Xen-devel mailing list

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