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

Re: [Xen-devel] [PATCH 1/4] x86: move syscall trampolines off the stack



>>> On 19.05.15 at 18:59, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 18/05/15 13:46, Jan Beulich wrote:
>> +    stub_va = XEN_VIRT_END - (cpu + 1) * PAGE_SIZE;
>> +    if ( map_pages_to_xen(stub_va, page_to_mfn(pg), 1,
>> +                          PAGE_HYPERVISOR_RX | MAP_SMALL_PAGES) )
>> +    {
>> +        if ( !*mfn )
>> +            free_domheap_page(pg);
>> +        stub_va = 0;
>> +    }
>> +    else
>> +    {
>> +        stub_va += (cpu & ~(STUBS_PER_PAGE - 1)) * STUB_BUF_SIZE;
> 
> "(cpu & ~(STUBS_PER_PAGE - 1)) * STUB_BUF_SIZE" comes up very frequently
> through this patch.
> 
> I think the logic would be easier to read given:
> 
> #define STUB_OFFSET(cpu) (((cpu) & ~(STUBS_PER_PAGE - 1)) * STUB_BUF_SIZE)

Except that (a) the ~ was wrong here (figured the hard way)
and (b) the stub_va adjustment was a leftover from when VA
management was still different (found out an even harder way,
and the ~ back then was correct here).

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