an aborted attempt at doing a clean-shutdown for hosted mode

This doesn't work because the shutdown call destroys all the servers then terminates
the processes. But, the problem is that the processes are still
running, but servers are disappearing. So what you end up with is a
panic when the first message gets delivered to a server that no longer
exists, and then you end up with the program hanging on that panic
because some servers haven't been destroyed/exited yet and are now
just spinning waiting to be scheduled. so the call works in the tidy
kernel test cases but to get it to work on a full OS you'd need to
have a way to put every server into an eternal blocking state before
making the shutdown call (to prevent new messages from being issued
while servers are going away), which is more work than i'm willing to
put into the problem right now.
This commit is contained in:
bunnie 2022-03-31 01:10:58 +08:00
parent 52f1afa780
commit 8b5ad2657b
2 changed files with 19 additions and 0 deletions

View file

@ -546,6 +546,17 @@ pub(crate) fn ci_tests(pddb_os: &mut PddbOs) -> Result<()> {
list_all(pddb_os, &mut basis_cache);
log::info!("CI done");
/*
// abortive attempt to get CI to exit cleanly
#[cfg(not(any(target_os = "none", target_os = "xous")))]
{
let xns = xous_names::XousNames::new().unwrap();
let susres = susres::Susres::new_without_hook(&xns).unwrap();
susres.initiate_suspend().expect("couldn't initiate suspend op");
//xous::rsyscall(xous::SysCall::Shutdown).expect("unable to quit");
}*/
Ok(())
}
}

View file

@ -835,6 +835,14 @@ fn unhook(cb_conns: &mut Vec::<ScalarCallback>) {
fn send_event(cb_conns: &Vec::<ScalarCallback>, order: crate::api::SuspendOrder) -> (bool, crate::api::SuspendOrder) {
let mut at_least_one_event_sent = false;
log::info!("Sending suspend to {:?} stage", order);
/*
// abortive attempt to get suspend to shut down the system. Doesn't work, results in a panic because too many messages are still moving around.
#[cfg(not(any(target_os = "none", target_os = "xous")))]
{
if order == crate::api::SuspendOrder::Last {
xous::rsyscall(xous::SysCall::Shutdown).expect("unable to quit");
}
}*/
for scb in cb_conns.iter() {
if scb.order == order {
at_least_one_event_sent = true;