mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] xen: use generic functions instead of xen_{alloc,free}_vm_area()
Date: Thu, 20 Oct 2011 19:45:32 -0400	[thread overview]
Message-ID: <20111020234532.GG19558@phenom.dumpdata.com> (raw)
In-Reply-To: <1319107519-2253-2-git-send-email-david.vrabel@citrix.com>

On Thu, Oct 20, 2011 at 11:45:16AM +0100, David Vrabel wrote:
> Replace calls to the Xen-specific xen_alloc_vm_area() and
> xen_free_vm_area() functions with the generic equivalent
> (alloc_vm_area() and free_vm_area()).
> 
> On x86, these were identical already.
> 
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  arch/ia64/include/asm/xen/grant_table.h |   29 --------------
>  arch/ia64/xen/grant-table.c             |   62 -------------------------------
>  arch/x86/include/asm/xen/grant_table.h  |    7 ---
>  arch/x86/xen/grant-table.c              |    2 +-
>  drivers/xen/xenbus/xenbus_client.c      |    6 +-
>  include/xen/grant_table.h               |    1 -
>  6 files changed, 4 insertions(+), 103 deletions(-)
>  delete mode 100644 arch/ia64/include/asm/xen/grant_table.h
>  delete mode 100644 arch/x86/include/asm/xen/grant_table.h
> 
> diff --git a/arch/ia64/include/asm/xen/grant_table.h b/arch/ia64/include/asm/xen/grant_table.h
> deleted file mode 100644
> index 2b1fae0..0000000
> --- a/arch/ia64/include/asm/xen/grant_table.h
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/******************************************************************************
> - * arch/ia64/include/asm/xen/grant_table.h
> - *
> - * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
> - *                    VA Linux Systems Japan K.K.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> - *
> - */
> -
> -#ifndef _ASM_IA64_XEN_GRANT_TABLE_H
> -#define _ASM_IA64_XEN_GRANT_TABLE_H
> -
> -struct vm_struct *xen_alloc_vm_area(unsigned long size);
> -void xen_free_vm_area(struct vm_struct *area);
> -
> -#endif /* _ASM_IA64_XEN_GRANT_TABLE_H */
> diff --git a/arch/ia64/xen/grant-table.c b/arch/ia64/xen/grant-table.c
> index 48cca37..c182813 100644
> --- a/arch/ia64/xen/grant-table.c
> +++ b/arch/ia64/xen/grant-table.c
> @@ -31,68 +31,6 @@
>  
>  #include <asm/xen/hypervisor.h>
>  
> -struct vm_struct *xen_alloc_vm_area(unsigned long size)
> -{
> -	int order;
> -	unsigned long virt;
> -	unsigned long nr_pages;
> -	struct vm_struct *area;
> -
> -	order = get_order(size);
> -	virt = __get_free_pages(GFP_KERNEL, order);
> -	if (virt == 0)
> -		goto err0;
> -	nr_pages = 1 << order;
> -	scrub_pages(virt, nr_pages);
> -
> -	area = kmalloc(sizeof(*area), GFP_KERNEL);
> -	if (area == NULL)
> -		goto err1;
> -
> -	area->flags = VM_IOREMAP;
> -	area->addr = (void *)virt;
> -	area->size = size;
> -	area->pages = NULL;
> -	area->nr_pages = nr_pages;
> -	area->phys_addr = 0;	/* xenbus_map_ring_valloc uses this field!  */
> -
> -	return area;
> -
> -err1:
> -	free_pages(virt, order);
> -err0:
> -	return NULL;
> -}
> -EXPORT_SYMBOL_GPL(xen_alloc_vm_area);
> -
> -void xen_free_vm_area(struct vm_struct *area)
> -{
> -	unsigned int order = get_order(area->size);
> -	unsigned long i;
> -	unsigned long phys_addr = __pa(area->addr);
> -
> -	/* This area is used for foreign page mappping.
> -	 * So underlying machine page may not be assigned. */
> -	for (i = 0; i < (1 << order); i++) {
> -		unsigned long ret;
> -		unsigned long gpfn = (phys_addr >> PAGE_SHIFT) + i;
> -		struct xen_memory_reservation reservation = {
> -			.nr_extents   = 1,
> -			.address_bits = 0,
> -			.extent_order = 0,
> -			.domid        = DOMID_SELF
> -		};
> -		set_xen_guest_handle(reservation.extent_start, &gpfn);
> -		ret = HYPERVISOR_memory_op(XENMEM_populate_physmap,
> -					   &reservation);
> -		BUG_ON(ret != 1);
> -	}
> -	free_pages((unsigned long)area->addr, order);
> -	kfree(area);
> -}
> -EXPORT_SYMBOL_GPL(xen_free_vm_area);
> -
> -
>  /****************************************************************************
>   * grant table hack
>   * cmd: GNTTABOP_xxx
> diff --git a/arch/x86/include/asm/xen/grant_table.h b/arch/x86/include/asm/xen/grant_table.h
> deleted file mode 100644
> index fdbbb45..0000000
> --- a/arch/x86/include/asm/xen/grant_table.h
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#ifndef _ASM_X86_XEN_GRANT_TABLE_H
> -#define _ASM_X86_XEN_GRANT_TABLE_H
> -
> -#define xen_alloc_vm_area(size)	alloc_vm_area(size)
> -#define xen_free_vm_area(area)	free_vm_area(area)
> -
> -#endif /* _ASM_X86_XEN_GRANT_TABLE_H */
> diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c
> index 49ba9b5..6bbfd7a 100644
> --- a/arch/x86/xen/grant-table.c
> +++ b/arch/x86/xen/grant-table.c
> @@ -71,7 +71,7 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
>  
>  	if (shared == NULL) {
>  		struct vm_struct *area =
> -			xen_alloc_vm_area(PAGE_SIZE * max_nr_gframes);
> +			alloc_vm_area(PAGE_SIZE * max_nr_gframes);
>  		BUG_ON(area == NULL);
>  		shared = area->addr;
>  		*__shared = shared;
> diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
> index cdacf92..229d3ad 100644
> --- a/drivers/xen/xenbus/xenbus_client.c
> +++ b/drivers/xen/xenbus/xenbus_client.c
> @@ -443,7 +443,7 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
>  
>  	*vaddr = NULL;
>  
> -	area = xen_alloc_vm_area(PAGE_SIZE);
> +	area = alloc_vm_area(PAGE_SIZE);
>  	if (!area)
>  		return -ENOMEM;
>  
> @@ -453,7 +453,7 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, int gnt_ref, void **vaddr)
>  		BUG();
>  
>  	if (op.status != GNTST_okay) {
> -		xen_free_vm_area(area);
> +		free_vm_area(area);
>  		xenbus_dev_fatal(dev, op.status,
>  				 "mapping in shared page %d from domain %d",
>  				 gnt_ref, dev->otherend_id);
> @@ -552,7 +552,7 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
>  		BUG();
>  
>  	if (op.status == GNTST_okay)
> -		xen_free_vm_area(area);
> +		free_vm_area(area);
>  	else
>  		xenbus_dev_error(dev, op.status,
>  				 "unmapping page at handle %d error %d",
> diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
> index b1fab6b..8a8bb76 100644
> --- a/include/xen/grant_table.h
> +++ b/include/xen/grant_table.h
> @@ -43,7 +43,6 @@
>  #include <xen/interface/grant_table.h>
>  
>  #include <asm/xen/hypervisor.h>
> -#include <asm/xen/grant_table.h>
>  
>  #include <xen/features.h>
>  
> -- 
> 1.7.2.5

  reply	other threads:[~2011-10-24 13:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 10:45 [PATCH 0/4] xen: map foreign pages for shared rings by updating the PTEs directly David Vrabel
2011-10-20 10:45 ` [PATCH 1/4] xen: use generic functions instead of xen_{alloc,free}_vm_area() David Vrabel
2011-10-20 23:45   ` Konrad Rzeszutek Wilk [this message]
2011-10-20 10:45 ` [PATCH 2/4] block: xen-blkback: use API provided by xenbus module to map rings David Vrabel
2011-10-26 13:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-10-26 13:55     ` Jens Axboe
2011-10-20 10:45 ` [PATCH 3/4] net: xen-netback: " David Vrabel
2011-10-20 21:00   ` Konrad Rzeszutek Wilk
2011-10-20 10:45 ` [PATCH 4/4] xen: map foreign pages for shared rings by updating the PTEs directly David Vrabel
2011-10-20 23:44 ` [PATCH 0/4] " Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111020234532.GG19558@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome