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
1 change: 0 additions & 1 deletion quest/m0/nightly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Public API: none. Wire: none.

## Required

- [Log eviction passes the ARM concurrency model](/quest/m0/nightly/log-eviction.md) - the log eviction model passes on ARM and x86, with every segment access protected from reclamation
- [The software renderer tests both capability paths](/quest/m0/nightly/render-capabilities.md) - the software-renderer lane verifies output selection with and without DMA-BUF import support without requiring hardware the runner lacks
- [Shipping size history admits the generated C package](/quest/m0/nightly/shipping-history.md) - nightly measures the generated C shipping archives while preserving comparable existing size history and refusing missing or renamed artifacts
- [The browser publisher completes its fairness sweep](/quest/m0/nightly/publisher-fairness.md) - the publisher fairness benchmark completes its backlog on the hosted ARM runner, yielding browser tasks while serving every group
Expand Down
24 changes: 0 additions & 24 deletions quest/m0/nightly/log-eviction.md

This file was deleted.

28 changes: 25 additions & 3 deletions rs/kio/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::{
use crossbeam_epoch as epoch;
use smallvec::SmallVec;

use crate::sync::{Arc, AtomicPtr, AtomicU64, AtomicUsize, UnsafeCell};
use crate::sync::{Arc, AtomicPtr, AtomicU64, AtomicUsize, UnsafeCell, fence};

/// Slots in the first segment: one, since many logs never hold more.
const FIRST_SEGMENT: usize = 1;
Expand Down Expand Up @@ -442,7 +442,7 @@ impl<T> Reader<T> {
}
Read {
reader: self,
_guard: guard,
_guard: ReadGuard { _pin: guard },
}
}
}
Expand Down Expand Up @@ -470,7 +470,29 @@ impl<T> fmt::Debug for Reader<T> {
/// drop it before parking.
pub struct Read<'a, T> {
reader: &'a mut Reader<T>,
_guard: epoch::Guard,
_guard: ReadGuard,
}

/// The pin behind a [`Read`], released only after the read's accesses.
///
/// A wrapper rather than a `Drop` on `Read` itself, which would hold the `Reader` borrow
/// until the end of the scope instead of the last use.
struct ReadGuard {
_pin: epoch::Guard,
}

impl Drop for ReadGuard {
/// Order the read's accesses before whatever the thread pins next, then unpin.
///
/// The collector frees a segment once it sees every thread unpinned or pinned anew,
/// and the free must happen after the reads it waited out. Seeing the unpin, a
/// Release store, orders them. Seeing a later pin may not: off x86, crossbeam-epoch
/// 0.9 pins with a Relaxed store, which carries nothing of the pin before it. This
/// fence makes every later store to the thread's epoch carry these reads to the
/// collector's Acquire fence. On x86 it compiles to nothing.
fn drop(&mut self) {
fence(Ordering::Release);
}
}

impl<T> Read<'_, T> {
Expand Down
5 changes: 5 additions & 0 deletions rs/kio/src/loom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ fn a_log_append_wakes_a_reader_parked_on_its_channel() {
/// read it isn't ordered after fails the model. The reader keeps a hint into the first
/// segment from an earlier read, which the eviction may free before its next one.
///
/// Only an ARM run checks the release at the end of each read: off x86, crossbeam-epoch
/// pins with a Relaxed store, so a collector that sees the reader's second pin is
/// ordered after its first pin's reads only through that release. On x86 its SeqCst CAS
/// orders them anyway.
///
/// The collector's own atomics run under loom too (`crossbeam_loom`), which makes the
/// full search intractable, so this one bounds preemptions like moq-net's models.
#[test]
Expand Down
4 changes: 2 additions & 2 deletions rs/kio/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ pub(crate) use loom::{
cell::UnsafeCell,
sync::{
Arc, Mutex, MutexGuard,
atomic::{AtomicBool, AtomicPtr, AtomicU64, AtomicUsize},
atomic::{AtomicBool, AtomicPtr, AtomicU64, AtomicUsize, fence},
},
};
#[cfg(not(loom))]
pub(crate) use std::sync::{
Arc, Mutex, MutexGuard,
atomic::{AtomicBool, AtomicPtr, AtomicU64, AtomicUsize},
atomic::{AtomicBool, AtomicPtr, AtomicU64, AtomicUsize, fence},
};

/// `std::cell::UnsafeCell` behind loom's closure API, so loom can check every access.
Expand Down
Loading