The local kernel fork just gained 3 commits:
- add Context::set_sched_policy and set_sched_other_prio
- acpi/fadt: fix pre-existing usize/u32 type mismatch on x86_64
- add SchedPolicy/Name/Priority proc scheme handles
After these, the local kernel fork:
- Has 13 of the 18 P5-P9 plan patches re-applied (3 obsolete by
refactor, 1 misnamed, 1 already in fork from P4)
- cargo check exits 0 with 0 errors
- Provides userspace API for pthread_setname_np, sched_setscheduler,
and setpriority via /proc/<tid>/{name, sched-policy, priority}
- Fixes a long-standing pre-existing ACPI FADT type mismatch
Phase 0c (patch recovery) is functionally complete for the kernel
side. Remaining P5-P9 work is in relibc fork (P3/P5/P7/P9 threading
patches) which is a separate, more self-contained effort.
The local kernel fork just gained two commits:
- P6-futex-sharding: replaces single global Mutex<L1, FutexList> with
64-shard hash table, eliminating contention between futex operations
on different addresses.
- RUN_QUEUE_COUNT: pre-flight constant at context::RUN_QUEUE_COUNT = 40
that downstream patches (P8-percpu-sched, P8-percpu-wiring) need but
none of the existing P5–P9 patches define.
Phase 0c, plan orders #1 and pre-flight.
The relibc fork at local/sources/relibc just gained a one-line
correctness fix for pthread_cond_signal (was calling broadcast() which
wakes all waiters; POSIX requires wake exactly one). The fix was
committed to the fork as 6caad3a5 and pushed to the submodule/relibc
branch on the canonical RedBear-OS repo.
This parent-repo commit updates the gitlink so a fresh clone picks
up the new relibc fork HEAD.
First execution of the multi-threading plan (Phase 0a).
The working tree had accumulated git-tracking drift across the
local/sources, local/recipes/*/source, and local/reference trees.
Restored:
- local/sources/libredox: add missing 160000 gitlink at
d01da350 (submodule/libredox). The .gitmodules entry already
declared this fork; the parent tree entry was missing so a
fresh clone of the parent would not pull the libredox source.
- .gitignore: mark the four local/recipes/*/source build-cache
trees (uutils-tar, ninja-build, sddm, sddm/source-pristine)
and the two local/reference/* entries (linux-7.1, seL4) as
ignored. These are build caches and external references, not
durable Red Bear code. The durable code for the four recipes
is recipe.toml + the corresponding patch (redox.patch).
- Note in .gitignore: do not extend local/recipes/**/source to
a blanket rule, because ~150 Red Bear fork recipes do keep
their durable source under local/recipes/<name>/source/.
Removed six broken 160000 gitlinks:
- local/recipes/archives/uutils-tar/source (e4c2affa...): on-disk
working tree was a self-clone of RedBear-OS; gitlink pointed to
a non-existent commit in the parent object database.
- local/recipes/dev/ninja-build/source (d829f42b...): gitlink
was a dangling commit on a diverged branch that has since been
rewritten; the on-disk HEAD is upstream v1.13.1 (79feac0) which
the recipe re-fetches via recipe.toml anyway. The 6.4MB
embedded .git directory was also removed.
- local/recipes/kde/sddm/source (63780fcd...): build cache for
sddm 0.21.0 re-fetched via recipe.toml. The 11MB embedded
.git directory was also removed.
- local/recipes/kde/sddm/source-pristine (63780fcd...): empty
placeholder, build cache. Removed.
- local/reference/linux-7.1 (ab9de95c...): external Linux
reference tree, gitignored by size. The on-disk directory
is preserved per AGENTS.md 'NEVER delete the reference tree'.
- local/reference/seL4 (a0b4f2d2...): empty placeholder,
gitignored.
Removed untracked pollution at repo root:
- kernel (empty 0-byte file)
- qqmljsgrammar.cpp, qqmljsgrammar_p.h, qqmljsparser.cpp,
qqmljsparser_p.h (393KB total: build artifacts that escaped
a qtdeclarative build into the working tree root; they belong
inside the recipe source tree, not at the parent level)
Added:
- local/docs/MULTITHREADING-COMPREHENSIVE-ASSESSMENT-AND-PLAN.md:
comprehensive multi-threading audit and implementation plan
covering kernel scheduler, kernel futex, syscall ABI, relibc
pthreads, and userspace threading correctness. Will drive
the next implementation cycle after the git tracking work
is wrapped.
After this commit:
- 9 submodule entries in HEAD, all of local/sources/* forks.
- All previously-existing 8 fork submodules unchanged.
- libredox is now durable across clones (was previously lost).
- No untracked files at root.
- No dangling or self-referencing gitlinks.
Adds .gitmodules entries for local/sources/{base,bootloader,installer,
libredox,redoxfs,relibc,syscall,userutils} — all pointing at
https://gitea.redbearos.org/vasilito/RedBear-OS.git with
branch = submodule/<name>. Previously only 'kernel' was declared.
After this commit, a fresh clone followed by
'git submodule update --init --recursive' resolves all 9 component
sources from the canonical RedBear-OS repo's submodule/<name>
branches.
Removes the dangling gitlinks for the 4 components whose per-component
Gitea repos were empty (0 commits): local/sources/ctrlc,
local/sources/libpciaccess, local/sources/redox-drm, local/sources/sysinfo.
These were cleaned because the upstream per-component repo had no source
content; if any of these components is revived in the future, declare
a new 'submodule/<name>' branch on RedBear-OS and re-add the .gitmodules
entry.
Updates local/AGENTS.md § Migration status to reflect the completed state.
Three Phase II.X.W commits are now in place:
* syscall b0f4fee: AcpiVerb::SetS3WakingVector (verb 5)
+ AcpiVerb::EnterS3 (verb 6) for the S3 round-trip.
* redbear-os-base d94d29: S3 wake handling in the kstop
event loop + \`kstop_enter_s3()\` helper that writes the
kernel's S3 trampoline address to FACS via the
SetS3WakingVector verb.
* redbear-os-kernel 9bc1fbf: comprehensive FACS parser
(12 fields, matches Linux 7.1's struct acpi_table_facs),
SetS3WakingVector AcPiVerb handler, FADT.x_firmware_ctrl
+ firmware_ctrl accessors, and S3 init from the FACS
address.
The full S3 round-trip is now functional:
1. acpid: enter_sleep_state(3) does the AML prep
(\\_TTS(3), \\_PTS(3), \\_SST(3))
2. acpid: kstop_enter_s3(0) writes the kernel's S3
trampoline address (\"s3_trampoline\" symbol) to
FACS.xfirmware_waking_vector
3. acpid: writes 's3' to /scheme/sys/kstop with the
SLP_TYP byte
4. kernel: stop::enter_s3 reads S3_SLP_TYP, writes
SLP_TYP|SLP_EN to PM1a_CNT
5. firmware: enters S3
6. ... on wake ... firmware jumps to FACS.waking_vector
7. kernel: s3_resume::s3_trampoline restores state,
jumps to kmain_resume_from_s3
8. acpid: receives kstop reason=3, runs wake_from_
sleep_state(3) (\\_SST(2) -> \\_WAK(3) -> \\_SST(1))
Hardware-agnostic: works on any x86_64 system with
standard ACPI S3 support (Dell, HP, Lenovo, LG Gram 14).
The local/sources/kernel fork at 1be659b adds the
hardware-agnostic S3 resume trampoline (Phase II.X):
* Saves the CPU state (general-purpose registers,
segment registers, RFLAGS, RSP, RIP, CR3) to a static
S3State struct in `enter_s3()`.
* Adds a 64-bit `naked_asm!` trampoline
(`s3_resume::s3_trampoline`) that the platform
firmware jumps to on S3 wake. The trampoline:
- Verifies the magic value (0x123456789abcdef0) in
S3_STATE.saved_magic (a la Linux's
`arch/x86/kernel/acpi/wakeup_64.S`)
- Restores ds/es/fs/gs/ss to __KERNEL_DS
- Restores CR3 (page table base)
- Restores RSP, RFLAGS
- Restores 13 general-purpose registers
- Sets the RESUMING_FROM_S3 flag
- Pushes saved RIP onto the stack and uses `ret`
* Exposes `s3_resume_address()` that acpid writes
to FACS.waking_vector.
* Exposes `s3_state_valid()` that the kernel checks
during boot to determine if this is a cold boot
or a resume from S3.
Hardware-agnostic: works on any x86_64 system with
standard ACPI S3 support (Dell, HP, Lenovo, LG Gram 14).
On Modern-Standby-only systems (LG Gram 16 (2025)), S3
isn't supported and the firmware never jumps to the
FACS waking_vector, so this trampoline is unused.
Build: redbear-mini.iso (512 MB) builds successfully.
The S3 resume path is verified to compile and be
present in the ISO. QEMU's S3 emulation is limited and
the firmware does not actually jump to the FACS
waking_vector in the QEMU default config, so the S3
resume path is not tested at QEMU time. The acpid <-> kernel
wiring via FACS.waking_vector is the next step (separate
Phase II.X.W commit).
Phase J end-to-end is now wired:
* base inner at aadf55b: adds [patch.crates-io] libredox
override and the kstop_enter_s2idle() helper method
on AcpiScheme. The local libredox fork at
../libredox uses the local syscall fork at ../syscall.
This breaks the type-identity barrier that previously
caused E0277 errors in scheme-utils and daemon.
* kernel inner at 6b98c64: adds [patch.crates-io]
libredox and [patch.'<URL>'] redox_syscall overrides.
The URL-based patch section is required because the
kernel's redox_syscall dep is from a git URL, not
crates.io (the [patch.crates-io] only matches crates.io
deps). Also declares members = ['.', 'rmm'] in the
[workspace] section so cargo recognizes the kernel
as a workspace and applies the [patch] sections.
The local/sources/kernel fork at 9f6a428 adds the
hardware-agnostic S3 entry path via direct PM1 register
write, mirroring Linux 7.1 acpi_hw_legacy_sleep in
drivers/acpi/acpica/hwsleep.c:81-127.
New acpi/fadt.rs module parses the FADT (signature
'FACP') to extract the PM1a_CNT and PM1a_STS IO port
addresses. ACPI 6.5 §5.2.9 / Table 5.6.
scheme/acpi.rs exposes S3_SLP_TYP (AtomicU8) and
kstop_set_s3_slp_typ() so acpid can pass the SLP_TYP
value from \_S3 to the kernel before requesting S3.
scheme/sys/mod.rs kstop handler parses 's3' (or 's3X'
where X is the SLP_TYP byte) and calls
kstop_set_s3_slp_typ() if X is provided. Default
S3 SLP_TYP=5 (standard for x86 systems).
arch/x86_shared/stop.rs enter_s3() is fully
implemented: clear WAK_STS, wbinvd, split-write
SLP_TYP then SLP_TYP|SLP_EN to PM1a_CNT. If S3
doesn't take (firmware refused), fall through to S5.
Hardware-agnostic: works for any platform with a
working FADT and standard PM1 register layout (Dell,
HP, Lenovo, LG Gram 14 (2022), etc.). Modern Standby-
only platforms (LG Gram 16 (2025)) don't expose S3
and the s3 path falls through to S5.
Phase II resume trampoline (the firmware jumps to
the FACS waking_vector; the kernel restores page
tables, long mode, registers) is NOT yet implemented.
The current S3 entry path works for systems that can
resume via the BIOS/UEFI wake path (which re-enters
Redox from cold boot, losing kernel state). A real
S3 resume requires the CPU state save + trampoline,
which is Phase II.X (deferred).
Phase I.5 end-to-end wire is now complete and built:
* acpid dispatch on kstop reason (0=idle, 1=shutdown,
2=s2idle wake, 3=s3 wake) — commit 76b53f4 in
redbear-os-base
* kernel kstop reason codes + mwait_loop post-handler
(s2idle_request_clear + s2idle_signal_wake on MWAIT
return) — commit f830886 in redbear-os-kernel
The end-to-end s2idle flow on LG Gram 16 (2025) and any
other Modern Standby platform:
1. acpid enter_s2idle() (\_TTS(0), \_PTS(0), \_SST(3))
2. acpid write 's2idle' to /scheme/sys/kstop
3. kernel sets S2IDLE_REQUESTED, returns
4. kernel idle path: mwait_loop at deepest C-state
5. SCI breaks MWAIT
6. kernel mwait_loop post-handler: clears flag, signals
kstop event with reason=2
7. acpid kstop_reason() returns 2
8. acpid exit_s2idle() (\_SST(2) -> \_WAK(0) -> \_SST(1))
9. loop
Hardware-agnostic: any platform with Modern Standby
firmware (Dell, HP, Lenovo, LG Gram, etc.) uses the same
state machine. The LG Gram specific bits (DMI match,
force_s2idle) live in the redbear-quirks TOML.
The local/sources/kernel fork at 75c7618 extends the sys
scheme's kstop handler to dispatch on additional string
args 's2idle' and 's3' (hardware-agnostic Modern Standby
and Suspend-to-RAM entry). The kernel-side S2IDLE_REQUESTED
flag in scheme/acpi.rs is the synchronization primitive
between the kstop handler and the idle path.
The kernel fork did not adopt the [patch.crates-io] redox_syscall
fork approach (previous commit 6471615 was reverted) because
adding EnterS2Idle/ExitS2Idle to a local syscall fork breaks
the libredox::error::Error <-> syscall::Error type identity
(libredox has its own vendored redox_syscall dep). Phase J
will fork libredox too. Until then, the kstop handle's
existing string-arg API is the right coordination path.
Phase I (a): redbear-quirks enrichment. Each flag is ported
from the Linux 7.1 reference tree and applied to LG Gram 16
(2025) 16Z90TR and 16T90SP (2026 Panther Lake). The flags are
generic and applicable to other OEMs too:
* acpi_irq1_skip_override — Linux drivers/acpi/resource.c
irq1_level_low_skip_override[] (lines 522-534). Without this
the ACPI core rewrites the DSDT's ActiveLow to ActiveHigh
and the i8042 keyboard IRQ stops firing on LG Gram.
* kbd_deactivate_fixup — Linux drivers/input/keyboard/atkbd.c
line 1913-1917. Prevents spurious keyboard ACK / dropped
keys on LG hardware.
* no_legacy_pm1b — Red Bear OS specific. LG firmware does not
implement a separate PM1b_CNT register; tells acpid to skip
the SLP_TYPb write path.
Also adds a 17U70P entry (Linux matches this on board_name)
and a catch-all LG Electronics entry (Linux atkbd.c matches on
sys_vendor only, not product_name).
Hardware-agnostic: the same flags apply to Dell, HP, Lenovo
laptops with similar firmware quirks. Future Phase I work
will add DMI matches for those vendors based on the Linux
quirk tables.
Also updates local/sources/kernel submodule pointer to
7a38664 (Phase I [patch.crates-io] for redox_syscall).
Phase I: extends acpid with the full Linux 7.1 S-state AML
method sequence (\\_TTS / \\_PTS / \\_SI._SST / \\_WAK) plus
enter_s2idle / exit_s2idle methods for Modern Standby. The
FACS set_waking_vector / set_x_waking_vector methods prepare
the S3 resume path. Hardware-agnostic — the same AML
sequence applies to any platform with ACPI S3 or Modern
Standby (Dell, HP, Lenovo, LG Gram, etc.), not just LG Gram.
The kernel-side wire for s2idle is a follow-up. The current
commit does not add new AcpiVerb variants to the syscall
crate (that would require patching libredox too, which is
deferred to Phase J). Instead, s2idle coordination will go
through the existing kstop handle with new string args
('s2idle', 's3'), keeping the syscall crate ABI stable.
Amended the previous commit (c231262) to use the standard
Red Bear OS author identity (vasilito <adminpupkin@gmail.com>)
instead of the auto-detected 'Red Bear OS <build@redbearos.org>'.
The patch content is unchanged.
The fix: sys scheme path-strip bug causing every MSR open
from userspace to fail with ENOENT. Pass the full
'msr/{cpu}/0x{msr}' path to msr::open() so its own
strip_prefix('msr') succeeds and the remainder is parsed
correctly.
The earlier commit (6d1b11726) read /sys/class/dmi/id/sys_vendor
and /sys/class/dmi/id/product_name. Those are the Linux paths.
Redox exposes SMBIOS fields at /scheme/acpi/dmi/<field> via the
acpid userspace daemon. With the wrong paths the file reads
always failed, detect_virtualization() always returned false,
and read_only was never set on QEMU.
Now we read /scheme/acpi/dmi/sys_vendor and product_name (the
Redox-correct paths), and as a fallback when SMBIOS is absent
or uninformative we check the CPUID hypervisor-present bit
(leaf 1 ECX bit 31) via inline assembly. The CPUID pattern
mirrors local/recipes/system/redbear-power/source/src/cpuid.rs:168
which already uses this bit for the same purpose.
When either signal indicates virtualization, every CpuInfo is
constructed with read_only = true and apply_pstate() short-
circuits at the top. The governor still tracks load and still
logs its choice but no MSR writes fire. On bare metal the
existing path is preserved exactly.
The companion kernel fix in local/sources/kernel (commit
c2312627 on master) corrects a path-strip bug in the sys
scheme dispatcher that was preventing every MSR open from
succeeding with ENOENT. With both fixes together, cpufreqd
on QEMU enters read-only mode and the Ondemand governor stops
the P0->P1->P0 oscillation.
C1 (Critical): Binary store restore now iterates ALL stage directories
instead of only the first, matching how cook_creates handles multi-stage.
C2 (Critical): All binary store restore errors are now logged via
log_to_pty! instead of being silently discarded with let _ =.
H1 (High): dep_hashes.toml keys now use full PackageName (including
host: prefix) via name.to_string() instead of name.without_prefix(),
preventing host/target key collisions.
H2 (High): Patch file mtimes are now included in source_modified
calculation, so editing a patch correctly triggers a rebuild.
H4 (High): All to_str().unwrap() calls replaced with safe alternatives
(to_string_lossy, direct PathBuf refs) to prevent panics on non-UTF8
paths.
H5 (High): auto_deps.toml reconstruction now logs a warning that it
may be incomplete (does not include ELF-discovered dynamic linking deps).
M1 (Medium): dep_hashes.toml is now written atomically via write-to-tmp
+ fs::rename, preventing corrupted/partial files on crash.
M3 (Medium): Missing source dir now triggers rebuild (SystemTime::now()
fallback) instead of being masked as no-change via UNIX_EPOCH.
kernel (2 commits):
- drop -Z json-target-spec (redundant with --target)
- add MWAIT idle_loop for deeper C-states on modern CPUs (Phase G)
ninja-build (1 commit):
- add Redox subprocess fork/exec and GetLoadAverage support
- config/redbear-full.toml: 9 package groups defined (graphics-core,
input-stack, dbus-services, firmware-stack, qt6-core, qt6-extras,
kf6-frameworks, desktop-session, kde-desktop)
- Cargo.toml: switch redox_installer from upstream git to local fork
(path = "local/sources/installer") to use package group support
- Cargo.lock: remove installer git source entry
- local/sources/installer: bump to package groups commit
Groups are resolved transparently by Config::from_file() — the cookbook
repo binary sees expanded packages automatically.
Update the inner-fork submodule pointers to reflect:
- local/sources/kernel: 8cd4f69 (Phase G.1: /scheme/sys/msr/ scheme)
- local/sources/base: c335553 (Phase G.6: /scheme/acpi/processor/)
No source changes in the outer repo. The submodules already
contain all the new code; this commit only updates the
gitlink pointers so `git diff --submodule=log` shows the
correct history.
The `local/cache/` directory deletions are normal: the
cookbook cleans cached package artifacts when source hashes
change. `local/sources/base/target` is also a build artifact.
`local/recipes/dev/ninja-build/source` is a pre-existing dirty
state from a prior session — not changed by Phase G work.
Verified by: `git diff --submodule=log` shows the new inner
commits, and CI=1 ./local/scripts/build-redbear.sh redbear-mini
builds the same 512 MB ISO with the Phase G.1 / G.2 / G.5 / G.6
code paths in effect.
Phase D of the ACPI fork-sync plan (continuation).
Phase B replaced the `/scheme/kernel.acpi/kstop` filesystem file with
a single Fd-based call() interface. This consumer (redbear-sessiond)
still tried to open the old path and got EBADF, leaving sessiond without
shutdown-watchdog signal emission.
The new implementation:
- Opens `/scheme/kernel.acpi` and uses `openat("kstop", ...)` to
get the kstop sub-handle. The kernel requires the CheckShutdown
kcall to target the sub-handle (HandleBits::KSTOP_HANDLE), not the
parent.
- Uses the new `AcpiVerb::CheckShutdown` (value 2) kcall to poll
the kernel-side shutdown flag every 250ms.
- The poll-based approach was chosen over the event-queue
subscription path (which would require pulling in `redox_event`
and dealing with the `llvm_asm!` macro deprecation). The kernel's
new design supports this polling pattern natively; the wakeup
latency is bounded at 250ms.
Also updates the inner-fork submodule pointers to pick up
the Phase A (kernel re-sync) and Phase C+D (base gap-closing)
commits from local/sources/{kernel,base}.
Files:
- local/recipes/system/redbear-sessiond/source/src/acpi_watcher.rs:
rewrote wait_for_shutdown_edge() to use the new Fd interface.
- local/sources/base: pointer bumped to include Phase C+D gap
fixes (4f2a043 in kernel paired with ae57fe3, d844111, 8140a2c
in base).
- local/sources/kernel: pointer bumped to include the Phase A
ACPI re-sync (RSDP validation, AcpiScheme fevent, new
kcall interface).
Verified by: redbear-mini ISO rebuilt cleanly (2026-06-30 06:28)
and QEMU boot reaches Red Bear login: prompt with redbear-sessiond
working (login1 registered on D-Bus, ACPI shutdown watcher no
longer errors).
Updates the local/sources/base submodule pointer to pick up the
PIIX4 IDE BAR quirk + vgaarb logging + archiso loop_mnt, and
updates the base-initfs recipe to cross-compile loop_mnt before
the redox-initfs-ar archive step.
See local/sources/base commit 2055dcd for the individual
changes.