Skip to content

Fix/cpu bugs - #52

Merged
Leonmmcoset merged 4 commits into
mainfrom
fix/cpu-bugs
Sep 25, 2026
Merged

Leonmmcoset merged 4 commits into
mainfrom
fix/cpu-bugs

Conversation

@Leonmmcoset

Copy link
Copy Markdown
Collaborator

No description provided.

LeonOS Pages Refactor and others added 4 commits September 24, 2026 20:33
Two low-risk fixes targeted at CPU-0 saturation under multi-core desktop load.

serial: the transmit-empty check was stubbed out with `(void)` so every
character was written to COM1 unconditionally. At console spam / boot-log
rates the guest outruns the host UART and bytes are silently dropped. Add a
bounded THRE busy-wait before each outb so back-pressure is respected without
any risk of wedging a caller that runs with IRQs masked.

framebuffer: the legacy present path always called framebuffer_vmware_sync
after every update. That helper both rings the SVGA doorbell (SYNC reg) and
spins reading SVGA_REG_BUSY until the host has drained the command FIFO.
Because framebuffer_present_region runs under the global execution lock with
local IRQs masked, that busy-wait became the dominant per-frame stall: one
core spent each present inside SVGA_REG_BUSY polling, and every other core's
syscall blocked behind the global ticket. Change it so the fast path only
kicks the doorbell (new framebuffer_vmware_kick, non-blocking), and the
synchronous drain happens only when the update fails because the ring is
full — which is exactly when we must wait to make progress before retrying.
The newer SVGA backend already rings its own doorbell at packet publish
(fifo.c:85), so the change is a strict reduction of work on that path.

The global execution lock itself is not touched here; that is the next step
and needs VM feedback to sequence safely.
Reconcile the architecture documents against what the tree actually does now.
Date-stamped status/audit/progress/handoff records are left as historical
snapshots and not rewritten.

- EEVDF_SCHEDULER.md / EXECUTION_LOCK.md: the claim `SMP_USER_SCHEDULER_ENABLED=0`
  / "AP scheduler disabled" / "active CPU = 1" is stale. smp.c has no such
  flag and every AP runs userland_schedule_from_frame -> arch_enter_user_frame.
  Rewrite to state APs schedule user tasks, while keeping the two real, still
  accurate limits: all device IRQ stay on the BSP, and the global execution
  ticket lock serialises cross-core syscalls.
- DESKTOP_PERFORMANCE.md: document the 2026-09-24 asynchronous present change
  (doorbell-only on the fast path, synchronous FIFO drain only on
  backpressure) and why it mattered under the execution lock.
- DRIVERS.md: list the ac97 and es1371 loadable modules that already build
  (DRIVER_NAMES in mk/boot.mk) instead of only mouse/serial/e1000.
- RPR.md: reflect that `make pages` now also emits the generated Documentation
  section (docs/ rendered by tools/build/md2html.awk) and that verify-pages.sh
  rejects raw Markdown leaks.
- README.md (docs index): add pointers to the build-system, RPR, scheduler,
  execution-lock and desktop-performance documents that existed but were not
  listed.
Second pass over every non-timestamped doc, with every claim re-verified
against the tree before editing:

- ABI.md: rewrite Time/Device/Driver/Appearance/Auth/Machine-Identity/
  Network/Audio/Service sections around the real interfaces (OpenRC
  leonos-ntp/leonos-dhcp + /run state files, PAM + /etc/passwd accounts,
  devmand/sessiond AF_UNIX services, LEONOS_NET_CONTROL_IOCTL on AF_INET
  fds, /dev/driverctl control ioctl, sysfs DMI identity, OSS-only audio);
  devfs node list now matches storage_vfs.c exactly (drop phantom
  /dev/net0 and /dev/audio0, add gpu/rtc/driverctl/kmsg/shm0/aliases).
- SYSCALLS.md: replace the removed private ioctl-multiplexer catalogue
  with the actual per-node device ABI; document the real socket syscall
  dispatch, udhcpc lease flow (no kernel DHCP; netctl/oobe exception),
  and rcctl-based service control; correct GPU dispatch to /dev/gpu.
- unix-ipc-protocol.md: remove the never-shipped authd/netmand sections
  (accounts are PAM, network is kernel control ioctl + OpenRC), drop the
  fictional serviced/ hosting, fix the migration table file inventory.
- FILESYSTEM.md: correct the /dev node list and input-method retirement
  to /run/leonos/input-method.sock.
- ABI_MIGRATION.md: dirfd-relative openat, signal handler frames,
  Unix98 hangup, windowd GUI migration, device list and input-method
  rows now match implemented state.
- KERNEL_DEBUG.md: probe registry is 41 syscall entries, ioctl probes
  empty (removed with the private ioctls).
- BOOT_AND_INTEGRITY.md: runtime root is ext2, not exFAT.
- BUILDSYSTEM.md: components.toml stage/entry/sdk/api fields, loader
  under generated/boot, APK version 2.<epoch>-r0, real smoke markers.
- APK_PREPARATION.md / ROOTFS / UPSTREAM_TOOLS / THIRD_PARTY /
  BUILD_AND_INSTALLER: dead `build.py` invocations and obsolete build/
  paths replaced with make targets and out/x86_64/release paths;
  ownership groups reference configs/apk-ownership.json, staged by
  tools/build/rootfs-stage.sh.
- SOURCEHUT_SYNC.md: secret is SOURCEHUT_REPOSITORIES (plural, multi-
  line). BROWSER.md: litehtml pin is b9e89f0; no gen_ninja.py.
- APP_REGISTRY.md: manifest example includes the generated system= key.
- INSTALLER_ACCOUNTS.md: component inventory comes from the APK
  database and system=1 markers, not the phantom components.list.
Replace the single aggregate CPU polyline with one colored line per
core in the same plot, each core keeping a stable color from a 32-entry
palette (cycled for larger machines). Per-core samples ride the shared
history ring so all graphs advance together, offline cores leave gaps,
and the header still shows aggregate utilization. The per-core usage
list gains a matching color swatch so the line-to-core mapping stays
readable without an in-plot legend.
@Leonmmcoset
Leonmmcoset merged commit 30b1db6 into main Sep 25, 2026
3 checks passed
@Leonmmcoset
Leonmmcoset deleted the fix/cpu-bugs branch September 25, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants