[PATCH v1.1] tests: Verify inheritance of cpu affinity

Siddhesh Poyarekar siddhesh@gotplt.org
Fri Jan 10 13:27:49 GMT 2025


On 2025-01-10 08:01, Stefan Liebler wrote:
> On 09.01.25 15:17, Adhemerval Zanella Netto wrote:
>>
>>
>> On 09/01/25 00:15, Siddhesh Poyarekar wrote:
>>> On 2025-01-07 17:54, Adhemerval Zanella Netto wrote:
>>>>
>>>>
>>>> On 07/01/25 19:01, Siddhesh Poyarekar wrote:
>>>>> On 2025-01-07 15:51, Adhemerval Zanella Netto wrote:
>>>>>>> +  /* Less CPUS for the first level, if that's possible.  */
>>>>>>> +  if (entry && cpus > 1)
>>>>>>> +    cpus--;
>>>>>>
>>>>>> I think this will always fail on CPUs with one core (there are still
>>>>>> some for non-usual architectures).
>>>>>>
>>>>>
>>>>> For single CPU systems this should end up having the same mask for the first and second level tests, which shouldn't actually cause a failure. I admittedly haven't tested this though; I'll try and get a box to confirm.
>>>>
>>>> I meant that with only cpu, cnpus will be zero and the test
>>>>
>>>>     if (CPU_COUNT_S (param->size, param->set) == 0)
>>>>       FAIL_EXIT1 ("Failed to add any CPUs to the affinity set\n");
>>>>
>>>> will fail because no cpu will be added.
>>>>
>>>
>>> OK I just tested this on a single core box and it worked correctly. nproc returns 1 for a single cpu, which results in the single CPU0 being set in both the cpusets in the test:
>>>
>>> $ nproc
>>> 1
>>> $ cat misc/tst-sched-affinity-inheritance.test-result
>>> PASS: misc/tst-sched-affinity-inheritance
>>> original exit status 0
>>> $ cat misc/tst-sched-affinity-inheritance.out
>>> 86756:86756 Start test run
>>> 86756:86756 do_one_test: fork
>>> 86757:86757    do_one_test: fork
>>> 86758:86758        child
>>> 86757:86757    do_one_test: thread
>>> 86757:86759        child
>>> 86756:86756 do_one_test: thread
>>> 86756:86760    do_one_test: fork
>>> 86761:86761        child
>>> 86756:86760    do_one_test: thread
>>> 86756:86762        child
>>> $ cat nptl/tst-pthread-affinity-inheritance.test-result
>>> PASS: nptl/tst-pthread-affinity-inheritance
>>> original exit status 0
>>> $ cat nptl/tst-pthread-affinity-inheritance.out
>>> 142993:142993 Start test run
>>> 142993:142993 do_one_test: fork
>>> 142994:142994    do_one_test: fork
>>> 142995:142995        child
>>> 142994:142994    do_one_test: thread
>>> 142994:142996        child
>>> 142993:142993 do_one_test: thread
>>> 142993:142997    do_one_test: fork
>>> 142998:142998        child
>>> 142993:142997    do_one_test: thread
>>> 142993:142999        child
>>
>> Fair enough, I now notice the decrement is done only positive.  LGTM then.
> 
> 
> Hi,
> I observe testfails on s390x/s390 with both of the new tests:
> FAIL: misc/tst-sched-affinity-inheritance
> FAIL: nptl/tst-pthread-affinity-inheritance
> (See attached files for more full output)
> 
> To be honest, so far I have not looked into details, but I wanted to
> report to see if others also observe errors.
> 
> As information, my system reports this
> $ nproc
> 16
> $ nproc --all
> 200

Oops, thanks for letting me know, I'll take a look.

Sid


More information about the Libc-alpha mailing list