mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
To: <catalin.marinas@arm.com>, <will.deacon@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>, <jianhua.ljh@gmail.com>,
	<orson.zhai@spreadtrum.com>, <xiongshan.an@spreadtrum.com>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] arm64: fix bug for reloading FPSIMD state after execve on cpu 0.
Date: Wed, 26 Aug 2015 10:40:41 +0800	[thread overview]
Message-ID: <1440556841-17219-1-git-send-email-chunyan.zhang@spreadtrum.com> (raw)

From: Janet Liu <janet.liu@spreadtrum.com>

If process A is running on CPU 0 and do execve syscall and after sched_exec,
dest_cpu is 0, fpsimd_state.cpu is 0. If at the time Process A get scheduled
out and after some kernel threads running on CPU 0, process A is back in CPU 0,
A's fpsimd_state.cpu is current cpu id "0", and per_cpu(fpsimd_last_state)
points A's fpsimd_state, TIF_FOREIGN_FPSTATE will be clear, kernel will not
reload the context during it return to userspace. so set the cpu's
fpsimd_last_state to NULL to avoid this.

Signed-off-by: Janet Liu <janet.liu@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
---
 arch/arm64/kernel/fpsimd.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 44d6f75..ec58d94 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -159,6 +159,7 @@ void fpsimd_flush_thread(void)
 {
 	memset(&current->thread.fpsimd_state, 0, sizeof(struct fpsimd_state));
 	set_thread_flag(TIF_FOREIGN_FPSTATE);
+	this_cpu_write(fpsimd_last_state, NULL);
 }
 
 /*
-- 
1.7.9.5


             reply	other threads:[~2015-08-26  2:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26  2:40 Chunyan Zhang [this message]
2015-08-26 11:12 ` Will Deacon
2015-08-26 11:32   ` Ard Biesheuvel
2015-08-26 11:39     ` Will Deacon
2015-08-27  2:43     ` Jianhua Liu
2015-08-26 12:02   ` Jianhua Liu

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=1440556841-17219-1-git-send-email-chunyan.zhang@spreadtrum.com \
    --to=chunyan.zhang@spreadtrum.com \
    --cc=catalin.marinas@arm.com \
    --cc=jianhua.ljh@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orson.zhai@spreadtrum.com \
    --cc=will.deacon@arm.com \
    --cc=xiongshan.an@spreadtrum.com \
    /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

all inboxes | Powered by JetHome®