public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-xtensa@linux-xtensa.org
Cc: Chris Zankel <chris@zankel.net>,
	Max Filippov <jcmvbkbc@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH] xtensa: don't clear cpenable unconditionally on release
Date: Mon, 26 Nov 2018 16:47:21 -0800	[thread overview]
Message-ID: <20181127004721.27244-1-jcmvbkbc@gmail.com> (raw)

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

             reply	other threads:[~2018-11-27 11:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27  0:47 Max Filippov [this message]
2018-11-27  1:27 ` [PATCH] xtensa: don't clear cpenable unconditionally on release Max Filippov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181127004721.27244-1-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=chris@zankel.net \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox