44 Commits

Author SHA1 Message Date
John Sully
891977d9b7 Fix race in futex_sleep
Former-commit-id: 73300c57005a49bafbfc44db9c40ba7d1d4eedce
2020-05-31 16:03:50 -04:00
John Sully
d344d9b0b9 Auto tune lock for high CPU tension scenarios
Former-commit-id: 8edbae2e04538f82a146a6c2b459a6dfcacf99b2
2020-05-30 18:22:27 -04:00
John Sully
4bb5c35548 Fix issue #170. Intermittent crash destroying fastlock due to implicit type conversion in assert
Former-commit-id: ecbe168b5421687899a621c995e44f43faec2b71
2020-05-25 02:13:57 -04:00
John Sully
5c35593937 Quiet TSAN during exit
Former-commit-id: fd710d590a6297b74e06ce6832dd75bfca0a266f
2020-05-24 12:45:10 -04:00
John Sully
ad3de92c57 use serverAssert() instead of assert() to get callstacks in fastlock
Former-commit-id: 45535e8a6377963dce5b158a9a6e448c5c22a0a8
2020-04-28 22:41:07 -04:00
John Sully
9bc3029a02 Fix some clang warnings
Former-commit-id: 3785b1efd49002e629c1d821c57e971f8f09a2d2
2020-04-16 20:12:05 -04:00
John Sully
34d768f5ad Deprecate travis and finish setting up github CI
Former-commit-id: 90094a2dcaa004437c43818b411d44e722da420a
2020-04-15 23:04:04 -04:00
John Sully
c64f9d5d30 ASAN races in leak checker
Former-commit-id: 9dfa074cd6d5ed9a87036e582861dfc386b56d5e
2020-04-15 22:24:12 -04:00
John Sully
4f55afa948 Print stack traces of other threads in the deadlock detector
Former-commit-id: 6b0172b9bf124372f4c8688c91c380c6c1b607c7
2020-03-19 15:37:49 -04:00
John Sully
1d804ef499 Fix compile failure on raspberry pi machines, issue #141
Former-commit-id: aaca32a5cd1bdb0314b4a57847938854b8a4fef2
2020-02-28 23:49:17 -05:00
John Sully
67d78e7808 Fix issue #146
Former-commit-id: e5a2d594464a965f36e4cbf924f02929265186e6
2020-02-28 21:21:05 -05:00
John Sully
1d368edc10 Add double unlock detection and improve fastlock_unlock assmebly
Former-commit-id: 98aefac09b6b59371e6c1c77d1ef2794bfc5ae62
2020-02-17 19:54:05 -05:00
John Sully
ad0cb8da40 Fix issue #130 due to fastlock timeout reduction
Former-commit-id: dbef17c2e16f115733242721e9b5a43f01e7a554
2020-01-01 11:52:00 -05:00
John Sully
e16deddd05 Fix deadlock in spinlock (mfence) also spin for less time before sleeping
Former-commit-id: 8a9045c028128ad1ceaaa7a482ae4d241592d164
2019-11-30 00:51:58 -05:00
John Sully
b8cf7ef35c Fastlock should yield in ARM
Former-commit-id: 6c65a11b8d841517f372ea9962b8dbc127390943
2019-11-28 14:26:43 -05:00
John Sully
d46d4cd9ef Fix failure to wakeup from futex sleep due to fastlock_unlock reading the wrong offset in the asm version. Also fix false sharing in spinlock
Former-commit-id: 4c8603815cf525c75dcc360fddeab9ca6fe70ae6
2019-11-17 16:06:49 -05:00
John Sully
391b2f311e Fix build break in TravisCI
Former-commit-id: 2da09e07321e114faa04f84ef7a50908ecac5eea
2019-10-23 13:31:39 -04:00
John Sully
60c35d6ea7 Remove race conditions
Former-commit-id: 5a8cb77d0df7f319809ff965a72fe46925f49289
2019-10-22 23:26:37 -04:00
John Sully
b1190c24a8 Optimize deadlock detection, fix callstack for ASM, and annotate locks
Note: This change moves our assembly code to use the GNU Assembler because NASM seems to be incapable of emitting the necessary debug information for callstack unwinding to work.

Former-commit-id: 600fc241cfe79b9b32ac6010c6ea0c66747f0f15
2019-10-22 21:34:51 -04:00
John Sully
8aea7f8586 Implement deadlock detection
Former-commit-id: fa797408d9c5d5f12053641144fe1a8b24f66185
2019-10-22 00:43:32 -04:00
John Sully
5cb7ec841a Add support for sanitizers and fix issues they have found
Former-commit-id: 58971a430dd3e4e8c39c7b5288211bc2ba7699ed
2019-07-18 18:39:42 -04:00
John Sully
8cd37fae2c Fix deadlock with client and ae locks
Former-commit-id: 8630339e43c1de1cd723bdfdca8ab5924e2cb8b0
2019-07-12 20:46:50 -04:00
John Sully
9983a59895 Fix additional warnings
Former-commit-id: 1531cfb7eea1824fb40da596b3446baa4312355c
2019-06-27 16:29:36 -04:00
John Sully
f5f4815041 Fix mac build breaks
Former-commit-id: 16a89f21dc0beb23b7eb8f2e378d076da918c0d6
2019-06-27 15:04:09 -04:00
John Sully
d65ce6fbbc Fix issues with relaxed memory model architectures
Former-commit-id: e37bc4ad40e852b67ee14e5aa87fd2f398f00eed
2019-06-17 23:00:12 -04:00
John Sully
049ca9bf58 Even the next up thread should sleep in the futex
Former-commit-id: 8b76b01bfe710603bcdc101da6eb27afcee7e1b1
2019-06-17 23:00:12 -04:00
John Sully
dd7cbbe730 Fallback to a futex if we spin for a long time
Former-commit-id: ec57b4b0248bba671e388a2257b1bd65ed8d0f44
2019-06-17 23:00:12 -04:00
John Sully
ff470686df OS X build fixes
Former-commit-id: 1dff223c713cba0b336f34328d223ddd675a3781
2019-03-24 18:06:57 -04:00
John Sully
4c82a94f3a comment issue
Former-commit-id: 19956b3807aa6895b438162f39d17db17ef726f4
2019-03-21 22:18:48 +00:00
John Sully
c1f7c0bcd5 Polarity of the weak flag was wrong. We want to use the strong variant of atomic_compare_exchange always
Former-commit-id: ab9122f2cb910bb5560a9fde16bc3c096ecfb510
2019-03-21 22:17:04 +00:00
John Sully
fbe1a6c52a Add debugging stats to the INFO command
Former-commit-id: ac80a5c6a6676f45ac7d460a9cfb02fef8b48d78
2019-03-19 22:04:33 -04:00
John Sully
8f452efca3 write fastlock_unlock in ASM... because its faster
Former-commit-id: bad73faf28f879d32c4064389b69c83e9474115a
2019-03-02 16:47:27 -05:00
John Sully
f446785084 Rewrite our spinlock in assembly, pretty big performance improvement
Former-commit-id: 40d7a701feefd36e9e3fdb6d516228c4a70fcf3d
2019-02-25 18:21:27 -05:00
John Sully
dbd82f6bfc Lock use after free 2019-02-22 21:00:14 -05:00
John Sully
6c6d913a86 Remove unnecessary mfences 2019-02-22 15:49:22 -05:00
John Sully
2788cf57b0 Implement try_lock 2019-02-22 01:23:31 -05:00
John Sully
d48cf2494d Change fastlock implementation from naive spinlock to a ticket lock for better fairness and lower peak latency 2019-02-21 00:16:47 -05:00
John Sully
8e8abb2ff9 Cleanup lock contention, and ensure clients are written to in an unsafe way when the global lock is released 2019-02-20 23:30:21 -05:00
John Sully
627c19e02f Multithreading works! 2019-02-20 01:20:26 -05:00
John Sully
0914b52ffa Thread safety fixes 2019-02-18 22:25:35 -05:00
John Sully
c0eb2e5193 Fix recursive fastlock... 2019-02-16 14:25:14 -05:00
John Sully
8b7e441997 Make the lock recursive, this is because processEventsWhileBlocked may cause us to lock multiple times 2019-02-15 14:11:05 -05:00
John Sully
eefa3e9168 Fastlock fixes 2019-02-10 22:00:19 -05:00
John Sully
bd46c2041e move ae to C++ 2019-02-10 20:24:11 -05:00