xtensa: don't clear cpenable unconditionally on release
Subsystems (2)
Max Filippov
maintainerPATCH 1/1 xtensa: don't clear cpenable unconditionally on release
fast_coprocessor exception handler expects that the coprocessor owner task never gets the "coprocessor disabled" exception for a coprocessor that is marked as enabled in the thread_info::cpenable. If that happens it will reload potentially outdated context from the thread_info structure into the coprocessor registers.
Only call coprocessor_clear_cpenable from the coprocessor_release_all if the latter is called for the current task.
--- arch/xtensa/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/kernel/process.c +2 -1
@@ -87,7 +87,8 @@ void coprocessor_release_all(struct thread_info *ti) } ti->cpenable = cpenable; -coprocessor_clear_cpenable (); +if (ti ==current_thread_info ()) +coprocessor_clear_cpenable ();preempt_enable (); }
Signature · 1 line
2.11.0
Max Filippov
maintainerQuoted 6 lines · Max Filippov
fast_coprocessorexception handler expects that the coprocessor owner task never gets the "coprocessor disabled" exception for a coprocessor that is marked as enabled in thethread_info::cpenable. If that happens it will reload potentially outdated context from thethread_infostructure into the coprocessor registers.
After looking at it some more I see that the above is not true. It will flush current coprocessor context to the thread_info and then load it back from there. No correctness issue, but some extra work that can be avoided.
Signature · 2 lines
Thanks. -- Max