xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wei.liu2@citrix.com
Subject: Re: [PATCH v2 02/18] mini-os: remove unused alloc_contig_pages() function
Date: Wed, 10 Aug 2016 22:02:45 +0200	[thread overview]
Message-ID: <20160810200245.GO16772@var.home> (raw)
In-Reply-To: <1470418562-11234-3-git-send-email-jgross@suse.com>

Juergen Gross, on Fri 05 Aug 2016 19:35:46 +0200, wrote:
> alloc_contig_pages() is never used anywhere in mini-os. Remove it.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/x86/mm.c | 142 ----------------------------------------------------------
>  include/mm.h  |   1 -
>  2 files changed, 143 deletions(-)
> 
> diff --git a/arch/x86/mm.c b/arch/x86/mm.c
> index ae1036e..c59a5d3 100644
> --- a/arch/x86/mm.c
> +++ b/arch/x86/mm.c
> @@ -652,148 +652,6 @@ int unmap_frames(unsigned long va, unsigned long num_frames)
>  }
>  
>  /*
> - * Allocate pages which are contiguous in machine memory.
> - * Returns a VA to where they are mapped or 0 on failure.
> - * 
> - * addr_bits indicates if the region has restrictions on where it is
> - * located. Typical values are 32 (if for example PCI devices can't access
> - * 64bit memory) or 0 for no restrictions.
> - *
> - * Allocated pages can be freed using the page allocators free_pages() 
> - * function.
> - *
> - * based on Linux function xen_create_contiguous_region()
> - */
> -#define MAX_CONTIG_ORDER 9 /* 2MB */
> -unsigned long alloc_contig_pages(int order, unsigned int addr_bits)
> -{
> -    unsigned long in_va, va;
> -    unsigned long in_frames[1UL << order], out_frames, mfn;
> -    multicall_entry_t call[1UL << order];
> -    unsigned int i, num_pages = 1UL << order;
> -    int ret, exch_success;
> -
> -    /* pass in num_pages 'extends' of size 1 and
> -     * request 1 extend of size 'order */
> -    struct xen_memory_exchange exchange = {
> -        .in = {
> -            .nr_extents   = num_pages,
> -            .extent_order = 0,
> -            .domid        = DOMID_SELF
> -        },
> -        .out = {
> -            .nr_extents   = 1,
> -            .extent_order = order,
> -            .address_bits = addr_bits,
> -            .domid        = DOMID_SELF
> -        },
> -        .nr_exchanged = 0
> -    };
> -
> -    if ( order > MAX_CONTIG_ORDER )
> -    {
> -        printk("alloc_contig_pages: order too large 0x%x > 0x%x\n",
> -               order, MAX_CONTIG_ORDER);
> -        return 0;
> -    }
> -
> -    /* Allocate some potentially discontiguous pages */
> -    in_va = alloc_pages(order);
> -    if ( !in_va )
> -    {
> -        printk("alloc_contig_pages: could not get enough pages (order=0x%x\n",
> -               order);
> -        return 0;
> -    }
> -
> -    /* set up arguments for exchange hyper call */
> -    set_xen_guest_handle(exchange.in.extent_start, in_frames);
> -    set_xen_guest_handle(exchange.out.extent_start, &out_frames);
> -
> -    /* unmap current frames, keep a list of MFNs */
> -    for ( i = 0; i < num_pages; i++ )
> -    {
> -        int arg = 0;
> -
> -        va = in_va + (PAGE_SIZE * i);
> -        in_frames[i] = virt_to_mfn(va);
> -
> -        /* update P2M mapping */
> -        phys_to_machine_mapping[virt_to_pfn(va)] = INVALID_P2M_ENTRY;
> -
> -        /* build multi call */
> -        call[i].op = __HYPERVISOR_update_va_mapping;
> -        call[i].args[arg++] = va;
> -        call[i].args[arg++] = 0;
> -#ifdef __i386__
> -        call[i].args[arg++] = 0;
> -#endif  
> -        call[i].args[arg++] = UVMF_INVLPG;
> -    }
> -
> -    ret = HYPERVISOR_multicall(call, i);
> -    if ( ret )
> -    {
> -        printk("Odd, update_va_mapping hypercall failed with rc=%d.\n", ret);
> -        return 0;
> -    }
> -
> -    /* try getting a contig range of MFNs */
> -    out_frames = virt_to_pfn(in_va); /* PFNs to populate */
> -    ret = HYPERVISOR_memory_op(XENMEM_exchange, &exchange);
> -    if ( ret ) {
> -        printk("mem exchanged order=0x%x failed with rc=%d, nr_exchanged=%lu\n",
> -               order, ret, exchange.nr_exchanged);
> -        /* we still need to return the allocated pages above to the pool
> -         * ie. map them back into the 1:1 mapping etc. so we continue but 
> -         * in the end return the pages to the page allocator and return 0. */
> -        exch_success = 0;
> -    }
> -    else
> -        exch_success = 1;
> -
> -    /* map frames into 1:1 and update p2m */
> -    for ( i = 0; i < num_pages; i++ )
> -    {
> -        int arg = 0;
> -        pte_t pte;
> -
> -        va = in_va + (PAGE_SIZE * i);
> -        mfn = i < exchange.nr_exchanged ? (out_frames + i) : in_frames[i];
> -        pte = __pte(mfn << PAGE_SHIFT | L1_PROT);
> -
> -        /* update P2M mapping */
> -        phys_to_machine_mapping[virt_to_pfn(va)] = mfn;
> -
> -        /* build multi call */
> -        call[i].op = __HYPERVISOR_update_va_mapping;
> -        call[i].args[arg++] = va;
> -#ifdef __x86_64__
> -        call[i].args[arg++] = (pgentry_t)pte.pte;
> -#else
> -        call[i].args[arg++] = pte.pte_low;
> -        call[i].args[arg++] = pte.pte_high;
> -#endif  
> -        call[i].args[arg++] = UVMF_INVLPG;
> -    }
> -    ret = HYPERVISOR_multicall(call, i);
> -    if ( ret )
> -    {
> -        printk("update_va_mapping hypercall no. 2 failed with rc=%d.\n", ret);
> -        return 0;
> -    }
> -
> -    if ( !exch_success )
> -    {
> -        /* since the exchanged failed we just free the pages as well */
> -        free_pages((void *) in_va, order);
> -        return 0;
> -    }
> -    
> -    return in_va;
> -}
> -
> -/*
>   * Clear some of the bootstrap memory
>   */
>  static void clear_bootstrap(void)
> diff --git a/include/mm.h b/include/mm.h
> index f57d8ab..a48f485 100644
> --- a/include/mm.h
> +++ b/include/mm.h
> @@ -71,7 +71,6 @@ void do_map_frames(unsigned long addr,
>          const unsigned long *f, unsigned long n, unsigned long stride,
>  	unsigned long increment, domid_t id, int *err, unsigned long prot);
>  int unmap_frames(unsigned long va, unsigned long num_frames);
> -unsigned long alloc_contig_pages(int order, unsigned int addr_bits);
>  #ifdef HAVE_LIBC
>  extern unsigned long heap, brk, heap_mapped, heap_end;
>  #endif
> -- 
> 2.6.6
> 

-- 
Samuel
<c> ya(ka|ma|to)* ca existe une fois sur 2 au japon, c'est facile ;-)
 -+- #ens-mim au japon -+-

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-10 20:02 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 17:35 [PATCH v2 00/18] mini-os: support of auto-ballooning Juergen Gross
2016-08-05 17:35 ` [PATCH v2 01/18] mini-os: correct first free pfn Juergen Gross
2016-08-10 20:02   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 02/18] mini-os: remove unused alloc_contig_pages() function Juergen Gross
2016-08-10 20:02   ` Samuel Thibault [this message]
2016-08-05 17:35 ` [PATCH v2 03/18] mini-os: remove MM_DEBUG code Juergen Gross
2016-08-10 20:03   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 04/18] mini-os: add description of x86 memory usage Juergen Gross
2016-08-10 20:04   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 05/18] mini-os: add nr_free_pages counter Juergen Gross
2016-08-10 20:05   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 06/18] mini-os: let memory allocation fail if no free page available Juergen Gross
2016-08-10 20:06   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 07/18] mini-os: add ballooning config item Juergen Gross
2016-08-10 20:10   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 08/18] mini-os: get maximum memory size from hypervisor Juergen Gross
2016-08-10 20:11   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 09/18] mini-os: modify virtual memory layout for support of ballooning Juergen Gross
2016-08-10 20:16   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 10/18] mini-os: remove unused mem_test() function Juergen Gross
2016-08-10 20:17   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 11/18] mini-os: add checks for out of memory Juergen Gross
2016-08-10 20:18   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 12/18] mini-os: don't allocate new pages for level 1 p2m tree Juergen Gross
2016-08-10 20:24   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 13/18] mini-os: add function to map one frame Juergen Gross
2016-08-10 20:26   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 14/18] mini-os: move p2m related macros to header file Juergen Gross
2016-08-10 20:29   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 15/18] mini-os: remap p2m list in case of ballooning Juergen Gross
2016-08-10 20:35   ` Samuel Thibault
2016-08-10 20:41   ` Samuel Thibault
2016-08-11  4:04     ` Juergen Gross
2016-08-05 17:36 ` [PATCH v2 16/18] mini-os: map page allocator's bitmap to virtual kernel area for ballooning Juergen Gross
2016-08-10 20:45   ` Samuel Thibault
2016-08-11  4:05     ` Juergen Gross
2016-08-05 17:36 ` [PATCH v2 17/18] mini-os: add support for ballooning up Juergen Gross
2016-08-10 21:02   ` Samuel Thibault
2016-08-11  5:50     ` Juergen Gross
2016-08-05 17:36 ` [PATCH v2 18/18] mini-os: balloon up in case of oom Juergen Gross
2016-08-10 21:07   ` Samuel Thibault
2016-08-11  5:51     ` Juergen Gross
2016-08-10 21:07 ` [PATCH v2 00/18] mini-os: support of auto-ballooning Samuel Thibault
2016-08-11  5:52   ` Juergen Gross

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=20160810200245.GO16772@var.home \
    --to=samuel.thibault@ens-lyon.org \
    --cc=jgross@suse.com \
    --cc=minios-devel@lists.xenproject.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).