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: [Xen-ia64-devel] [PATCH 2/2] remove xencomm page size limit(linux si

To: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] [PATCH 2/2] remove xencomm page size limit(linux side)
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Tue, 31 Jul 2007 14:30:43 -0600
Cc: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 31 Jul 2007 13:29:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070731061234.GC6039%yamahata@xxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: HP OSLO R&D
References: <20070731061019.GB6039%yamahata@xxxxxxxxxxxxx> <20070731061234.GC6039%yamahata@xxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Isaku,

   The 32bit restriction on this one is unfortunate, especially if we
want to also apply this to the common xencomm code.  IIRC, ppc supports
32bit guests.  Maybe we need to keep a page allocation interface for
32bit and a smaller granularity allocation for 64bit?  I think a ~100GB
limit would be more than acceptable for a 32bit guest.  Thanks,

        Alex

On Tue, 2007-07-31 at 15:12 +0900, Isaku Yamahata wrote:
> # HG changeset patch
> # User yamahata@xxxxxxxxxxxxx
> # Date 1185763112 -32400
> # Node ID 9536c4366949dcd4a163d2129e18e319bf6d1ac2
> # Parent  b0bf9ba32bfe341af07da97d57572659c920fd30
> remove xencomm page size limit.
> Currently xencomm has page size limit so that a domain with many memory
> (e.g. 100GB~) can't be created.
> 
> Now that xencomm of xen side accepts struct xencomm_desc whose address array
> crosses page boundary. Thus it isn't necessary to allocate single page
> not to cross page boundary. We can allocate exact sized memory.
> Note that struct xencomm_desc can't cross page boundary.
> For that sake, this implementation depends on the slab allocator
> implementation and sizeof(struct xencomm_desc) = 8 = sizeof (void*).
> This is true on ia64, but may not be true on 32bit environment.
> PATCHNAME: remove_xencomm_page_size_limit
> 
> Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
> 
> diff -r b0bf9ba32bfe -r 9536c4366949 arch/ia64/xen/xencomm.c
> --- a/arch/ia64/xen/xencomm.c Fri Jul 27 08:15:50 2007 -0600
> +++ b/arch/ia64/xen/xencomm.c Mon Jul 30 11:38:32 2007 +0900
> @@ -158,16 +158,25 @@ xencomm_init_desc(struct xencomm_desc *d
>  }
>  
>  static struct xencomm_desc *
> -xencomm_alloc(gfp_t gfp_mask)
> -{
> -     struct xencomm_desc *desc;
> -
> -     desc = (struct xencomm_desc *)__get_free_page(gfp_mask);
> +xencomm_alloc(gfp_t gfp_mask, void *buffer, unsigned long bytes)
> +{
> +     struct xencomm_desc *desc;
> +     unsigned long buffer_ulong = (unsigned long)buffer;
> +     unsigned long start = buffer_ulong & PAGE_MASK;
> +     unsigned long end = (buffer_ulong + bytes) | ~PAGE_MASK;
> +     unsigned long nr_addrs = (end - start + 1) >> PAGE_SHIFT;
> +     unsigned long size = sizeof(*desc) +
> +             sizeof(desc->address[0]) * nr_addrs;
> +
> +     /*
> +      * NOTE: kmalloc returns at least 64bit aligned value so that
> +      *       struct xencomm_desc doesn't cross page boundary.
> +      */
> +     BUILD_BUG_ON(sizeof(*desc) > sizeof(void*));
> +     desc = kmalloc(size, gfp_mask);
>       if (desc == NULL)
>               panic("%s: page allocation failed\n", __func__);
> -
> -     desc->nr_addrs = (PAGE_SIZE - sizeof(struct xencomm_desc)) /
> -                      sizeof(*desc->address);
> +     desc->nr_addrs = nr_addrs;
>  
>       return desc;
>  }
> @@ -176,7 +185,7 @@ xencomm_free(struct xencomm_handle *desc
>  xencomm_free(struct xencomm_handle *desc)
>  {
>       if (desc)
> -             free_page((unsigned long)__va(desc));
> +             kfree(__va(desc));
>  }
>  
>  int
> @@ -195,7 +204,7 @@ xencomm_create(void *buffer, unsigned lo
>               return 0;
>       }
>  
> -     desc = xencomm_alloc(gfp_mask);
> +     desc = xencomm_alloc(gfp_mask, buffer, bytes);
>       if (!desc) {
>               printk("%s failure\n", "xencomm_alloc");
>               return -ENOMEM;
> 
> 
> _______________________________________________
> Xen-ia64-devel mailing list
> Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-ia64-devel
-- 
Alex Williamson                             HP Open Source & Linux Org.


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

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