On Tue, Oct 12, 2021 at 09:23:21AM +0100, Szabolcs Nagy wrote:
The 10/11/2021 21:10, Mark Brown wrote:
OK, that makes sense. I've changed the code and the kselftest so that TPIDR2 is preserved on thread creation.
does thread creation have to work the same way as fork?
(in a pthread_create child we want tpidr2 to be 0, since it represents thread specific data. in a fork child we want to preserve tpidr2 to mirror the state of the parent as much as possible)
...
i'm not sure when to do tpidr2=0 exactly, but something like CLONE_SETTLS is set or child runs on a new stack would work for me. if that's too ugly then preserving tpidr2 in the child is fine.
Resetting it on CLONE_SETTLS is straightforward to implement so if that works for you it sounds good to me, I've got it implemented locally already with a test case.