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] cleanup for __start_xen()

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] cleanup for __start_xen()
From: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>
Date: Tue, 01 Dec 2009 09:16:37 +0800
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Mon, 30 Nov 2009 17:18:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4B146AAA.40508@xxxxxxxxxxxxxx>
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: <C739C4F9.30C3%keir.fraser@xxxxxxxxxxxxx> <4B146AAA.40508@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Xiao Guangrong wrote:
> 
> Keir Fraser wrote:
>> On 30/11/2009 17:42, "Ian Jackson" <Ian.Jackson@xxxxxxxxxxxxx> wrote:
>>
>>> I wrote:
>>>> Xiao Guangrong writes ("[Xen-devel] [PATCH] cleanup for __start_xen()"):
>>>>> -        if ( !initial_images_start && (s < e) &&
>>>>> +        if ( !initial_images_start &&
>>>> This is wrong.  s and e are uint64_t so if !(s < e), (e-s) will be
>>>> large and positive.
>>> I see this has already been applied (20523).  It should be reverted, I
>>> think.
>> None of the if() blocks in the loop will make e<s, as that would imply that
>> the block had allocated itself a chunk of memory that starts below s. So it
>> is actually safe to remove the checks, as we know e>=s. But now I look at it
>> I think I broke the module-relocation block some time ago -- it ends up with
>> 'e' being too large by modules_headroom. :-( Will look into that more
>> tomorrow...
>>
> 
> I thinks remove this judgment is very safe, because we have judge it at the 
> begin of this loop:
> 
> for ( i = boot_e820.nr_map-1; i >= 0; i-- )
>     {
>         uint64_t s, e, mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
>       
>       <snip>
> 
>       if ( (boot_e820.map[i].type != E820_RAM) || (s >= e) )  /* NOTICE HERE*/
>             continue;
>       
>       /* it must s < e while run below code, not need check it again ... */
>       ......
> }
> 

And after below if():
 if ( !initial_images_start && (s < e) &&
             ((e-s) >= (modules_length+modules_headroom)) )
        {
            initial_images_end = e;
            e = (e - modules_length) & PAGE_MASK;
            initial_images_start = e;
            e -= modules_headroom;
            initial_images_base = e;
            e += modules_length + modules_headroom;
            for ( j = mbi->mods_count-1; j >= 0; j-- )
            {
                e -= mod[j].mod_end - mod[j].mod_start;
                move_memory(e, mod[j].mod_start, mod[j].mod_end);
                mod[j].mod_end += e - mod[j].mod_start;
                mod[j].mod_start = e;
            }
        }
}

e is moved in [e-(modules_length+modules_headroom), e] range,
so, s is not overrun e too...

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

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