Re: [RFC PATCH for 5.8 1/4] sched: Fix unreliable rseq cpu_id for new tasks

From: Mathieu Desnoyers
Date: Tue Jul 07 2020 - 06:51:47 EST


----- On Jul 7, 2020, at 3:30 AM, Florian Weimer fw@xxxxxxxxxxxxx wrote:

> * Mathieu Desnoyers:
>
>> While integrating rseq into glibc and replacing glibc's sched_getcpu
>> implementation with rseq, glibc's tests discovered an issue with
>> incorrect __rseq_abi.cpu_id field value right after the first time
>> a newly created process issues sched_setaffinity.
>>
>> For the records, it triggers after building glibc and running tests, and
>> then issuing:
>>
>> for x in {1..2000} ; do posix/tst-affinity-static & done
>>
>> and shows up as:
>>
>> error: Unexpected CPU 2, expected 0
>> error: Unexpected CPU 2, expected 0
>> error: Unexpected CPU 2, expected 0
>> error: Unexpected CPU 2, expected 0
>> error: Unexpected CPU 138, expected 0
>> error: Unexpected CPU 138, expected 0
>> error: Unexpected CPU 138, expected 0
>> error: Unexpected CPU 138, expected 0
>
> As far as I can tell, the glibc reproducer no longer shows the issue
> with this patch applied.
>
> Tested-By: Florian Weimer <fweimer@xxxxxxxxxx>

Thanks a lot Florian for your thorough review and testing !

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com