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

Re: [Xen-devel] [V1 PATCH 06/11] PVH dom0: construct_dom0 changes



>>> On 09.11.13 at 02:23, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote:
> +/*
> + * Set the 1:1 map for all non-RAM regions for dom 0. Thus, dom0 will have
> + * the entire io region mapped in the EPT/NPT.
> + *
> + * PVH FIXME: The following doesn't map MMIO ranges when they sit above the

All other fixme-s of yours so far used lower case. Please - be
consistent.

> +static __init void pvh_fixup_page_tables_for_hap(struct vcpu *v,
> +                                                 unsigned long v_start,
> +                                                 unsigned long v_end)
> +{
> +    int i, j, k;
> +    l4_pgentry_t *pl4e, *l4start;
> +    l3_pgentry_t *pl3e;
> +    l2_pgentry_t *pl2e;
> +    l1_pgentry_t *pl1e;
> +    unsigned long cr3_pfn;
> +
> +    ASSERT(paging_mode_enabled(v->domain));
> +
> +    l4start = map_domain_page(pagetable_get_pfn(v->arch.guest_table));
> +
> +    /* Give the guest a clean slate to start with */
> +    pl4e = l4start + l4_table_offset(v_start);
> +    memset(l4start, 0, (unsigned long)pl4e - (unsigned long)l4start);
> +
> +    pl4e = l4start + l4_table_offset(v_end) + 1;
> +    if ( (unsigned long)pl4e & (PAGE_SIZE - 1) )
> +        memset(pl4e, 0, PAGE_SIZE - ((unsigned long)pl4e & (PAGE_SIZE - 1)));

These look more complicated than necessary (largely due to the
casts), but be it that way.

> +    pl4e = l4start + l4_table_offset(v_start);
>...
> +    *pl4e = l4e_from_pfn(get_gpfn_from_mfn(l4e_get_pfn(*pl4e)),
> +                         l4e_get_flags(*pl4e));

But this one I told before needs to be in a loop. You must not make
assumptions on guest virtual address space layout, and hence you
must not assume none of the initial mapping crosses an L4 boundary.

And once these are in a loop, getting the earlier two loops simplified
(using l4e_empty() rather than plain memset()) and ordered properly
(the head part before the main loop, the tail part after) will be almost
obvious legibility cleanups.

Jan


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


 


Rackspace

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