Hi Petri,

Could we get a resolution for this patch?

The affinity attribute is a GNU GLIBC only extension not supported on
musl and possibly other embedded libc's.

You have raised a concern about a potential race condition between
creating the thread and setting the affinity. This does not negatively
affect linux-generic platform today but might potentially cause issues
if more per-cpu initializations are added in the future.

Another possibility is to let the thread itself set it's affinity from
odp_init_local. This would take care of the race and be portable. If
everyone agrees to this I can send another patch with this approach.

Regards,
Ruslan

Ruslan Babayev writes:

> Savolainen, Petri (Nokia - FI/Espoo) writes:
>
>>> 
>>> I looked into the call tree of odp_init_local but couldn't find anything
>>> that would be sensitive to thread affinity like register initializations
>>> etc. Were you referring to a platform other than linux-generic.
>>> 
>>> Regards,
>>> Ruslan
>>
>> Yes, this concerns other, more HW accelerated platforms. Also odp-linux 
>> could be optimized further to utilize e.g. per CPU timer/time HW when 
>> available.
>>
>
> Wouldn't it be better to let each platform deal with the potential race
> issue if any and document this? Or perhaps affinity setting can be moved to
> odp_thread_init_local or even before so it's done by the thread itself.
>
> Cause the way it is today, linux-generic as platform is not very
> "generic". It works on Linux with GLIBC
> only. pthread_attr_setaffinity_np API is not supported on musl or uclibc
> which are popular in the embedded space.
>
>
>> - Petri

Reply via email to