Skip to content

Commit

Permalink
Add help information to the diagnostics for livelock.
Browse files Browse the repository at this point in the history
  • Loading branch information
JCTyblaidd committed Dec 14, 2020
1 parent d89c057 commit f7dbd02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ pub fn report_error<'tcx, 'mir>(
format!("this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental"),
format!("see {} for further information", url),
],
Livelock => vec![
format!("All thread yields or spin loop hints are used to dynamically generated watch sets to detect livelock and avoid unnecessary spins in spin-loops."),
format!("If this should not have reported a livelock then it may help to change the maximum number of spurious wakes from yields with no progress."),
format!("Pass the argument `-Zmiri-max-yield-iterations=<count>` to change this value."),
format!("The current value is {}, a value of 0 will allow an unlimited number of spurious wakes.", ecx.thread_yield_get_max_spurious_wake())
],
_ => vec![],
};
(title, helps)
Expand Down
8 changes: 8 additions & 0 deletions src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,4 +1117,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let this = self.eval_context_mut();
this.machine.threads.thread_yield_atomic_watch(alloc_id, alloc_size, offset, len);
}

/// Return the configuration for the maximum number of spurious wake events
/// from thread yields. Used for diagnostics.
#[inline]
fn thread_yield_get_max_spurious_wake(&self) -> u32 {
let this = self.eval_context_ref();
this.machine.threads.max_yield_count
}
}

0 comments on commit f7dbd02

Please sign in to comment.