Re: Why do_swap() sets cpu.current before context switch?


Katsuhiro Suzuki
 

Hello,

On 2021/09/09 1:14, Andy Ross wrote:
On 9/8/2021 8:08 AM, Katsuhiro Suzuki wrote:
RISC-V's FPU arch has the flag to permit/forbid using FPU. In Zephyr, this flag is set to
forbid side if thread was declared as not using FPU. And CPU raise interrupt when using
any FPU instruction at FPU forbidden state.
Can't you just check that flag in the context switch code?  It seems like that would be faster on average (most DSP workloads try very hard to avoid doing synchronous context switches to avoid the need to spill all that state), and have much better latency guarantees (taking an exception is REALLY expensive!).
I can check it directly. I think this is future work to achieve more faster switching
than now. At this point, I want to implement most conservative one..


Andy
Best Regards,
Katsuhiro Suzuki

Join devel@lists.zephyrproject.org to automatically receive all group messages.