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

Re: [Xen-devel] [PATCH RFC 3/5] x86: split PV dom0 builder to domain_build_pv.c



>>> On 03.03.17 at 10:41, <wei.liu2@xxxxxxxxxx> wrote:
> @@ -258,66 +260,7 @@ string_param("dom0_ioports_disable", 
> opt_dom0_ioports_disable);
>  static bool_t __initdata ro_hpet = 1;
>  boolean_param("ro-hpet", ro_hpet);
>  
> -/* Allow ring-3 access in long mode as guest cannot use ring 1 ... */
> -#define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
> -#define L1_PROT (BASE_PROT|_PAGE_GUEST_KERNEL)
> -/* ... except for compatibility mode guests. */
> -#define COMPAT_L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
> -#define L2_PROT (BASE_PROT|_PAGE_DIRTY)
> -#define L3_PROT (BASE_PROT|_PAGE_DIRTY)
> -#define L4_PROT (BASE_PROT|_PAGE_DIRTY)
> -
> -static unsigned int __initdata memflags = MEMF_no_dma|MEMF_exact_node;
> -
> -static struct page_info * __init alloc_chunk(
> -    struct domain *d, unsigned long max_pages)
> -{
> -    static unsigned int __initdata last_order = MAX_ORDER;
> -    struct page_info *page;
> -    unsigned int order = get_order_from_pages(max_pages), free_order;
> -
> -    if ( order > last_order )
> -        order = last_order;
> -    else if ( max_pages & (max_pages - 1) )
> -        --order;
> -    while ( (page = alloc_domheap_pages(d, order, memflags)) == NULL )
> -        if ( order-- == 0 )
> -            break;
> -    if ( page )
> -        last_order = order;
> -    else if ( memflags )
> -    {
> -        /*
> -         * Allocate up to 2MB at a time: It prevents allocating very large
> -         * chunks from DMA pools before the >4GB pool is fully depleted.
> -         */
> -        last_order = 21 - PAGE_SHIFT;
> -        memflags = 0;
> -        return alloc_chunk(d, max_pages);
> -    }
> -
> -    /*
> -     * Make a reasonable attempt at finding a smaller chunk at a higher
> -     * address, to avoid allocating from low memory as much as possible.
> -     */
> -    for ( free_order = order; !memflags && page && order--; )
> -    {
> -        struct page_info *pg2;
> -
> -        if ( d->tot_pages + (1 << order) > d->max_pages )
> -            continue;
> -        pg2 = alloc_domheap_pages(d, order, MEMF_exact_node);
> -        if ( pg2 > page )
> -        {
> -            free_domheap_pages(page, free_order);
> -            page = pg2;
> -            free_order = order;
> -        }
> -        else if ( pg2 )
> -            free_domheap_pages(pg2, order);
> -    }
> -    return page;
> -}
> +unsigned int __initdata memflags = MEMF_no_dma|MEMF_exact_node;

Making a variable with this name non-static requires adding a
suitable prefix, e.g dom0_. setup_permissions() has the same
issue.

Jan


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

 


Rackspace

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