Commit Graph

148 Commits

Author SHA1 Message Date
vasilito 660e3e001d Merge upstream/master into submodule/kernel
Sync the kernel fork with 10 upstream commits (context timer-separation
with unblock_context/wakeup_context, dtb MMIO/bus-address translation
+ tests, event read_with_timeout support, proc wakeup paths, dup2
rewrite with rollback, futex Weak context_lock + unblock_context,
memory/init ordering, and more). Satisfies the verify-fork-functions
gate (11 previously-missing upstream functions now present).

Conflicts resolved (5 files; 9 auto-merged):

- src/syscall/futex.rs: took upstream's version wholesale (Weak
  context_lock, upgrade+unblock_context, TimeSpec::to_nanos,
  get_futex_stat, addr_space strong_count cleanup); re-applied the RB
  FUTEX_WAIT_MULTIPLE/FUTEX_REQUEUE implementations adapted to the
  Weak API, with wake-index bookkeeping preserved
  (Context::futex_wake_index survives in context.rs).

- src/event.rs: merged EventQueue with both RB's fd-refcount refs and
  upstream's timeout_opt (init in new()); kept RB's EventCounter/
  eventfd block; added upstream's read_with_timeout +
  EVENT_TIMEOUT_ID write handling; deduplicated EAGAIN/EINTR imports.

- src/scheme/proc.rs: upstream imports minus UnmapVec (RB deleted that
  machinery from context/memory.rs — import-only dependency);
  ContextHandle::Start keeps RB's require_zero_offset + upstream's
  wakeup_context; FORCEKILL region takes upstream's
  is_dead()/being_sigkilled form.

- src/syscall/fs.rs: took upstream's dup2 structure (natural
  self-dup-with-buf handling — preserves the relibc dup2(ft,ft,
  "refresh") semantic — plus rollback on insert failure), adapted to
  the fork's 4-arg duplicate_file and read/token_split conventions.

- src/arch/aarch64/start.rs: kept upstream's new PageMapper/
  acpi::init_before_mem/memory::init_mm init block.

Verified: repo cook kernel --force-rebuild successful;
verify-fork-functions.sh --no-fetch kernel passes.
2026-07-19 07:02:19 +09:00
Wildan M 4251102f0b Partially solve missing wakeups after separate timers 2026-07-17 20:02:37 -06:00
Akshit Gaur f5fe18b23c Finish the work on separating timers 2026-07-16 07:48:54 -06:00
Wildan M ee4a5602a6 Implement make install and test targets 2026-07-16 01:27:47 +07:00
vasilito 2086faecb0 rb: reapply Red Bear patches on upstream 00cfa2d2 2026-07-12 16:55:28 +03:00
Akshit Gaur 38642377f3 Separate timers 2026-07-07 06:43:41 -06:00
Wildan M 622a4fb3cd Solve context leak when switching 2026-06-19 17:33:46 +07:00
Wildan M 101f090ef9 Fmt 2026-06-19 16:50:14 +07:00
Akshit Gaur b93260ed2d Migrating run_queue to BTreeMap 2026-06-18 10:39:33 +05:30
4lDO2 42613ddc06 WIP: simultaneous NMI-based user+kernel profiling. 2026-06-03 19:01:35 +02:00
Akshit Gaur 58283f63fe EEVDF 2026-05-30 08:39:48 -06:00
Wildan M bd44956e96 Capture event stat, change stat source for contexts 2026-05-12 12:24:49 +07:00
Speedy_Lex f49c7d991a RSDP validation and fixing a few clippy lints 2026-05-05 19:35:31 +02:00
Wildan M 85c98314a9 Unwrap select_next_context result 2026-05-02 06:23:13 -06:00
Wildan M a297bfcc82 Use smallvec for memory and notify_files 2026-04-30 22:00:35 +07:00
Wildan M fb137f8001 Avoid reaccessing AddrSpace when switching 2026-04-30 11:09:59 -06:00
Wildan M ab08d47aa8 Add commented out switch debug print 2026-04-29 11:21:20 +07:00
Wildan M e7ac009f31 Fix deadlock on contended switch 2026-04-29 11:21:02 +07:00
Wildan M baf329c120 Fix dead contexts clobber idle pools 2026-04-29 11:20:21 +07:00
Wildan M 2df7467d13 Use weak ContextRef for run contexts 2026-04-26 12:08:24 +07:00
Wildan M ea1d915bbc Make wake up optional 2026-04-26 07:15:10 +07:00
Wildan M 0534ab6377 Replace enqueue with dedicated idle contexts 2026-04-26 06:49:55 +07:00
Wildan M de7926e05e Do not push idle context to queue 2026-04-26 06:49:54 +07:00
Wildan M 7adceb6e80 Add idle context 2026-04-26 06:49:54 +07:00
bjorn3 7827cb6c78 Unify context list again now that we have a run queue
This simplifies code and ensures that exiting a context will properly
remove it from the list of contexts.
2026-04-26 06:49:54 +07:00
Wildan M f773d3e50d don't loop from idle to kernel context 2026-04-23 16:40:12 +07:00
Wildan M 8262fa7da9 Don't account idle time 2026-04-23 16:33:15 +07:00
bjorn3 30b967022f Fix a couple of warnings 2026-04-17 20:20:16 +02:00
Akshit Gaur 976756991a Deficit Weighted Round Robin Scheduler 2026-04-17 06:52:03 -06:00
Speedy_Lex ee1260363c Fix many clippy lints 2026-04-08 19:40:41 +01:00
Wildan M 3b5a0e4c60 Apply ordered lock to AddrSpaceWrapper without solving borrow checker 2026-04-01 08:42:18 -06:00
Wildan M 6e0143cf0d Store context to per cpu 2026-03-31 15:29:47 +07:00
Ron Williams fde164b2a0 Revert "Deficit based Weighted Round Robin Scheduler"
This reverts commit b7dabfc3c2.
2026-03-22 18:44:41 +00:00
Akshit Gaur b7dabfc3c2 Deficit based Weighted Round Robin Scheduler 2026-03-22 07:00:31 -06:00
bjorn3 ea847f428f Fix compilation with the debugger feature enabled 2026-03-07 12:19:24 +01:00
auronandace 14b8c2b0c1 enforce two lints and collapse some ifs 2026-03-03 14:51:32 +00:00
Wildan M 3c2b1a11c5 Add ordered lock for time offset mutex 2026-02-25 11:42:17 +07:00
bjorn3 7ff1898765 Fix a couple of warnings 2026-02-06 20:54:42 +01:00
Jeremy Soller 1c850605d0 Only read time once during context switch 2026-01-20 14:18:33 -07:00
Jeremy Soller 81a49d211b Fix potential preempt guard deadlock 2026-01-20 13:58:31 -07:00
Anhad Singh d9eae6bb75 fix(sync/wait_condition): deadlock in WaitCondition::wait
Instead of using a simple switch to determine if preemption is enabled
(`is_preemptable: bool`), a counter is used instead. This handles the
case where a function holding a `PreemptGuard` calls another function
that creates a new `PreemptGuard`.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-15 13:05:29 +11:00
Anhad Singh 4ff82ad8b5 fix(scheme/user): deadlocks inside call_extended_inner
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-11-27 14:39:14 +11:00
Jeremy Soller 60af085356 Improve cpu stat accuracy 2025-11-03 20:42:08 -07:00
Speedy_Lex 0931a7f49f Resolve a huge portion of the clippy lints 2025-10-06 06:30:23 -06:00
Jeremy Soller 5dc6f7c3ba lock ordering 2025-09-22 07:48:48 -06:00
bjorn3 4884d749af Make PercpuBlock const constructable 2025-09-15 19:00:03 +02:00
bjorn3 61db2b2ad5 Use core::hint::spin_loop() where possible 2025-09-13 18:55:16 +02:00
Jeremy Soller 8a2aa411e2 Explicitly scope all locks, fixing multi_core hangs. Allow contexts on any CPU 2025-09-13 10:10:07 -06:00
bjorn3 cea93f7647 cargo fix --edition & rustfmt
Or to be precise:
RUST_TARGET_PATH=$(pwd)/targets cargo fix --edition \
--target targets/x86_64-unknown-kernel.json \
--target targets/i686-unknown-kernel.json \
--target targets/aarch64-unknown-kernel.json \
--target targets/riscv64-unknown-kernel.json \
-Zbuild-std=core,alloc --allow-dirty --bin kernel
cargo fmt
2025-09-10 16:44:36 +02:00
bjorn3 b5822ac118 Mostly use cfg!() rather than #[cfg] for controlling sys_stat
This only adds 48 bytes overhead per cpu core in the PerCpuBlock struct.
Also fixes compilation with sys_stat enabled on x86_64.
2025-09-07 12:27:04 +02:00