public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xtensa: don't clear cpenable unconditionally on release
@ 2018-11-27  0:47 Max Filippov
  2018-11-27  1:27 ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Max Filippov @ 2018-11-27  0:47 UTC (permalink / raw)
  To: linux-xtensa; +Cc: Chris Zankel, Max Filippov, stable

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.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 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 3fa0c440f664..6c7c80106f60 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;
-	coprocessor_clear_cpenable();
+	if (ti == current_thread_info())
+		coprocessor_clear_cpenable();
 
 	preempt_enable();
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xtensa: don't clear cpenable unconditionally on release
  2018-11-27  0:47 [PATCH] xtensa: don't clear cpenable unconditionally on release Max Filippov
@ 2018-11-27  1:27 ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2018-11-27  1:27 UTC (permalink / raw)
  To: linux-xtensa; +Cc: Chris Zankel, stable

On Mon, Nov 26, 2018 at 4:47 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
>
> 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.

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.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-27 12:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-27  0:47 [PATCH] xtensa: don't clear cpenable unconditionally on release Max Filippov
2018-11-27  1:27 ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox