Commit Graph

293 Commits

Author SHA1 Message Date
Loïc Grégoire 6020484453 mm/zone: switch to linear-log bucketing
While we're here, also shrink some types.
2026-10-25 00:08:29 -04:00
Loïc Grégoire 8958854a28 rtl: add racy_read 2026-10-24 22:20:21 -04:00
Loïc Grégoire 0ffaa8df5b mm/zone: remove all spinlocks 2026-10-24 22:12:56 -04:00
Loïc Grégoire 09762e88ae ke/mutex: add try_acquire 2026-10-24 22:12:44 -04:00
Loïc Grégoire 664b621a16 ke/amd64: use movb instead of xchg 2026-10-24 19:01:45 -04:00
Loïc Grégoire b9261c84de ke: optimize mutex
Optimize the mutex code in a few ways:

- Split the fast and slow paths into their own functions, inline the fast path.
- Raise IPL only when acquiring a turnstile lock.
- Avoid taking the turnstile lock if the "waiters" bit is not set.
- Do adaptive spinning only when the lock owner is running.
2026-10-24 16:12:30 -04:00
Loïc Grégoire caaab1e96f ke/turnstile: rework API 2026-10-24 16:12:18 -04:00
Loïc Grégoire 3c5855efc7 ke/sched: don't clear td.cpu 2026-10-24 16:10:51 -04:00
Loïc Grégoire 13a7daad4c ex/string: make string entries smaller 2026-10-23 23:47:35 -04:00
Loïc Grégoire 76147556a3 ke: make getting the current thread atomic 2026-10-23 23:47:23 -04:00
Loïc Grégoire 0a843157c2 ke: remove extraneous Type suffix 2026-10-23 23:46:50 -04:00
Loïc Grégoire 29e678a40b meta: update zig 2026-10-23 23:46:01 -04:00
Loïc Grégoire 6a63714e6c all: rework source tree structure 2026-10-12 15:02:48 -04:00
Loïc Grégoire 2b1b7a7c84 firmware: add FDT parser 2026-10-12 14:46:20 -04:00
Loïc Grégoire a9ecd069a3 rtl: add read_struct 2026-10-12 14:45:40 -04:00
Loïc Grégoire c55beec893 ke,ex: rework kernel queue
There was previously a lock inversion in the queue code where we acquired the
queue lock under the thread lock (in the wait_any committing path). This patch
attempts to fix this by instead using an atomic count and deferring the waking
of other threads to a DPC.
2026-10-10 09:37:43 -04:00
Loïc Grégoire ad7f14ecb8 ke: detach from queue on thread exit 2026-10-10 09:37:20 -04:00
Loïc Grégoire 923e119756 ke: rework DPC memory ordering
swapping with acq_rel here ensures that all previous stores are visible to the
DPC when it's running
2026-10-10 09:23:24 -04:00
Loïc Grégoire fee5d205a9 ke: clean up wait code 2026-10-09 16:55:30 -04:00
Loïc Grégoire cefc69e1b5 all: more tidying 2026-10-08 18:01:42 -04:00
Loïc Grégoire dc39456d6e tests: oops fix fireworks 2026-10-07 18:08:16 -04:00
Loïc Grégoire 619c373d47 all: tidy 2026-10-07 18:03:06 -04:00
Loïc Grégoire 6cd9117a05 Remove bad tests 2026-10-07 18:02:17 -04:00
Loïc Grégoire 5317cb54b4 ke+loader: rework kernel entry
oops, didn't test last commit on debug runs. Now this starts the kernel on its 16
kib stack.
2026-10-05 13:03:16 -04:00
Loïc Grégoire f53a596fb9 loader: boot kernel with a bootstrap stack (oops) 2026-10-05 12:56:36 -04:00
Loïc Grégoire 12d0e65fd5 all: more 0.17 migrations 2026-10-04 11:38:11 -04:00
Loïc Grégoire 6701f17fb1 ke: clean up wait after continuation 2026-10-04 11:37:52 -04:00
Loïc Grégoire 8815e5e52c ke: clean up wait code 2026-10-04 11:36:37 -04:00
Loïc Grégoire 6f07f181db ke: rework timer cancellation 2026-10-04 11:36:37 -04:00
Loïc Grégoire cbe823ce6e loader: pass more things to the kernel 2026-10-04 11:36:37 -04:00
Loïc Grégoire 72ff4882e8 loader: fix compile error 2026-10-04 11:36:37 -04:00
Loïc Grégoire b802919fc2 ke: add lock warden 2026-10-04 11:36:28 -04:00
Loïc Grégoire dd2161179d build: update tidy script 2026-10-03 17:08:43 -04:00
Loïc Grégoire 10c6c3d27f all: upgrade to zig 0.17 2026-10-03 17:00:13 -04:00
Loïc Grégoire a49a738d69 riscv64: fix build 2026-09-27 21:41:08 -04:00
Loïc Grégoire 7d83278bc6 mm/zone: formatting 2026-09-27 21:36:45 -04:00
Loïc Grégoire 26084dbb99 riscv64: move trap code into ke 2026-09-27 21:36:23 -04:00
Loïc Grégoire ec05f050fb ex: remove extraneous vmem check 2026-09-27 21:32:19 -04:00
marv7000 2c20f0b456 riscv64: initial risc-v port 2026-09-27 21:32:00 -04:00
Loïc Grégoire d03251d3e0 ex: fix vmem bug 2026-09-27 17:40:55 -04:00
Loïc Grégoire 672f04a833 add tidy script 2026-09-27 16:21:40 -04:00
Loïc Grégoire c7673dc438 ke: fix shootdown bugs 2026-09-26 13:11:20 -04:00
Loïc Grégoire 021e213fb2 ke/turnstile: make turnstiles more finely locked
Add a per-turnstile lock which is now held across propagation, instead of a
per-chain lock. This should hopefully
avoid scalability problems if many different turnstiles point to the same
bucket.
2026-09-20 01:18:02 -04:00
Loïc Grégoire 8013e84d9f ke/sched: style fixes 2026-09-20 00:24:44 -04:00
Loïc Grégoire 7d871ca75f ke/sched: fix IPL window when stealing threads.
There was a window where a thread could get stolen from a CPU but never
enqueued, since IPL doesn't stay raised the whole time, and the CPU could
therefore get preempted. Keep IPL raised across the whole operation until the
thread is enqueued.
2026-09-20 00:12:54 -04:00
Loïc Grégoire a9028e53ff ke/smr: allow invalid sequences in deferred_advance_commit
This was buggy when the race was lost and it ended up trying to commit a
deferred advance of 0, now explicitly make the magazine's sequence invalid and
do nothing in deferred_advance_commit, avoiding an integer underflow.
2026-09-19 23:03:39 -04:00
Loïc Grégoire e7655e9725 ke: fix scheduler deadlock on switching 2026-09-19 22:19:30 -04:00
Loïc Grégoire 472cecea08 ex: move vmem to ex 2026-09-16 16:59:22 -04:00
Loïc Grégoire 33ea78a7dd ke: refine turnstile comments 2026-09-16 16:46:04 -04:00
Loïc Grégoire eeadc1420a mm/vmem: add importing and rework API 2026-09-13 22:13:18 -04:00