idle kernel changes: run on startup, flashing new kernel after startup #276

Merged
sb10q merged 2 commits from srenblad/artiq-zynq:idle_kernel_rework_simple into master 2024-08-05 19:28:10 +08:00
Contributor

idle kernel changes: run on startup, flashing new kernel after startup

Relevant issue: https://github.com/m-labs/artiq/issues/2246

The idle kernel does not run automatically after booting after startup kernel has exited.

Proposed fix:

  • Start an additional task before entering main loop, terminate on first experiment connection.

Testing

  • Smoke tested on Kasli-SoC v1.1 standalone variant
  1. Flashed and power-cycled board.
  2. Idle kernel starts after startup kernel finishes (no startup kernel in this test)
  3. Run experiment.
  4. Idle kernel runs after experiment.
### idle kernel changes: run on startup, flashing new kernel after startup Relevant issue: https://github.com/m-labs/artiq/issues/2246 > The idle kernel does not run automatically after booting after startup kernel has exited. Proposed fix: + Start an additional task before entering main loop, terminate on first experiment connection. #### Testing + [x] Smoke tested on Kasli-SoC v1.1 standalone variant 1. Flashed and power-cycled board. 2. Idle kernel starts after startup kernel finishes (no startup kernel in this test) 3. Run experiment. 4. Idle kernel runs after experiment.
esavkin reviewed 2023-11-01 15:56:58 +08:00
@ -727,0 +733,4 @@
let up_destinations = up_destinations.clone();
let aux_mutex = aux_mutex.clone();
let routing_table = drtio_routing_table.clone();
async move {
Owner

isn't there a way to reuse the idle kernel start-up code?

isn't there a way to reuse the idle kernel start-up code?
Author
Contributor

there might be, let me have a look!

there might be, let me have a look!
srenblad marked this conversation as resolved
srenblad force-pushed idle_kernel_rework_simple from d77f141c3c to 1ab13f5799 2023-11-02 12:21:35 +08:00 Compare
Author
Contributor

@esavkin see latest push reusing startup and idle kernel code.

@esavkin see latest push reusing startup and idle kernel code.
Owner

@esavkin see latest push reusing startup and idle kernel code.

Looks fine to me, except the wording. The new function is not exactly flashing. I would say it better be some verb, that would represent something like starting the kernel from config.
Let's wait for other reviews.

> @esavkin see latest push reusing startup and idle kernel code. Looks fine to me, except the wording. The new function is not exactly flashing. I would say it better be some verb, that would represent something like `starting the kernel from config`. Let's wait for other reviews.
srenblad changed title from runtime.comms.rs: run idle kernel on start-up to idle kernel changes: run on startup, flashing new kernel after startup 2023-11-02 13:01:31 +08:00
Author
Contributor

Looks fine to me, except the wording. The new function is not exactly flashing.

I don't think the flash_kernel_worker in session.rs does either. If I was to guess, I would say the original naming is based on the fact that it loads from the flash (ie config) not that it flashes. host_kernel_worker does the same thing but for experiment runs.

> Looks fine to me, except the wording. The new function is not exactly flashing. I don't think the `flash_kernel_worker` in session.rs does either. If I was to guess, I would say the original naming is based on the fact that it loads from the flash (ie config) not that it flashes. `host_kernel_worker` does the same thing but for experiment runs.
sb10q reviewed 2023-11-07 13:50:07 +08:00
@ -641,0 +652,4 @@
info!("Loading {}", config_key);
let _ = load_kernel(&buffer, &control, None)
.await.map_err(|_| warn!("Error loading {}", config_key));
info!("Running idle kernel");
Owner

It's not always the idle.

It's not always the idle.
srenblad marked this conversation as resolved
srenblad changed title from idle kernel changes: run on startup, flashing new kernel after startup to WIP: idle kernel changes: run on startup, flashing new kernel after startup 2024-03-01 14:44:34 +08:00
srenblad force-pushed idle_kernel_rework_simple from 1ab13f5799 to ff2e95c35e 2024-03-06 11:10:44 +08:00 Compare
srenblad force-pushed idle_kernel_rework_simple from ff2e95c35e to 16b0d258c5 2024-03-06 12:03:39 +08:00 Compare
srenblad changed title from WIP: idle kernel changes: run on startup, flashing new kernel after startup to idle kernel changes: run on startup, flashing new kernel after startup 2024-03-06 15:11:37 +08:00
sb10q reviewed 2024-07-31 17:29:05 +08:00
@ -721,0 +727,4 @@
timer: GlobalTimer,
) {
info!("Loading idle kernel");
let res = handle_flash_kernel(buffer, control, up_destinations, aux_mutex, routing_table, timer)
Owner

formatting

formatting
srenblad marked this conversation as resolved
sb10q reviewed 2024-07-31 17:29:37 +08:00
@ -721,0 +730,4 @@
let res = handle_flash_kernel(buffer, control, up_destinations, aux_mutex, routing_table, timer)
.await;
match res {
#[cfg(has_drtio)]
Owner

Why does this need to be aware of DRTIO?

DRTIO link status is to be handled manually by the user in idle kernels

Why does this need to be aware of DRTIO? DRTIO link status is to be handled manually by the user in idle kernels
Author
Contributor

Added in #279. Inspecting handle_flash_kernel reveals this Error indeed does not occur for idle kernels.

@mwojcik safe to remove?

Added in #279. Inspecting `handle_flash_kernel` reveals this Error indeed does not occur for idle kernels. @mwojcik safe to remove?
Owner

It was there to ensure that DRTIO was fully set up before a startup kernel would run. It could take a considerable while for all required destinations to start. With an idle kernel that can run on startup as well, I would recommend keeping it.

It was there to ensure that DRTIO was fully set up before a startup kernel would run. It could take a considerable while for all required destinations to start. With an idle kernel that can run on startup as well, I would recommend keeping it.
Owner

This is for the user to handle. That's why we have an API for it. The behavior hardcoded here of waiting for 1 second is messy and not applicable to all use cases.

This is for the user to handle. That's why we have an API for it. The behavior hardcoded here of waiting for 1 second is messy and not applicable to all use cases.
Owner

Since all subkernels are distributed before the kernel starts (to reduce load and latency when the kernels are actually running), that doesn't give the user an opportunity to act accordingly. However, since idle kernels will be retried and restarted until they can finally run, this check could be removed here.

Since all subkernels are distributed before the kernel starts (to reduce load and latency when the kernels are actually running), that doesn't give the user an opportunity to act accordingly. However, since idle kernels will be retried and restarted until they can finally run, this check could be removed here.
Owner

Idle subkernels and startup subkernels need to be flashed into their respective satellites. I think I mentioned this already.

Idle subkernels and startup subkernels need to be flashed into their respective satellites. I think I mentioned this already.
Owner

Oh then it would make perfect sense, but that's feasible only after artiq#2498 is implemented. So to get this PR merged before that, let's remove that part.

Oh then it would make perfect sense, but that's feasible only after [artiq#2498](https://github.com/m-labs/artiq/issues/2498) is implemented. So to get this PR merged before that, let's remove that part.
srenblad force-pushed idle_kernel_rework_simple from 16b0d258c5 to 456935c9aa 2024-08-01 17:06:18 +08:00 Compare
srenblad changed title from idle kernel changes: run on startup, flashing new kernel after startup to WIP: idle kernel changes: run on startup, flashing new kernel after startup 2024-08-01 17:28:05 +08:00
Author
Contributor

Did not pass testing after changes, marking as WIP until resolved.

Did not pass testing after changes, marking as WIP until resolved.
srenblad changed title from WIP: idle kernel changes: run on startup, flashing new kernel after startup to idle kernel changes: run on startup, flashing new kernel after startup 2024-08-02 11:15:44 +08:00
Author
Contributor

Did not pass testing after changes, marking as WIP until resolved.

It was a user issue on my end and not a fault of firmware. Successfully tested blinky and idle kernel runs before and after experiment kernels. Ready to merge, assuming no further comments.

> Did not pass testing after changes, marking as WIP until resolved. It was a user issue on my end and not a fault of firmware. Successfully tested blinky and idle kernel runs before and after experiment kernels. Ready to merge, assuming no further comments.
sb10q merged commit fad1db9796 into master 2024-08-05 19:28:10 +08:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/artiq-zynq#276
No description provided.