refactor(userspace): split syscall/fat16/ext4 by concern; trim comments
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
//! SMP self-test, run only when the disk carries `smptest.elf` (the test
|
||||
//! image built by `make test-qemu`). It checks on real harts what host
|
||||
//! tests cannot: that unmapping a page and killing a process take effect
|
||||
//! on every other hart before the call returns.
|
||||
//!
|
||||
//! A spinner process runs one thread per hart, each incrementing its own
|
||||
//! counter in a page init also maps. Init then cuts the spinner off
|
||||
//! (revoking its copy of the page, or killing it) and requires that no
|
||||
//! counter moves afterwards: a stale TLB entry or a thread left running
|
||||
//! on another hart would keep counting.
|
||||
//! SMP self-test, run when the disk carries `smptest.elf`: after revoking a
|
||||
//! spinner's page or killing it, no spinner counter may move on any hart.
|
||||
|
||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||
use libkos::fs::Storage;
|
||||
@@ -17,7 +9,6 @@ use types::bounded::{CapSlot, PageCount};
|
||||
use types::mapping::PagePerms;
|
||||
use types::permission::{Permission, PermissionSet};
|
||||
|
||||
/// Where init sees the counter page; same layout as the spinner's.
|
||||
const OBSERVE_VA: usize = 0x0140_0000;
|
||||
const THREADS: usize = 4;
|
||||
/// QEMU virt's timebase is 10 MHz.
|
||||
@@ -79,9 +70,7 @@ fn run_phases(storage: &mut Storage, scratch: &mut [u8]) -> Result<(), &'static
|
||||
syscall::map_region(page, VirtualAddress::from_raw(OBSERVE_VA), PagePerms::ReadWrite)
|
||||
.map_err(|_| "cannot map the counter page")?;
|
||||
|
||||
// 1. Unmapping: revoking the spinner's copy of the page must unmap it
|
||||
// on every hart before Revoke returns. The spinner then faults,
|
||||
// which kills it from whichever hart faults first.
|
||||
// Revoke must unmap the page on every hart; the spinner then faults and dies.
|
||||
let spinner = start_spinner(storage, scratch, page)?;
|
||||
if !syscall::revoke(page) {
|
||||
return Err("revoke failed");
|
||||
@@ -92,8 +81,7 @@ fn run_phases(storage: &mut Storage, scratch: &mut [u8]) -> Result<(), &'static
|
||||
}
|
||||
libkos::println!("smptest: revoke stops every hart: ok");
|
||||
|
||||
// 2. Killing: a process whose threads are running on other harts must
|
||||
// stop everywhere before Kill returns.
|
||||
// Kill must stop threads running on other harts before it returns.
|
||||
let spinner = start_spinner(storage, scratch, page)?;
|
||||
if !syscall::kill(spinner) {
|
||||
return Err("kill failed");
|
||||
|
||||
Reference in New Issue
Block a user