From 3f0cf6e683b94ce1fb18beb2b1a8bc5cf8cb0f9d Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Tue, 30 Jun 2020 21:44:36 +0100 Subject: [PATCH] runtime: Stop kernel CPU before restarting comms CPU on panic Before, the system would enter a boot loop when a panic occurred while the kernel CPU was active (and panic_reset == 1), as kernel::start() for the startup kernel would panic. --- RELEASE_NOTES.rst | 2 ++ artiq/firmware/runtime/main.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index bdc55724d..3a9a6d21a 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -21,6 +21,8 @@ Highlights: be brought up Ctrl-P (Ctrl+Return to immediately submit the selected entry with the default arguments). * Experiment results are now always saved to HDF5, even if run() fails. +* Core device: ``panic_reset 1`` now correctly resets the kernel CPU as well if + communication CPU panic occurs. Breaking changes: diff --git a/artiq/firmware/runtime/main.rs b/artiq/firmware/runtime/main.rs index b40c0d097..fda9d37ba 100644 --- a/artiq/firmware/runtime/main.rs +++ b/artiq/firmware/runtime/main.rs @@ -323,7 +323,10 @@ pub fn panic_impl(info: &core::panic::PanicInfo) -> ! { if config::read_str("panic_reset", |r| r == Ok("1")) { println!("restarting..."); - unsafe { boot::reset() } + unsafe { + kernel::stop(); + boot::reset(); + } } else { println!("halting."); println!("use `artiq_coremgmt config write -s panic_reset 1` to restart instead");