How much NEON state should be saved in a context switch? (xilinx zynq)

Stephen Tether tether at slac.stanford.edu
Fri Jan 16 23:22:47 UTC 2015


We have an RTEMS application that makes heavy use of the SIMD features 
of the NEON on a Cortex-A9; without them the speed degrades by a factor 
of 15. This is hand-written assembler code using integer and logical 
vector operations, not compiler-generated floating-point code.

So far only one coder is using the NEON in one task. Others would like 
to use the NEON, for example in networking code, but can only do so 
safely if context switches handle NEON state correctly.

I see that RTEMS can be built with NEON/VFP3-D32 support but when I look 
at the context switching function I find that it saves and restores only 
registers D8-D15. That doesn't seem like enough to me; wouldn't we need 
to save and restore all 32 registers if a context switch can occur at 
any time and if code using NEON makes use of all the registers?

I know that D8-D15 are the registers that must be preserved across 
function calls according to the ABI, but saving/restoring just those 
registers on a context switch would seem to work only if all tasks were 
non-preemptable. In that case I believe that context switches would 
occur only inside functions such as yield(), sleep(), blocking I/O, etc.

- Steve Tether



More information about the users mailing list