Skip to content

Commit

Permalink
Update from nightly-2023-11-11 to nightly-2024-07-28
Browse files Browse the repository at this point in the history
Reviewed By: dtolnay

Differential Revision: D60429169

fbshipit-source-id: 88f497d7484951800194cf3a1b7623c81b4d63f8
  • Loading branch information
zertosh authored and facebook-github-bot committed Jul 30, 2024
1 parent 63e4bd2 commit c8b5189
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 84 deletions.
3 changes: 1 addition & 2 deletions detcore-model/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ impl GlobalTime {
let newtime = newtime - self.starting_nanos;
trace!(
"[tid {}] ticked its global time component to {}",
tid,
newtime,
tid, newtime,
);
if let Some(old) = self.time_vector.insert(tid, newtime) {
if old > newtime {
Expand Down
23 changes: 6 additions & 17 deletions detcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ impl<T: RecordOrReplay> Detcore<T> {
} else {
trace!(
"[detcore, dtid {}] Refusing to record zero-braches event: {:?}",
&ev.dettid,
ev
&ev.dettid, ev
);
}
if !precise_branch {
Expand Down Expand Up @@ -254,9 +253,7 @@ impl<T: RecordOrReplay> Detcore<T> {
if slice_end < now_ns {
trace!(
"prehook [dtid {}] Time {} is beyond end of slice {}",
dettid,
now_ns,
slice_end
dettid, now_ns, slice_end
);
self.end_timeslice(guest).await;
}
Expand Down Expand Up @@ -295,9 +292,7 @@ impl<T: RecordOrReplay> Detcore<T> {
// Rather, we go back to the scheduler and wait for our turn again.
trace!(
"posthook [dtid {}] Time {} beyond (or close enough to) end of slice {}! Ending slice.",
dettid,
current_time,
slice_end
dettid, current_time, slice_end
);
let current_slice = guest.thread_state().stats.timeslice_count;
self.end_timeslice(guest).await;
Expand All @@ -309,10 +304,7 @@ impl<T: RecordOrReplay> Detcore<T> {
let current_time = guest.thread_state().thread_logical_time.as_nanos();
trace!(
"posthook [dtid {}] after ending timeslice T{}, next end is {}, current time {}",
dettid,
current_slice,
slice_end,
current_time,
dettid, current_slice, slice_end, current_time,
);
}
if current_time + epsilon > slice_end {
Expand Down Expand Up @@ -345,9 +337,7 @@ impl<T: RecordOrReplay> Detcore<T> {

trace!(
"posthook [dtid {}] After time consumed by handler/injection, {} remaining in slice ({} rcbs).",
dettid,
ns_remaining,
rcbs_remaining,
dettid, ns_remaining, rcbs_remaining,
);

if ns_remaining.is_zero() {
Expand Down Expand Up @@ -615,8 +605,7 @@ impl<T: RecordOrReplay> Tool for Detcore<T> {
let nanos = time.as_nanos();
trace!(
"[dtid {}] inbound cpuid, new logical time: {:?}",
dettid,
time
dettid, time
);
if self.cfg.should_trace_schedevent() {
trace_schedevent(
Expand Down
39 changes: 11 additions & 28 deletions detcore/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,9 +1038,7 @@ impl Scheduler {
let pos = self.runqueue_push_back(waiterid);
trace!(
"[detcore] Woke one thread, dtid: {}, ivar {:p}, scheduled at position {}",
&waiterid,
&waiter_ivar,
pos,
&waiterid, &waiter_ivar, pos,
);
let nxt = self
.next_turns
Expand Down Expand Up @@ -1447,8 +1445,7 @@ impl Scheduler {
{
trace!(
"[sched-step3] queue {:?}, io-blocked {:?}, next_turns: ",
&self.run_queue,
self.blocked.external_io_blockers
&self.run_queue, self.blocked.external_io_blockers
);
for (dtid, nxt) in self.next_turns.iter() {
trace!(" ==> dtid {}, req {}, resp {}", dtid, nxt.req, nxt.resp);
Expand Down Expand Up @@ -1479,8 +1476,7 @@ impl Scheduler {
assert!(self.run_queue.remove_tid(dettid)); // Deschedule while we wait.
trace!(
"[dtid {}] after removal, run queue: {:?}",
dettid,
&self.run_queue
dettid, &self.run_queue
);
self.skip_turn()
}
Expand Down Expand Up @@ -1521,8 +1517,7 @@ impl Scheduler {
.push_poller(dettid, self.get_priority(dettid), rs.poll_attempt);
trace!(
"[dtid {}] after deprioritizing polling request, run queue: {:?}",
dettid,
&self.run_queue
dettid, &self.run_queue
);
self.upgrade_polled_to_runnable(dettid, rs); // Indicate the thread gets to run next time
self.skip_turn()
Expand Down Expand Up @@ -1560,9 +1555,7 @@ impl Scheduler {
debug_assert!(req.try_read().unwrap().is_ok()); // Ivar should be full
trace!(
"[dtid {}] Upgrading polled resource request in {} to runnable non-polled in {}",
dettid,
req,
runnable_req
dettid, req, runnable_req
);
*req = runnable_req;
}
Expand All @@ -1580,17 +1573,13 @@ impl Scheduler {
if *target_ns <= self.committed_time {
trace!(
"[dtid {}] time-based action ready to execute, target time {} is before committed global time {}",
dettid,
target_ns,
self.committed_time
dettid, target_ns, self.committed_time
);
Ok(())
} else {
trace!(
"[dtid {}] time-based action not ready yet, registering waiter at future time {}. Current time is {}",
dettid,
target_ns,
self.committed_time
dettid, target_ns, self.committed_time
);
info!(
"[scheduler] >>>>>>>\n\n NONCOMMIT turn {}, SKIP dettid {} which wanted resource {:?} (blocking)",
Expand Down Expand Up @@ -1674,9 +1663,7 @@ impl Scheduler {
}
trace!(
"[dettid {}] requeue: Priority mapping after change to priority {}: {:?}",
dettid,
new_priority,
self.priorities
dettid, new_priority, self.priorities
);
}

Expand Down Expand Up @@ -1717,18 +1704,15 @@ impl Scheduler {
self.runqueue_push_back(dettid); // Repush with new priority
trace!(
"[dettid {}] changepoint: Priority mapping after change to priority {}: {:?}",
dettid,
new_priority,
self.priorities
dettid, new_priority, self.priorities
);

// Update request to be empty so the thread is unconditionally
// runnable when it next comes up in the queue.
let empty_req = Ivar::full(Ok(Resources::new(dettid)));
trace!(
"[dettid {}] Priority change point emplaced empty resource request at new {}",
dettid,
empty_req
dettid, empty_req
);
self.next_turns
.get_mut(&dettid)
Expand Down Expand Up @@ -1879,8 +1863,7 @@ impl Scheduler {
self.turn += 1;
trace!(
"[sched-step5] Guest unblocking (via {}); clear ivars for the next turn on dettid {}",
&resp,
&dtid
&resp, &dtid
);
let sig = self.is_signal_inbound(dtid); // Peek before we clear the ivars.
self.clear_nextturn(dtid);
Expand Down
7 changes: 2 additions & 5 deletions detcore/src/syscalls/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ impl<T: RecordOrReplay> Detcore<T> {
let init_val = guest.memory().read_value(ptr)?;
trace!(
"[detcore, dtid {}] futex op with memory address containing value {}",
&dettid,
init_val
&dettid, init_val
);

if !self.cfg.sequentialize_threads {
Expand Down Expand Up @@ -242,9 +241,7 @@ impl<T: RecordOrReplay> Detcore<T> {
let observed = guest.memory().read_value(ptr).unwrap();
trace!(
"[detcore, dtid {}] after (emulated) futex wait, memory value is {}, expected {}",
&dettid,
observed,
expected,
&dettid, observed, expected,
);
if expected == observed {
debug!(
Expand Down
6 changes: 2 additions & 4 deletions detcore/src/syscalls/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ impl<T: RecordOrReplay> Detcore<T> {
let request = Self::sleep_request(guest, time).await;
trace!(
"nanosleep adding delta {:?} to yield request {:?}",
time,
&request
time, &request
);
Self::wait_and_return(guest, request, call).await
} else {
Expand All @@ -246,8 +245,7 @@ impl<T: RecordOrReplay> Detcore<T> {
let request = Self::sleep_request_abs(guest, target_time).await;
trace!(
"nanosleep setting absolute time {:?} to yield request {:?}",
target_time,
&request
target_time, &request
);
Self::wait_and_return(guest, request, call).await
} else {
Expand Down
40 changes: 12 additions & 28 deletions detcore/src/tool_global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,17 +523,14 @@ impl GlobalState {
}).clone();
trace!(
"[detcore, dtid {}] ResourceRequest, filling request into {}",
&dettid,
&nextturn.req
&dettid, &nextturn.req
);
sched.request_put(&nextturn.req, rs.clone(), &self.global_time);
nextturn.resp
};
trace!(
"[detcore, dtid {}] waiting on {} for resources: {:?}",
dettid,
&resp2,
rs
dettid, &resp2, rs
);
let answer = resp2.get().await; // Block on the scheduler allowing our guest to proceed.
if rs.resources.contains_key(&ResourceID::Exit(true)) {
Expand Down Expand Up @@ -564,8 +561,7 @@ impl GlobalState {
SchedResponse::Go(Some(schedval)) => {
trace!(
"[dtid {}] resources granted, resuming normally: {:?}",
dettid,
rs
dettid, rs
);

let endtime_update = match schedval {
Expand Down Expand Up @@ -747,8 +743,7 @@ impl GlobalState {
Entry::Occupied(entry) => {
trace!(
"[detcore, dtid {}] handling StartNewThread rpc. Found next_turns entry (after {} tries)",
from,
tries
from, tries
);
entry.get().clone()
}
Expand Down Expand Up @@ -848,8 +843,7 @@ impl GlobalState {
SchedResponse::Go(answer) => {
trace!(
"[detcore, dtid {}] Unblocked from futex_wait! ({})",
&dettid,
&response_iv
&dettid, &response_iv
);
answer
}
Expand All @@ -872,10 +866,7 @@ impl GlobalState {
.add_inode(ino, LogicalTime::from_nanos(nanos));
trace!(
"[detcore, dtid {}] resolved (raw) inode {:?} to {:?}, mtime {}",
from,
ino,
dino,
ns
from, ino, dino, ns
);
(dino, ns)
}
Expand All @@ -899,9 +890,7 @@ impl GlobalState {
};
trace!(
"[dtid {}] bumping mtime on file (rawinode {:?}) to {}",
from,
ino,
mtime,
from, ino, mtime,
);
let mut mg = self.inodes.lock().unwrap();
let dino =
Expand Down Expand Up @@ -958,8 +947,7 @@ impl GlobalState {
} = self.sched.lock().unwrap().consume_schedevent(&ev);
trace!(
"keep_running :{}, end_of_timeslice: {:?}",
keep_running,
end_of_timeslice
keep_running, end_of_timeslice
);
let print_stack2 = self.record_event(&ev);

Expand Down Expand Up @@ -993,8 +981,7 @@ impl GlobalState {
if let Some(sig) = &self.cfg.stacktrace_signal {
trace!(
"[dtid {}] signaling thread with {} at the point of stack trace printing.",
ev.dettid,
sig.0
ev.dettid, sig.0
);
let tid = Pid::from_raw(ev.dettid.as_raw());
// TODO(T78538674): virtualize pid/tid:
Expand Down Expand Up @@ -1185,17 +1172,15 @@ where
let detpid = guest.thread_state().detpid.expect("detpid unset");
trace!(
"[detcore, dtid {}] BLOCKING on resource_request rpc... {:?}",
&dettid,
r
&dettid, r
);
let resp =
send_and_update_time(guest, GlobalRequest::RequestResources(r.clone(), detpid)).await;
match resp.1 {
GlobalResponse::RequestResources(x) => {
trace!(
"[detcore, dtid {}] UNBLOCKED, acquired resources: {:?}",
&dettid,
r
&dettid, r
);
x
}
Expand Down Expand Up @@ -1507,8 +1492,7 @@ where
.expect("memory read succeeds");
trace!(
"Tracing sched event, after which rip is {}, next two instruction bytes {:#06x}",
rip,
rip_contents
rip, rip_contents
);
}

Expand Down

0 comments on commit c8b5189

Please sign in to comment.