Page MenuHomeFreeBSD

Various fixes to TLS for MIPS.
ClosedPublic

Authored by jhb on May 22 2020, 4:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 7:15 AM
Unknown Object (File)
Dec 14 2023, 10:39 PM
Unknown Object (File)
Nov 28 2023, 2:19 PM
Unknown Object (File)
Nov 26 2023, 2:53 PM
Unknown Object (File)
Nov 22 2023, 1:34 PM
Unknown Object (File)
Nov 22 2023, 12:13 PM
Unknown Object (File)
Nov 22 2023, 11:21 AM
Unknown Object (File)
Nov 15 2023, 9:03 AM

Details

Summary
  • Clear the current thread's TLS pointer on exec. Previously the TLS pointer (and register) remain unchanged.
  • Explicitly clear the TLS pointer when new threads are created.
  • Make md_tls_tcb_offset per-process instead of per-thread.

    The layout of the TLS and TCB are identical for all threads in a process, it is only the TLS pointer values themselves that vary by thread. This also makes setting md_tls_tcb_offset in cpu_set_user_tls() redundant with the setting in exec_setregs(), so only set it in exec_setregs().
Test Plan
  • booted mips64 in qemu. ntpd is multi-threaded so was a good test of this (it crashed for some earlier verions when I had a bug)

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31236
Build 28885: arc lint + arc unit

Event Timeline

jhb requested review of this revision.May 22 2020, 4:09 PM
jhb created this revision.

Note though that qemu doesn't advertise UserLocal support, so my testing didn't verify the changes in cpu_switch() in particular.

it /looks/ ok to me; but I can test it on mips32 platforms if you'd like.

Do we have any useful TLS tests that I can run, or should I go write something real quick?

jemalloc uses TLS and ntpd is threaded, so if you boot to multiuser and have ntpd enabled you probably pass. (booting in QEMU with mips64 with ntpd active broke when I had a bug in the threaded case)

This revision was not accepted when it landed; it landed in state Needs Review.Jun 12 2020, 9:21 PM
Closed by commit rS362122: Various fixes to TLS for MIPS. (authored by jhb). · Explain Why
This revision was automatically updated to reflect the committed changes.