Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/smoke-soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
with:
# The fork/exec surface PR #206 introduced and epic #501 is
# actively de-risking, plus the reproducer harness itself — a
# change to `scripts/repro-fork.sh`, `userspace/repro_fork/`,
# change to `scripts/repro-fork.sh`, `tests/userspace/repro_fork/`,
# or the `repro-fork` xtask subcommand could silently
# invalidate the soak, so it must trigger too.
# Deliberately does NOT include this workflow file — a
Expand All @@ -120,7 +120,7 @@ jobs:
- 'kernel/src/process/**'
- 'xtask/src/main.rs'
- 'scripts/repro-fork.sh'
- 'userspace/repro_fork/**'
- 'tests/userspace/repro_fork/**'

- name: Decide
id: decide
Expand Down
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ members = [
# dispatches to its `bench-page-cache` binary.
"bench/page-cache",
"xtask",
"userspace/hello",
"userspace/init",
"userspace/pjdfstest_runner",
"userspace/repro_fork",
"userspace/shell_pipeline",
"userspace/vibix_abi",
"userspace/vibix_libc",
"userspace/vibix_libc_defs",
"userspace/ld_vibix",
"userspace/hello_dyn",
"base/init",
"base/vibix_abi",
"base/vibix_libc",
"base/vibix_libc_defs",
"base/ld_vibix",
"tests/userspace/hello",
"tests/userspace/hello_dyn",
"tests/userspace/pjdfstest_runner",
"tests/userspace/repro_fork",
"tests/userspace/shell_pipeline",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
]
# tests/pjdfstest is a vendored copy of saidsay-so/pjdfstest (2-clause BSD). It
# is intentionally kept outside the workspace until #581 wires it into xtask —
Expand All @@ -38,7 +38,7 @@ members = [
# `host-fuzz` feature; pulling it into the workspace would force the host
# feature surface on the kernel-target build graph. `cargo xtask fuzz ext2`
# drives it directly.
exclude = ["tests/pjdfstest", "kernel/fuzz", "userspace/std_hello"]
exclude = ["tests/pjdfstest", "kernel/fuzz", "tests/userspace/std_hello"]
resolver = "2"

[workspace.package]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/RFC/0009-std-on-vibix.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Key choices:
#### vibix_abi crate structure

```
userspace/vibix_abi/
base/vibix_abi/
├── Cargo.toml # #![no_std], no deps
└── src/
├── lib.rs # pub mod syscall, alloc, thread, ...
Expand All @@ -268,7 +268,7 @@ userspace/vibix_abi/
#### vibix_libc crate structure

```
userspace/vibix_libc/
base/vibix_libc/
├── Cargo.toml # cdylib + staticlib, depends on vibix_abi
├── cbindgen.toml # generates libc-compatible C headers
└── src/
Expand Down Expand Up @@ -599,7 +599,7 @@ Porting it to vibix would give immediate ecosystem compatibility.
musl introduces 100K lines of C that must be audited, cross-compiled,
and maintained. The Rust-based approach (`vibix_libc`) is smaller,
memory-safe, and can share syscall stubs with `vibix_abi`. The
`ld-musl-x86_64.so.1` already present in `userspace/lib/` was
`ld-musl-x86_64.so.1` already present in `base/lib/` was
shipped for PT_INTERP testing (#762), not as a long-term libc
strategy.

Expand Down
4 changes: 2 additions & 2 deletions docs/design/dst-478-investigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on the failure being scheduler-driven rather than hardware-fault-driven.
[#478](https://github.com/dburkart/vibix/issues/478)'s production
evidence is unambiguous about the failure shape: the kernel emits
`init: iretq to ring-3` to the serial port, then **no userspace output
ever appears**. In particular, the `userspace/init/src/main.rs::_start`
ever appears**. In particular, the `base/init/src/main.rs::_start`
diagnostic markers `init: pre-write marker` (a `write(2, …)` immediately
on entry, before any other userspace work) never appear in failing
runs. That makes the failure window strictly the gap between IRETQ
Expand Down Expand Up @@ -175,5 +175,5 @@ analogue of #478.
[`kernel/src/arch/x86_64/syscall.rs`](../../kernel/src/arch/x86_64/syscall.rs)
`jump_to_ring3` — the kernel-side seam the trap-frame surface would
intercept.
- [`userspace/init/src/main.rs`](../../userspace/init/src/main.rs)
- [`base/init/src/main.rs`](../../base/init/src/main.rs)
`_start` (~line 103) — the userspace side of the failure window.
6 changes: 3 additions & 3 deletions docs/repros/fork-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ reproducer.

## What it does

Replaces PID 1 with a userspace binary (`userspace/repro_fork/`) that runs
Replaces PID 1 with a userspace binary (`tests/userspace/repro_fork/`) that runs
a tight `fork → child execve → parent wait4` loop for `CYCLES` iterations
(default 500). Every 50 cycles it writes `repro: cycle K alive` to serial;
every cycle it reads the TSC before and after and prints a watchdog
Expand Down Expand Up @@ -72,7 +72,7 @@ exits 0. Failure: any of —
to a large value for soak runs. (Implemented as `option_env!` inside
the binary, so cargo rebuilds when the value changes.)
- The per-cycle TSC budget is a compile-time constant
(`STALL_TSC_BUDGET` in `userspace/repro_fork/src/main.rs`). Bump it
(`STALL_TSC_BUDGET` in `tests/userspace/repro_fork/src/main.rs`). Bump it
if unaccelerated CI QEMU is hitting spurious watchdog trips on a
healthy kernel.

Expand Down Expand Up @@ -105,7 +105,7 @@ invocation per iteration, with `SOAK_COUNT` iterations per job run
Nightly `schedule` and manual `workflow_dispatch` runs exercise this
path today; the `pull_request` trigger is still gated off while the
fork flake is live (see #517). Changes to this harness — either the
wrapper script or `userspace/repro_fork/` — trigger the workflow's
wrapper script or `tests/userspace/repro_fork/` — trigger the workflow's
path filter so the soak runs on any PR that touches them.

The harness amplifies opportunity to hit the hang; whether it trips
Expand Down
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ hermit-abi = { version = "0.5.0", features = [
], public = true }

[target.'cfg(target_os = "vibix")'.dependencies]
vibix_abi = { path = "../../userspace/vibix_abi", features = [
vibix_abi = { path = "../../base/vibix_abi", features = [
'rustc-dep-of-std',
] }

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ name = "userspace_hello_dyn"
path = "src/main.rs"

[dependencies]
vibix_libc = { path = "../vibix_libc" }
vibix_libc = { path = "../../../base/vibix_libc" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 18 additions & 13 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,13 @@ fn build_userspace_binary(package: &str, link_ld: &str) -> R<PathBuf> {
}

fn build_userspace_init() -> R<PathBuf> {
build_userspace_binary("userspace_init", "userspace/init/link.ld")
build_userspace_binary("userspace_init", "base/init/link.ld")
}

/// Build the hello binary — the exec() target for the fork+exec+wait test.
/// Links at 0x400000 (lower half) just like init so load_user_elf accepts it.
fn build_userspace_hello() -> R<PathBuf> {
build_userspace_binary("userspace_hello", "userspace/hello/link.ld")
build_userspace_binary("userspace_hello", "tests/userspace/hello/link.ld")
}

/// Build the fork-loop reproducer harness (issue #506).
Expand All @@ -592,20 +592,20 @@ fn build_userspace_hello() -> R<PathBuf> {
/// this binary runs a tight fork+exec+wait loop as PID 1 to amplify the
/// ~50 %-rate flake bisected to PR #206 into a deterministic repro.
fn build_userspace_repro_fork() -> R<PathBuf> {
build_userspace_binary("userspace_repro_fork", "userspace/repro_fork/link.ld")
build_userspace_binary("userspace_repro_fork", "tests/userspace/repro_fork/link.ld")
}

/// Build the shell-pipeline integration binary (issue #462).
///
/// Shipped as `userspace_init.elf` when `cargo xtask shell-pipeline` is
/// used — the binary internally simulates `echo foo | cat | wc -c`
/// using pipe2/fork/dup2/close/wait4 and prints `SHELL_PIPELINE_OK: 4`
/// on success. See `userspace/shell_pipeline/src/main.rs` for the
/// on success. See `tests/userspace/shell_pipeline/src/main.rs` for the
/// rationale on why all three pipeline stages live in one binary.
fn build_userspace_shell_pipeline() -> R<PathBuf> {
build_userspace_binary(
"userspace_shell_pipeline",
"userspace/shell_pipeline/link.ld",
"tests/userspace/shell_pipeline/link.ld",
)
}

Expand All @@ -614,7 +614,10 @@ fn build_userspace_shell_pipeline() -> R<PathBuf> {
/// `cargo xtask pjdfstest`. Same link layout as `userspace_init` so
/// the kernel's ELF loader doesn't need any new code paths.
pub(crate) fn build_pjdfstest_runner() -> R<PathBuf> {
build_userspace_binary("pjdfstest_runner", "userspace/pjdfstest_runner/link.ld")
build_userspace_binary(
"pjdfstest_runner",
"tests/userspace/pjdfstest_runner/link.ld",
)
}

/// Build the vibix dynamic linker (`ld-vibix.so`).
Expand All @@ -624,7 +627,7 @@ pub(crate) fn build_pjdfstest_runner() -> R<PathBuf> {
/// Uses `-C relocation-model=pic` and `-C link-arg=-shared` to get
/// position-independent code in a shared-object container.
fn build_ld_vibix() -> R<PathBuf> {
let link_ld = "userspace/ld_vibix/link.ld";
let link_ld = "base/ld_vibix/link.ld";
let rustflags = [
&format!("-C link-arg=-T{link_ld}"),
"-C relocation-model=pic",
Expand Down Expand Up @@ -713,7 +716,7 @@ fn build_libc_so() -> R<PathBuf> {
/// The kernel loads ld-vibix.so and transfers control to it, which then
/// processes relocations and jumps to this binary's entry point.
fn build_userspace_hello_dyn() -> R<PathBuf> {
let link_ld = "userspace/hello_dyn/link.ld";
let link_ld = "tests/userspace/hello_dyn/link.ld";
let rustflags = [
&format!("-C link-arg=-T{link_ld}"),
"-C relocation-model=pic",
Expand Down Expand Up @@ -751,7 +754,7 @@ fn build_userspace_hello_dyn() -> R<PathBuf> {
fn build_userspace_std_hello() -> R<PathBuf> {
let ws = workspace_root();
let target_spec = ws.join(VIBIX_USERSPACE_TARGET);
let manifest = ws.join("userspace/std_hello/Cargo.toml");
let manifest = ws.join("tests/userspace/std_hello/Cargo.toml");
let library_root = ws.join("library");

let target_dir = ws.join("target");
Expand Down Expand Up @@ -1283,7 +1286,7 @@ fn ensure_initrd() -> R<PathBuf> {
// DIRS headers + 4 file headers + (3 small + LDSO_BLOCKS) data blocks + 2 end blocks.
const EXPECTED_SIZE: u64 = (DIRS.len() as u64 + 4 + 3 + LDSO_BLOCKS + 2) * 512;

let ldso_src = workspace_root().join("userspace/lib/ld-musl-x86_64.so.1");
let ldso_src = workspace_root().join("base/lib/ld-musl-x86_64.so.1");

// Size + magic aren't sufficient — changing MOTD_PAYLOAD to another
// equal-or-shorter string would leave the old payload on disk (same
Expand Down Expand Up @@ -1551,7 +1554,7 @@ fn make_iso_inner(
fs::copy(userspace_hello, iso_root.join("boot/userspace_hello.elf"))?;
fs::copy(&initrd, iso_root.join("boot/rootfs.tar"))?;
fs::copy(
workspace_root().join("userspace/lib/ld-musl-x86_64.so.1"),
workspace_root().join("base/lib/ld-musl-x86_64.so.1"),
iso_root.join("boot/ld-musl-x86_64.so.1"),
)?;
// #764: stub dynamic-linker fixture for the dynlinker_stub integration test.
Expand Down Expand Up @@ -2275,7 +2278,7 @@ fn repro_fork_build(opts: &BuildOpts) -> R<PathBuf> {
/// heartbeat-aware watchdog. Issue #506 / epic #501.
///
/// Replaces `/boot/userspace_init.elf` in the ISO with the
/// `userspace_repro_fork` binary (see `userspace/repro_fork/`). That
/// `userspace_repro_fork` binary (see `tests/userspace/repro_fork/`). That
/// binary runs `CYCLES` fork+exec+wait iterations, emitting
/// `repro: cycle K alive` every 50 cycles and `repro: fork loop
/// complete` on success. The loop in this function follows those
Expand Down Expand Up @@ -3687,6 +3690,7 @@ repro: starting fork loop cycles=500 hb=50
fn repro_fork_default_cycles_is_500() {
let source = std::fs::read_to_string(
workspace_root()
.join("tests")
.join("userspace")
.join("repro_fork")
.join("src")
Expand All @@ -3701,7 +3705,7 @@ repro: starting fork loop cycles=500 hb=50
// timing budget / this test."
assert!(
source.contains("None => 500,"),
"userspace/repro_fork/src/main.rs must keep the default CYCLES=500; \
"tests/userspace/repro_fork/src/main.rs must keep the default CYCLES=500; \
if you genuinely need to change this, also update \
.github/workflows/smoke-soak.yml timing budgets and issue #531's context"
);
Expand All @@ -3720,6 +3724,7 @@ repro: starting fork loop cycles=500 hb=50
fn repro_fork_syscall_blocks_clobber_all_sysv_caller_saved() {
let source = std::fs::read_to_string(
workspace_root()
.join("tests")
.join("userspace")
.join("repro_fork")
.join("src")
Expand Down
Loading