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

Re: [Xen-devel] [PATCH] xen: arm: zero EL2 pagetable pages before use



On 11/03/16 11:29, Jan Beulich wrote:
>>>> On 10.03.16 at 23:00, <shankerd@xxxxxxxxxxxxxx> wrote:
> First of all - please correctly Cc maintainers (there were two recent
> changes for ARM).
>
>> --- a/xen/arch/arm/mm.c
>> +++ b/xen/arch/arm/mm.c
>> @@ -730,6 +730,7 @@ void __init setup_xenheap_mappings(unsigned long 
>> base_mfn,
>>          else
>>          {
>>              unsigned long first_mfn = alloc_boot_pages(1, 1);
>> +            memset(mfn_to_virt(first_mfn), 0, PAGE_SIZE);
> If I was maintainer of this code, I would demand use of clear_page()
> and ask for insertion of the missing blank line here (separating
> declaration and statements).
>
>> @@ -771,6 +772,7 @@ void __init setup_frametable_mappings(paddr_t ps, 
>> paddr_t pe)
>>      nr_second = frametable_size >> SECOND_SHIFT;
>>      second_base = alloc_boot_pages(nr_second, 1);
>>      second = mfn_to_virt(second_base);
>> +    memset(second, 0, nr_second * PAGE_SIZE);
>>      for ( i = 0; i < nr_second; i++ )
>>      {
>>          pte = mfn_to_xen_entry(second_base + i, WRITEALLOC);
> Along those lines here - use clear_page(), presumably by moving it
> into the loop.

This need only initialise the entries which are not filled by the loop,
which will only be the rounding size up to the next 2M or 32M boundary.

Most of the content of 'second' is explicitly initialised, so zeroing it
all first is redundant.

~Andrew

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