Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] wrong accounting in direct_remap_pfn_range

To: Steven Rostedt <srostedt@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] wrong accounting in direct_remap_pfn_range
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Wed, 30 Aug 2006 22:29:54 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, quintela@xxxxxxxxxx
Delivery-date: Wed, 30 Aug 2006 14:30:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <44F485E3.6010703@xxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcbMe27irSpa3DhuEdummAAKle7CWA==
Thread-topic: [Xen-devel] [PATCH] wrong accounting in direct_remap_pfn_range
User-agent: Microsoft-Entourage/11.2.5.060620
I think you're confused. The only time we execute the test-and-fixup code is
if we exit the for loop in the normal way. All exceptional exits from the
loop are done by 'goto out', which skips the test-and-fixup code. So we can
only reach the test-and-fixup code after executing a whole number of
iterations of the for loop, so I don't think that there is a problem.

 -- Keir

On 29/8/06 7:22 pm, "Steven Rostedt" <srostedt@xxxxxxxxxx> wrote:

>> There is a check if (v != u) then do some more work.  I'm assuming that
>> this code is there in case we didn't reach the if statement at the top
>> of the loop.  But what is wrong is that this check is invalid.  Although
>> the loop if statement sets v = u, the following if statement ignores the
>> fact that v++ is done at the bottom of the loop.  So if we really want
>> to do this extra work if we didn't finish the loop, then the test really
>> needs to be.
>> 
>> if ((v - u) != 1) { .... }
>> 
>> 
>> Unless I'm missing something here, I've attached a patch.
>> 
> 
> I did miss something.  The fact that the loop may only go once.  This
> means that v - u will equal 1 and we miss that allocation.  So to handle
>   this, I'm submitting this patch that just keeps track of whether or
> not we need to do the final fixup.



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