Skip to content

Commit f521fa0

Browse files
authored
Merge pull request rust-lang#4272 from geetanshjuneja/scheduling
Make thread scheduling fully random
2 parents 63edce0 + 76992ce commit f521fa0

File tree

76 files changed

+111
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+111
-92
lines changed

src/tools/miri/src/bin/miri.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ fn main() {
573573
miri_config.mute_stdout_stderr = true;
574574
} else if arg == "-Zmiri-retag-fields" {
575575
miri_config.retag_fields = RetagFields::Yes;
576+
} else if arg == "-Zmiri-fixed-schedule" {
577+
miri_config.fixed_scheduling = true;
576578
} else if let Some(retag_fields) = arg.strip_prefix("-Zmiri-retag-fields=") {
577579
miri_config.retag_fields = match retag_fields {
578580
"all" => RetagFields::Yes,

src/tools/miri/src/concurrency/thread.rs

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::task::Poll;
66
use std::time::{Duration, SystemTime};
77

88
use either::Either;
9+
use rand::rngs::StdRng;
10+
use rand::seq::IteratorRandom;
911
use rustc_abi::ExternAbi;
1012
use rustc_const_eval::CTRL_C_RECEIVED;
1113
use rustc_data_structures::fx::FxHashMap;
@@ -401,6 +403,8 @@ pub struct ThreadManager<'tcx> {
401403
thread_local_allocs: FxHashMap<(DefId, ThreadId), StrictPointer>,
402404
/// A flag that indicates that we should change the active thread.
403405
yield_active_thread: bool,
406+
/// A flag that indicates that we should do round robin scheduling of threads else randomized scheduling is used.
407+
fixed_scheduling: bool,
404408
}
405409

406410
impl VisitProvenance for ThreadManager<'_> {
@@ -410,6 +414,7 @@ impl VisitProvenance for ThreadManager<'_> {
410414
thread_local_allocs,
411415
active_thread: _,
412416
yield_active_thread: _,
417+
fixed_scheduling: _,
413418
} = self;
414419

415420
for thread in threads {
@@ -421,8 +426,8 @@ impl VisitProvenance for ThreadManager<'_> {
421426
}
422427
}
423428

424-
impl<'tcx> Default for ThreadManager<'tcx> {
425-
fn default() -> Self {
429+
impl<'tcx> ThreadManager<'tcx> {
430+
pub(crate) fn new(config: &MiriConfig) -> Self {
426431
let mut threads = IndexVec::new();
427432
// Create the main thread and add it to the list of threads.
428433
threads.push(Thread::new(Some("main"), None));
@@ -431,11 +436,10 @@ impl<'tcx> Default for ThreadManager<'tcx> {
431436
threads,
432437
thread_local_allocs: Default::default(),
433438
yield_active_thread: false,
439+
fixed_scheduling: config.fixed_scheduling,
434440
}
435441
}
436-
}
437442

438-
impl<'tcx> ThreadManager<'tcx> {
439443
pub(crate) fn init(
440444
ecx: &mut MiriInterpCx<'tcx>,
441445
on_main_stack_empty: StackEmptyCallback<'tcx>,
@@ -702,7 +706,11 @@ impl<'tcx> ThreadManager<'tcx> {
702706
/// used in stateless model checkers such as Loom: run the active thread as
703707
/// long as we can and switch only when we have to (the active thread was
704708
/// blocked, terminated, or has explicitly asked to be preempted).
705-
fn schedule(&mut self, clock: &MonotonicClock) -> InterpResult<'tcx, SchedulingAction> {
709+
fn schedule(
710+
&mut self,
711+
clock: &MonotonicClock,
712+
rng: &mut StdRng,
713+
) -> InterpResult<'tcx, SchedulingAction> {
706714
// This thread and the program can keep going.
707715
if self.threads[self.active_thread].state.is_enabled() && !self.yield_active_thread {
708716
// The currently active thread is still enabled, just continue with it.
@@ -720,30 +728,33 @@ impl<'tcx> ThreadManager<'tcx> {
720728
}
721729
// No callbacks immediately scheduled, pick a regular thread to execute.
722730
// The active thread blocked or yielded. So we go search for another enabled thread.
723-
// Crucially, we start searching at the current active thread ID, rather than at 0, since we
724-
// want to avoid always scheduling threads 0 and 1 without ever making progress in thread 2.
725-
//
726-
// `skip(N)` means we start iterating at thread N, so we skip 1 more to start just *after*
727-
// the active thread. Then after that we look at `take(N)`, i.e., the threads *before* the
728-
// active thread.
729-
let threads = self
731+
// We build the list of threads by starting with the threads after the current one, followed by
732+
// the threads before the current one and then the current thread itself (i.e., this iterator acts
733+
// like `threads.rotate_left(self.active_thread.index() + 1)`. This ensures that if we pick the first
734+
// eligible thread, we do regular round-robin scheduling, and all threads get a chance to take a step.
735+
let mut threads_iter = self
730736
.threads
731737
.iter_enumerated()
732738
.skip(self.active_thread.index() + 1)
733-
.chain(self.threads.iter_enumerated().take(self.active_thread.index()));
734-
for (id, thread) in threads {
735-
debug_assert_ne!(self.active_thread, id);
736-
if thread.state.is_enabled() {
739+
.chain(self.threads.iter_enumerated().take(self.active_thread.index() + 1))
740+
.filter(|(_id, thread)| thread.state.is_enabled());
741+
// Pick a new thread, and switch to it.
742+
let new_thread =
743+
if self.fixed_scheduling { threads_iter.next() } else { threads_iter.choose(rng) };
744+
745+
if let Some((id, _thread)) = new_thread {
746+
if self.active_thread != id {
737747
info!(
738748
"---------- Now executing on thread `{}` (previous: `{}`) ----------------------------------------",
739749
self.get_thread_display_name(id),
740750
self.get_thread_display_name(self.active_thread)
741751
);
742752
self.active_thread = id;
743-
break;
744753
}
745754
}
755+
// This completes the `yield`, if any was requested.
746756
self.yield_active_thread = false;
757+
747758
if self.threads[self.active_thread].state.is_enabled() {
748759
return interp_ok(SchedulingAction::ExecuteStep);
749760
}
@@ -1138,7 +1149,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11381149
use rand::Rng as _;
11391150

11401151
let this = self.eval_context_mut();
1141-
if this.machine.rng.get_mut().random_bool(this.machine.preemption_rate) {
1152+
if !this.machine.threads.fixed_scheduling
1153+
&& this.machine.rng.get_mut().random_bool(this.machine.preemption_rate)
1154+
{
11421155
this.yield_active_thread();
11431156
}
11441157
}
@@ -1152,7 +1165,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11521165
this.machine.handle_abnormal_termination();
11531166
throw_machine_stop!(TerminationInfo::Interrupted);
11541167
}
1155-
match this.machine.threads.schedule(&this.machine.monotonic_clock)? {
1168+
let rng = this.machine.rng.get_mut();
1169+
match this.machine.threads.schedule(&this.machine.monotonic_clock, rng)? {
11561170
SchedulingAction::ExecuteStep => {
11571171
if !this.step()? {
11581172
// See if this thread can do something else.

src/tools/miri/src/eval.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ pub struct MiriConfig {
163163
pub address_reuse_rate: f64,
164164
/// Probability for address reuse across threads.
165165
pub address_reuse_cross_thread_rate: f64,
166+
/// Round Robin scheduling with no preemption.
167+
pub fixed_scheduling: bool,
166168
}
167169

168170
impl Default for MiriConfig {
@@ -200,6 +202,7 @@ impl Default for MiriConfig {
200202
collect_leak_backtraces: true,
201203
address_reuse_rate: 0.5,
202204
address_reuse_cross_thread_rate: 0.1,
205+
fixed_scheduling: false,
203206
}
204207
}
205208
}

src/tools/miri/src/machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl<'tcx> MiriMachine<'tcx> {
669669
cpu_affinity::MAX_CPUS,
670670
config.num_cpus
671671
);
672-
let threads = ThreadManager::default();
672+
let threads = ThreadManager::new(config);
673673
let mut thread_cpu_affinity = FxHashMap::default();
674674
if matches!(&*tcx.sess.target.os, "linux" | "freebsd" | "android") {
675675
thread_cpu_affinity

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ignore-target: windows # No pthreads on Windows
22
// We are making scheduler assumptions here.
3-
//@compile-flags: -Zmiri-preemption-rate=0
3+
//@compile-flags: -Zmiri-fixed-schedule
44

55
// Joining itself is undefined behavior.
66

src/tools/miri/tests/fail-dep/concurrency/windows_join_main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@only-target: windows # Uses win32 api functions
22
// We are making scheduler assumptions here.
3-
//@compile-flags: -Zmiri-preemption-rate=0
3+
//@compile-flags: -Zmiri-fixed-schedule
44
//@error-in-other-file: deadlock
55

66
// On windows, joining main is not UB, but it will block a thread forever.

src/tools/miri/tests/fail-dep/concurrency/windows_join_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@only-target: windows # Uses win32 api functions
22
// We are making scheduler assumptions here.
3-
//@compile-flags: -Zmiri-preemption-rate=0
3+
//@compile-flags: -Zmiri-fixed-schedule
44
//@error-in-other-file: deadlock
55

66
// On windows, a thread joining itself is not UB, but it will deadlock.

src/tools/miri/tests/fail-dep/libc/env-set_var-data-race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0
1+
//@compile-flags: -Zmiri-disable-isolation -Zmiri-fixed-schedule
22
//@ignore-target: windows # No libc env support on Windows
33

44
use std::{env, thread};

src/tools/miri/tests/fail-dep/libc/eventfd_block_read_twice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@only-target: linux android illumos
22
//~^ERROR: deadlocked
33
//~^^ERROR: deadlocked
4-
//@compile-flags: -Zmiri-preemption-rate=0
4+
//@compile-flags: -Zmiri-fixed-schedule
55
//@error-in-other-file: deadlock
66

77
use std::thread;

src/tools/miri/tests/fail-dep/libc/eventfd_block_write_twice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@only-target: linux android illumos
22
//~^ERROR: deadlocked
33
//~^^ERROR: deadlocked
4-
//@compile-flags: -Zmiri-preemption-rate=0
4+
//@compile-flags: -Zmiri-fixed-schedule
55
//@error-in-other-file: deadlock
66

77
use std::thread;

src/tools/miri/tests/fail-dep/libc/libc-epoll-data-race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! to be considered synchronized.
55
//@only-target: linux android illumos
66
// ensure deterministic schedule
7-
//@compile-flags: -Zmiri-preemption-rate=0
7+
//@compile-flags: -Zmiri-fixed-schedule
88

99
use std::convert::TryInto;
1010
use std::thread;

src/tools/miri/tests/fail-dep/libc/libc_epoll_block_two_thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-preemption-rate=0
1+
//@compile-flags: -Zmiri-fixed-schedule
22
//~^ERROR: deadlocked
33
//~^^ERROR: deadlocked
44
//@only-target: linux android illumos

src/tools/miri/tests/fail-dep/libc/socketpair-close-while-blocked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! faulty logic around `release_clock` that led to this code not reporting a data race.
33
//~^^ERROR: deadlock
44
//@ignore-target: windows # no libc socketpair on Windows
5-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-address-reuse-rate=0
5+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-address-reuse-rate=0
66
//@error-in-other-file: deadlock
77
use std::thread;
88

src/tools/miri/tests/fail-dep/libc/socketpair-data-race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This is a regression test for <https://github.com/rust-lang/miri/issues/3947>: we had some
22
//! faulty logic around `release_clock` that led to this code not reporting a data race.
33
//@ignore-target: windows # no libc socketpair on Windows
4-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-address-reuse-rate=0
4+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-address-reuse-rate=0
55
use std::thread;
66

77
fn main() {

src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//~^ERROR: deadlocked
33
//~^^ERROR: deadlocked
44
// test_race depends on a deterministic schedule.
5-
//@compile-flags: -Zmiri-preemption-rate=0
5+
//@compile-flags: -Zmiri-fixed-schedule
66
//@error-in-other-file: deadlock
77

88
use std::thread;

src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//~^ERROR: deadlocked
33
//~^^ERROR: deadlocked
44
// test_race depends on a deterministic schedule.
5-
//@compile-flags: -Zmiri-preemption-rate=0
5+
//@compile-flags: -Zmiri-fixed-schedule
66
//@error-in-other-file: deadlock
77

88
use std::thread;

src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Make sure that a retag acts like a write for the data race model.
22
//@revisions: stack tree
3-
//@compile-flags: -Zmiri-preemption-rate=0
3+
//@compile-flags: -Zmiri-fixed-schedule
44
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
55
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
66
//@[tree]compile-flags: -Zmiri-tree-borrows

src/tools/miri/tests/fail/data_race/alloc_read_race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
1+
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
22
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
33
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
44

src/tools/miri/tests/fail/data_race/alloc_write_race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
1+
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
22
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
33
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
44

src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dangling_thread_race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
1+
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
22
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
33
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
44

src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
1+
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
22
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
33
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
44

src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/fence_after_load.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// We want to control preemption here. Stacked borrows interferes by having its own accesses.
2-
//@compile-flags: -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2+
//@compile-flags: -Zmiri-fixed-schedule -Zmiri-disable-stacked-borrows
33
// Avoid accidental synchronization via address reuse inside `thread::spawn`.
44
//@compile-flags: -Zmiri-address-reuse-cross-thread-rate=0
55

src/tools/miri/tests/fail/data_race/local_variable_alloc_race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@compile-flags: -Zmiri-preemption-rate=0.0 -Zmiri-disable-weak-memory-emulation
1+
//@compile-flags:-Zmiri-fixed-schedule -Zmiri-disable-weak-memory-emulation
22
#![feature(core_intrinsics)]
33
#![feature(custom_mir)]
44

0 commit comments

Comments
 (0)