[LEDE-DEV] MMAP memory out of sync on AR71xx Rambutan (8devices) board.

Daniel Danzberger daniel at dd-wrt.com
Wed May 9 03:27:30 PDT 2018


On 05/08/2018 10:33 PM, Kevin Darbyshire-Bryant wrote:
> 
> 
>> On 8 May 2018, at 21:11, Rosen Penev <rosenp at gmail.com> wrote:
>>
>>>
>>> So out of curiosity I built this for my Archer C7 v2 ar71xx device.  I also modified the code to not give up on ‘OK’, so it always iterated 10 times.  I then ran this repeatedly using ‘watch’.  Observations:
>>>
>>> 1) Failure only occurred on 1st check, it never appeared/re-appeared on subsequent passes.
>>> 2) Failure offsets are always at 32 byte intervals.  That corresponds nicely with cache-line size.
>> Yeah the L1
>>>
>>> Grabbing at straws to some extent.
> 
> So I modified the user space code a little more, namely moving the usleep to before the check (obviously still after the mmap) - I am yet to see an error.
> 
>  printf("mmap addr: %p\n", addr);
>         data = addr;
> 
>         for (i = 0; i < 10; i++) {
>                 usleep(500000);
>                 check_data(data, page_size);
>         }
> 
> So that smells more of a race condition between the writer filling with 0xFF and the reader catching up.
The open() syscall does the memset(0xff) and blocks. This ensures the memory is
initialized before the open() returns. I don't think there is a race.
> 
> Again, assume that I am an idiot and am missing something fundamental.
> 
> 
> 

-- 
Regards

Daniel Danzberger
embeDD GmbH, Alter Postplatz 2, CH-6370 Stans



More information about the Lede-dev mailing list