mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add facility to help debug stalled suspend/resume
This commit is contained in:
parent
424f8feab7
commit
058e3480df
2 changed files with 19 additions and 2 deletions
|
|
@ -154,12 +154,17 @@ impl Drop for Susres {
|
||||||
|
|
||||||
fn suspend_cb_server(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
|
fn suspend_cb_server(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
|
||||||
let sid = xous::SID::from_u32(sid0 as u32, sid1 as u32, sid2 as u32, sid3 as u32);
|
let sid = xous::SID::from_u32(sid0 as u32, sid1 as u32, sid2 as u32, sid3 as u32);
|
||||||
|
let mut print_once = false;
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(sid).unwrap();
|
let msg = xous::receive_message(sid).unwrap();
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
match FromPrimitive::from_usize(msg.body.id()) {
|
||||||
Some(SuspendEventCallback::Event) => msg_scalar_unpack!(msg, cid, id, token, _, {
|
Some(SuspendEventCallback::Event) => msg_scalar_unpack!(msg, cid, id, token, _, {
|
||||||
// directly pass the scalar message onto the CID with the ID memorized in the original hook
|
// directly pass the scalar message onto the CID with the ID memorized in the original hook
|
||||||
log::debug!("PID {} has s/r token {}", xous::current_pid().unwrap().get(), token); // <-- use this to debug s/r
|
if !print_once {
|
||||||
|
// dump this only once so we have a PID->token map in the debug logs, but don't dump it every time as it slows down the suspend
|
||||||
|
log::info!("PID {} has s/r token {}", xous::current_pid().unwrap().get(), token); // <-- use this to debug s/r
|
||||||
|
print_once = true;
|
||||||
|
}
|
||||||
send_message(cid as u32,
|
send_message(cid as u32,
|
||||||
Message::new_scalar(id, token, 0, 0, 0)
|
Message::new_scalar(id, token, 0, 0, 0)
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -738,7 +738,19 @@ fn xmain() -> ! {
|
||||||
}
|
}
|
||||||
timeout_pending = false;
|
timeout_pending = false;
|
||||||
log::warn!("Suspend timed out, forcing an unclean suspend");
|
log::warn!("Suspend timed out, forcing an unclean suspend");
|
||||||
// susres_hw.debug_delay(500); // let the messages print
|
for sub in suspend_subscribers.iter() {
|
||||||
|
if sub.order == current_op_order {
|
||||||
|
if !sub.ready_to_suspend {
|
||||||
|
// note to debugger: you will get a token number, which is in itself not useful.
|
||||||
|
// There should be, at least once in the debug log, printed on the very first suspend cycle,
|
||||||
|
// a list of PID->tokens. Tokens are assigned in the order that the registration happens
|
||||||
|
// to the susres server. Empirically, this list is generally stable for every build,
|
||||||
|
// and is guaranteed to be stable across a single cold boot.
|
||||||
|
log::warn!(" -> NOT READY: {}", sub.token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
susres_hw.debug_delay(500); // let the messages print
|
||||||
// force a suspend
|
// force a suspend
|
||||||
susres_hw.do_suspend(true);
|
susres_hw.do_suspend(true);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue