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

Re: [PATCH v8 07/15] x86_64/mm: switch to new APIs in paging_init



On 27.07.2020 16:21, Hongyan Xia wrote:
> From: Wei Liu <wei.liu2@xxxxxxxxxx>
> 
> Map and unmap pages instead of relying on the direct map.
> 
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> Signed-off-by: Hongyan Xia <hongyxia@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> ---
> Changed in v8:
> - replace l3/2_ro_mpt_mfn with just mfn since their lifetimes do not
>   overlap

Good, but ...

> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -481,6 +481,7 @@ void __init paging_init(void)
>      l3_pgentry_t *l3_ro_mpt;
>      l2_pgentry_t *pl2e = NULL, *l2_ro_mpt = NULL;
>      struct page_info *l1_pg;
> +    mfn_t mfn;
>  
>      /*
>       * We setup the L3s for 1:1 mapping if host support memory hotplug
> @@ -493,22 +494,23 @@ void __init paging_init(void)
>          if ( !(l4e_get_flags(idle_pg_table[l4_table_offset(va)]) &
>                _PAGE_PRESENT) )
>          {
> -            l3_pgentry_t *pl3t = alloc_xen_pagetable();
> +            mfn_t l3mfn;

... what about this one? It's again only used ...

> +            l3_pgentry_t *pl3t = alloc_map_clear_xen_pt(&l3mfn);
>  
>              if ( !pl3t )
>                  goto nomem;
> -            clear_page(pl3t);
> +            UNMAP_DOMAIN_PAGE(pl3t);
>              l4e_write(&idle_pg_table[l4_table_offset(va)],
> -                      l4e_from_paddr(__pa(pl3t), __PAGE_HYPERVISOR_RW));
> +                      l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR_RW));
>          }
>      }
>  
>      /* Create user-accessible L2 directory to map the MPT for guests. */
> -    if ( (l3_ro_mpt = alloc_xen_pagetable()) == NULL )
> +    l3_ro_mpt = alloc_map_clear_xen_pt(&mfn);

... without colliding with this first use of mfn.

Jan



 


Rackspace

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