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

Re: [Xen-devel] [PATCH] x86/mm: Consolidate all Xen L4 slot writing into init_xen_l4_slots()



On 03/09/17 13:01, Tim Deegan wrote:
> At 18:07 +0100 on 01 Sep (1504289261), Andrew Cooper wrote:
>>      if ( unlikely(root_pgt_pv_xen_slots < ROOT_PAGETABLE_PV_XEN_SLOTS) )
>>      {
>> -        l4_pgentry_t *next = &l4tab[ROOT_PAGETABLE_FIRST_XEN_SLOT +
>> -                                    root_pgt_pv_xen_slots];
>> +        /*
>> +         * If using highmem-start=, artificially shorten the directmap to
>> +         * simulate very large machines.
>> +         */
>> +        l4_pgentry_t *next;
>> +
>> +        memcpy(&l4t[l4_table_offset(XEN_VIRT_START)],
>> +               &idle_pg_table[l4_table_offset(XEN_VIRT_START)],
>> +               (ROOT_PAGETABLE_FIRST_XEN_SLOT + root_pgt_pv_xen_slots -
>> +                l4_table_offset(XEN_VIRT_START)) * sizeof(*l4t));
>> +
>> +        next = &l4t[ROOT_PAGETABLE_FIRST_XEN_SLOT + root_pgt_pv_xen_slots];
>>  
>>          if ( l4e_get_intpte(split_l4e) )
>>              *next++ = split_l4e;
>>  
>>          memset(next, 0,
>> -               _p(&l4tab[ROOT_PAGETABLE_LAST_XEN_SLOT + 1]) - _p(next));
>> +               _p(&l4t[ROOT_PAGETABLE_LAST_XEN_SLOT + 1]) - _p(next));
>>      }
>> -#else
>> -    BUILD_BUG_ON(root_pgt_pv_xen_slots != ROOT_PAGETABLE_PV_XEN_SLOTS);
>> +    else
>>  #endif
>> -    l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] =
>> -        l4e_from_pfn(domain_page_map_to_mfn(l4tab), __PAGE_HYPERVISOR_RW);
>> -    l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =
>> -        l4e_from_page(d->arch.perdomain_l3_pg, __PAGE_HYPERVISOR_RW);
>> -    if ( zap_ro_mpt || is_pv_32bit_domain(d) )
>> -        l4tab[l4_table_offset(RO_MPT_VIRT_START)] = l4e_empty();
>> +    {
>> +        /*
>> +         * For PV guests, provide the shortened directmap, up to 
>> PV_XEN_SLOTS.
>> +         * For HVM guests and the idle vcpus, provide the extended 
>> directmap.
>> +         */
>> +        unsigned int slots = ((d && !paging_mode_external(d))
>> +                              ? ROOT_PAGETABLE_PV_XEN_SLOTS
>> +                              : ROOT_PAGETABLE_XEN_SLOTS);
>> +
>> +        memcpy(&l4t[l4_table_offset(XEN_VIRT_START)],
>> +               &idle_pg_table[l4_table_offset(XEN_VIRT_START)],
>> +               (ROOT_PAGETABLE_FIRST_XEN_SLOT + slots -
>> +                l4_table_offset(XEN_VIRT_START)) * sizeof(*l4t));
> Does this branch need a memset(0) for the PV case, to zap the higher
> directmap slots?  

init_xen_l4_slots() is called after all the guest entries have been
validated.  Zapping them here will get us into some reference counting
fun. :)

>
> The shadow changes all look fine, so:
> Acked-by: Tim Deegan <tim@xxxxxxx>

Thanks,

~Andrew

_______________________________________________
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®.