[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Crash on boot with 2.6.37-rc8-git3



On Tue, 25 Jan 2011, Ian Campbell wrote:
> > It turns out that it is me having the same issue you have and not the
> > other way around :)
> > 
> > Your patch (in addition to my previous patch) makes my testbox boot, no
> > matter what dom0_mem parameter I choose.
> > 
> > Appended is a version of the patch that doesn't assume that the memory
> > region starts on a page boundary.
> > 
> > ---
> > 
> > diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> > index b5a7f92..a3d28a1 100644
> > --- a/arch/x86/xen/setup.c
> > +++ b/arch/x86/xen/setup.c
> > @@ -179,7 +179,10 @@ char * __init xen_memory_setup(void)
> >     e820.nr_map = 0;
> >     xen_extra_mem_start = mem_end;
> >     for (i = 0; i < memmap.nr_entries; i++) {
> > -           unsigned long long end = map[i].addr + map[i].size;
> > +           unsigned long long end;
> > +           if (map[i].type == E820_RAM)
> > +                   map[i].size -= (map[i].size + map[i].addr) % PAGE_SIZE;
> 
> The more normal idiom to round down to a page boundary in the kernel is:
>       map[i].size &= ~(PAGE_SIZE-1);
> 
> Do you also need to page align map[i].addr upwards for maximum safety?
> 

unless I am very confused

map[i].size -= (map[i].size + map[i].addr) % PAGE_SIZE

is not the same as:

as map[i].size &= ~(PAGE_SIZE-1): 

because it also takes into account the possibility that map[i].addr is
not page aligned. It doesn't move map[i].addr upward but still makes sure that
the region ends at a page boundary anyway.

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.