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

Yasushi SHOJI


On Wed, Sep 8, 2021 at 10:23 AM Katsuhiro Suzuki
<katsuhiro@...> wrote:
I have question about newer version of context switching (CONFIG_USE_SWITCH=y).
Does RISC-V support USE_SWITCH?

Newer switching sets NEW thread handle into _current_cpu.current BEFORE calling arch_switch().
This implementation will face a problem in RISC-V environment if thread calls do_swap() explicitly and switch to thread B (use FPU) from thread A (not use FPU) because...
AFAICS, even with v1.11, we are setting `_current` to `new_thread` in
`_Swap()` before calling `_arch_switch()`.
What version are you referring to as "older"?

Why do you `use _current_cpu` at all? `_arch_switch()` or
`arch_switch()` on the main branch takes
both new and old thread handles.


Join to automatically receive all group messages.