Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756228AbbHZCpM (ORCPT ); Tue, 25 Aug 2015 22:45:12 -0400 Received: from sci-ig2.spreadtrum.com ([222.66.158.135]:49894 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754987AbbHZCpK (ORCPT ); Tue, 25 Aug 2015 22:45:10 -0400 From: Chunyan Zhang To: , CC: , , , , Subject: [PATCH] arm64: fix bug for reloading FPSIMD state after execve on cpu 0. Date: Wed, 26 Aug 2015 10:40:41 +0800 Message-ID: <1440556841-17219-1-git-send-email-chunyan.zhang@spreadtrum.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-MAIL: SHSQR01.spreadtrum.com t7Q2epDF058298 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1366 Lines: 36 From: Janet Liu 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 Signed-off-by: Chunyan Zhang --- 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(¤t->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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/