From be38e4f2cc08d91515b86a4a8ea75ba902795873 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Mon, 26 Nov 2018 16:30:51 -0800 Subject: [PATCH] xtensa: don't clear cpenable unconditionally on release Clearing cpenable special register for a task without changing coprocessor owner for the coprocessors that were enabled will result in coprocessor context flush and immediate reload at the next attempt to access this coprocessor if it happens before the context switch. Avoid it by only clearing cpenable special register if coprocessor_release_all is called for the current task. Signed-off-by: Max Filippov --- arch/xtensa/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index be9e0c3..27be75e 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c @@ -87,7 +87,8 @@ void coprocessor_release_all(struct thread_info *ti) } ti->cpenable = cpenable; - xtensa_set_sr(0, cpenable); + if (ti == current_thread_info()) + xtensa_set_sr(0, cpenable); preempt_enable(); } -- 2.7.4