>>> On 19.05.15 at 18:59, <andrew.coop...@citrix.com> 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@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to