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-ppc-devel

Re: [XenPPC] [PATCH] [POWERPC][XEN] Mark heap memory based on boot_of.c'

To: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Subject: Re: [XenPPC] [PATCH] [POWERPC][XEN] Mark heap memory based on boot_of.c's allocator
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Mon, 15 Jan 2007 20:25:00 -0600
Cc: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 15 Jan 2007 18:24:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C95E8EB2-B86A-434B-AEA8-0FC9DEA67B45@xxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <d98b2fbc100cfec5678a.1168555884@localhost> <C95E8EB2-B86A-434B-AEA8-0FC9DEA67B45@xxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Mon, 2007-01-15 at 18:01 -0500, Jimi Xenidis wrote:
> > @@ -530,6 +538,33 @@ static ulong boot_of_alloc(ulong size)
> >
> >          pos = pos + i;
> >      }
> > +}
> > +
> > +int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage)
> If you'd like to hide the bitmap, then perhaps the first arg should
> be a start address and return the address of the next "used" page?

That's an idea. However, I was thinking something more along the lines
of an opaque iterator token.

> > +{
> > +    ulong freebit;
> > +    ulong usedbit;
> > +
> > +    /* find first free page. */
> > +    freebit = find_next_zero_bit(mem_available_pages,
> > MEM_AVAILABLE_PAGES, pos);
> > +    if (freebit >= MEM_AVAILABLE_PAGES) {
> > +        /* We know everything after MEM_AVAILABLE_PAGES is still
> > free. */
> > +        *startpage = MEM_AVAILABLE_PAGES << PAGE_SHIFT;
> > +        *endpage = ~0UL;
> > +        return -1;
> > +    }
> > +    *startpage = freebit << PAGE_SHIFT;
> > +
> > +    /* now find first used page after that. */
> > +    usedbit = find_next_bit(mem_available_pages,
> > MEM_AVAILABLE_PAGES, freebit);
> > +    if (usedbit >= MEM_AVAILABLE_PAGES) {
> > +        /* We know everything after MEM_AVAILABLE_PAGES is still
> > free. */
> > +        *endpage = ~0UL;
> > +        return -1;
> > +    }
> > +    *endpage = usedbit << PAGE_SHIFT;
> 
> I'm not 100% but the code below looks like require that end represent
> a free page so "usedbit - 1"?

It's actually the address of the end of the free memory. For example, if
you have a single page available, let's say at 0x4000, start would be
0x4000 and end would be 0x5000. The length is end - start, or 0x1000.

> > @@ -214,16 +148,22 @@ void memory_init(module_t *mod, int mcou
> >
> >      printk("End of RAM: %luMiB (%luKiB)\n", eomem >> 20, eomem >>
> > 10);
> >
> > -    /* Architecturally the first 4 pages are exception hendlers, we
> > -     * will also be copying down some code there */
> > +    /* Architecturally the first 4 pages are exception handlers. */
> >      heap_start = 4 << PAGE_SHIFT;
> > -    if (oftree < (ulong)_start)
> > -        heap_start = ALIGN_UP(oftree_end, PAGE_SIZE);
> > -
> 
> all the images below are in the bitmap, so can;t you use
> boot_of_mem_avail() to figure this out?

Yes, and that makes me very happy. :) Revised patch follows.

-- 
Hollis Blanchard
IBM Linux Technology Center


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