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)
Oct 5 2024, 6:50 PM
Unknown Object (File)
Sep 16 2024, 9:53 PM
Unknown Object (File)
Sep 6 2024, 5:54 PM
Unknown Object (File)
Sep 6 2024, 5:53 PM
Unknown Object (File)
Sep 6 2024, 5:53 PM
Unknown Object (File)
Sep 6 2024, 5:49 PM
Unknown Object (File)
Sep 6 2024, 2:50 AM
Unknown Object (File)
Aug 11 2024, 1:39 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.