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
F102616227: D40900.diff
Thu, Nov 14, 8:46 PM
Unknown Object (File)
Tue, Nov 12, 4:36 AM
Unknown Object (File)
Sun, Nov 10, 1:38 AM
Unknown Object (File)
Sat, Oct 19, 9:40 AM
Unknown Object (File)
Oct 8 2024, 10:53 PM
Unknown Object (File)
Sep 22 2024, 1:10 AM
Unknown Object (File)
Sep 21 2024, 12:09 PM
Unknown Object (File)
Sep 20 2024, 6:23 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 Skipped
Unit
Tests Skipped

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
1

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