On 04/11/14 14:27, Laszlo Ersek wrote:
> On 04/11/14 14:02, Michael Tokarev wrote:

>> More, the same issue exists on 2.0-tobe as well, but in this case, reverting
>> the same commit from there -- a87f39543a9259f671c5413723311180ee2ad2a8 --
>> does NOT fix the problem.  I'm bisecting between 1.7.0 and 2.0 now.
>>
>> This is just a heads-up for now, dunno how important this use case is.
> 
> Disclaimer: I don't know what I'm talking about.
> 
> This hunk in 819ddf7d:
> 
>> @@ -295,6 +307,11 @@ MemoryRegion *address_space_translate(AddressSpace *as, 
>> hwaddr addr,
>>          as = iotlb.target_as;
>>      }
>>  
>> +    if (memory_access_is_direct(mr, is_write)) {
>> +        hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr;
>> +        len = MIN(page, len);
>> +    }
>> +
>>      *plen = len;
>>      *xlat = addr;
>>      return mr;
> 
> limits "len" at the *first* page boundary that is strictly above "addr".
> Is that the intent? The commit subject says "at *a* page boundary".
> 
> Shouldn't it go like:
> 
>     if (memory_access_is_direct(mr, is_write)) {
>         hwaddr page = (((addr + len) & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) 
> - addr;
>         len = MIN(page, len);
>     }
> 
> This would drop only the trailing portion beyond the last page boundary 
> covered.

Ugh, no it wouldn't. What I suggested was crazy. I should probably just
shut up. Sorry.

Laszlo


Reply via email to