Page MenuHomeFreeBSD

Fix to allow building libthr without -D_PTHREADS_INVARIANTS defined
ClosedPublic

Authored by becker.greg_att.net on Jul 6 2023, 9:32 PM.
Referenced Files
Unknown Object (File)
May 31 2024, 5:02 PM
Unknown Object (File)
Apr 29 2024, 6:48 AM
Unknown Object (File)
Mar 18 2024, 4:29 PM
Unknown Object (File)
Mar 15 2024, 1:12 AM
Unknown Object (File)
Mar 12 2024, 4:46 PM
Unknown Object (File)
Mar 12 2024, 4:46 PM
Unknown Object (File)
Mar 12 2024, 4:46 PM
Unknown Object (File)
Mar 12 2024, 4:24 PM

Details

Summary

This patch fixes a bug which prevents building libthr without _PTHREADS_INVARIANTS defined.
The default remains to build libthr with -D_PTHREADS_INVARIANTS. However, with this patch,
if one builds libthr with WITHOUT_PTHREADS_INVARIANTS=true then the latency to acquire+release
a default pthread mutex is reduced by roughly 5%, and a robust mutex by roughly 18% (as measured
by a simple synthetic test on a Xeon E5-2697a based machine).

It's not clear to me if using src.conf to control the libthr build in this way is desirable, so please advise.

Also, this is my first contribution via reviews.freebsd.org, so it's not clear to me if I have correctly filled out this request.

Test Plan

The kyua tests pass which seem sufficient given that this patch by default doesn't change how libthr is built.

kyua test -k /usr/tests/lib/libthr/Kyuafile

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

LGTM but someone else should also take a look

This revision is now accepted and ready to land.Jul 6 2023, 9:38 PM
jhb added a subscriber: jhb.

I would perhaps call the option MK_PTHREADS_ASSERTIONS to match MK_LLVM_ASSERTIONS in terms of naming.

The new text for src.conf.5 also needs to be moved into a new helper file in tools/build/options (src.conf.5 is a generated file). However, whoever commits this can take care of that part.

also the procedure for branching a stable needs to include this, but from my grep i don't see anything in src for malloc_production which has the desired treatment

Thanks John, I've updated the patch as requested, including the tools/build/options change (I wasn't aware of that, pretty cool!)

This revision now requires review to proceed.Jul 6 2023, 10:50 PM

Please handle jhb' suggestions, then you can git am the patch to me.

tools/build/options/WITHOUT_PTHREADS_ASSERTIONS
2

The svn tags are not needed for new files.

I think releng maintains their own checklist of things to do for a new stable branch, I've tagged them here so they can think about toggling this setting (presumably in src.opts.mk) when creating new stable branches.

This revision is now accepted and ready to land.Jul 6 2023, 11:42 PM