Use MMU for context switch #451
Reference in New Issue
Block a user
Delete Branch "mwojcik/artiq-zynq:mmu_context_switch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Replacing library rebinds for switching between normal RTIO/DMA/batch mode with virtual address remapping.
The good:
It works. Library rebinds are not necessary anymore. Even leads to some DMA benchmarks improving a little in hitl tests.
The bad:
OVERLAYcannot be used as it doesn't allow pointer operations (that I use to keep two functions at constant offsets).OVERLAYis nicely supported by default checks, but doing it manually required--no-check-sections- which may be a potential footgun. Documented yes, but I can imagine it wouldn't be obvious for someone tinkering with the linker script.The ugly:
api.KEEP(*(...))did not work - I believe LLVM compiling Rust discarded these functions before they reached linker's garbage collection.Further improvements (not a part of this PR):
zynq-rsThe overhead didn't matter that much as it's a small part of the whole process, but on its own, it's a difference of one or two orders of magnitude - especially for batch since it is a pretty light switch, DMA has to do some extra core0 comms (actually I think it's possible to make it faster still - give some extra heap space for DMA, we could manage the data almost fully within core1, DDMA break-apart handled on context manager exit). The benchmark tests added in m-labs/artiq#1736 show a rather stark comparison:
MMU remap:
test_dma_record_overhead ... 3.9295200000000025e-06 s
test_acpki_batch_overhead ... 9.408800000000002e-07 s
Library rebind:
test_dma_record_overhead ... 5.525568000000001e-05 s
test_acpki_batch_overhead ... 2.9776880000000005e-05 s