From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753407AbbBSLd4 (ORCPT ); Thu, 19 Feb 2015 06:33:56 -0500 Received: from terminus.zytor.com ([198.137.202.10]:53063 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753385AbbBSLdz (ORCPT ); Thu, 19 Feb 2015 06:33:55 -0500 Date: Thu, 19 Feb 2015 03:33:32 -0800 From: tip-bot for Rik van Riel Message-ID: Cc: linux-kernel@vger.kernel.org, riel@redhat.com, torvalds@linux-foundation.org, mingo@kernel.org, tglx@linutronix.de, bp@suse.de, oleg@redhat.com, hpa@zytor.com Reply-To: linux-kernel@vger.kernel.org, riel@redhat.com, tglx@linutronix.de, bp@suse.de, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, oleg@redhat.com In-Reply-To: <1423252925-14451-6-git-send-email-riel@redhat.com> References: <1423252925-14451-6-git-send-email-riel@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Introduce task_disable_lazy_fpu_restore() helper Git-Commit-ID: 33e03dedd759cc9396252d9641b25d01909a26bb X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 33e03dedd759cc9396252d9641b25d01909a26bb Gitweb: http://git.kernel.org/tip/33e03dedd759cc9396252d9641b25d01909a26bb Author: Rik van Riel AuthorDate: Fri, 6 Feb 2015 15:02:02 -0500 Committer: Borislav Petkov CommitDate: Thu, 19 Feb 2015 11:15:53 +0100 x86/fpu: Introduce task_disable_lazy_fpu_restore() helper Currently there are a few magic assignments sprinkled through the code that disable lazy FPU state restoring, some more effective than others, and all equally mystifying. It would be easier to have a helper to explicitly disable lazy FPU state restoring for a task. Signed-off-by: Rik van Riel Cc: Linus Torvalds Cc: Oleg Nesterov Link: http://lkml.kernel.org/r/1423252925-14451-6-git-send-email-riel@redhat.com Signed-off-by: Borislav Petkov --- arch/x86/include/asm/fpu-internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h index 217d6d7..9c27f44 100644 --- a/arch/x86/include/asm/fpu-internal.h +++ b/arch/x86/include/asm/fpu-internal.h @@ -79,6 +79,16 @@ static inline void __cpu_disable_lazy_restore(unsigned int cpu) per_cpu(fpu_owner_task, cpu) = NULL; } +/* + * Used to indicate that the FPU state in memory is newer than the FPU + * state in registers, and the FPU state should be reloaded next time the + * task is run. Only safe on the current task, or non-running tasks. + */ +static inline void task_disable_lazy_fpu_restore(struct task_struct *tsk) +{ + tsk->thread.fpu.last_cpu = ~0; +} + static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu) { return new == this_cpu_read_stable(fpu_owner_task) &&