From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756116AbbCCL2V (ORCPT ); Tue, 3 Mar 2015 06:28:21 -0500 Received: from terminus.zytor.com ([198.137.202.10]:51689 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752689AbbCCL2T (ORCPT ); Tue, 3 Mar 2015 06:28:19 -0500 Date: Tue, 3 Mar 2015 03:28:00 -0800 From: tip-bot for Oleg Nesterov Message-ID: Cc: bp@suse.de, sbsiddha@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, luto@amacapital.net, riel@redhat.com, tglx@linutronix.de, oleg@redhat.com Reply-To: bp@suse.de, sbsiddha@gmail.com, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, luto@amacapital.net, riel@redhat.com, tglx@linutronix.de, oleg@redhat.com In-Reply-To: <20150119185151.GC16427@redhat.com> References: <20150119185151.GC16427@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Always allow FPU in interrupt if use_eager_fpu() Git-Commit-ID: 4b2e762e2e53c721458a83d547b222178bb72a34 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: 4b2e762e2e53c721458a83d547b222178bb72a34 Gitweb: http://git.kernel.org/tip/4b2e762e2e53c721458a83d547b222178bb72a34 Author: Oleg Nesterov AuthorDate: Mon, 19 Jan 2015 19:51:51 +0100 Committer: Borislav Petkov CommitDate: Mon, 23 Feb 2015 15:50:41 +0100 x86/fpu: Always allow FPU in interrupt if use_eager_fpu() The __thread_has_fpu() check in interrupted_kernel_fpu_idle() was needed to prevent the nested kernel_fpu_begin(). Now that we have in_kernel_fpu and !__thread_has_fpu() case in __kernel_fpu_begin() does not depend on use_eager_fpu() (except clts) we can remove it. __thread_has_fpu() can be false even if use_eager_fpu(), but this case does not differ from !use_eager_fpu() case except we should not worry about X86_CR0_TS, __kernel_fpu_begin()/end() will not touch this bit. Note: I think we can kill all irq_fpu_usable() checks except in_kernel_fpu, just we need to record the state of X86_CR0_TS in __kernel_fpu_begin() and conditionalize stts() in __kernel_fpu_end(), but this needs another patch. Signed-off-by: Oleg Nesterov Reviewed-by: Rik van Riel Acked-by: Andy Lutomirski Cc: Linus Torvalds Cc: Suresh Siddha Link: http://lkml.kernel.org/r/20150119185151.GC16427@redhat.com Signed-off-by: Borislav Petkov --- arch/x86/kernel/i387.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index ad3a2a2..8416b5f 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c @@ -41,8 +41,8 @@ void kernel_fpu_enable(void) * be set (so that the clts/stts pair does nothing that is * visible in the interrupted kernel thread). * - * Except for the eagerfpu case when we return 1 unless we've already - * been eager and saved the state in kernel_fpu_begin(). + * Except for the eagerfpu case when we return true; in the likely case + * the thread has FPU but we are not going to set/clear TS. */ static inline bool interrupted_kernel_fpu_idle(void) { @@ -50,7 +50,7 @@ static inline bool interrupted_kernel_fpu_idle(void) return false; if (use_eager_fpu()) - return __thread_has_fpu(current); + return true; return !__thread_has_fpu(current) && (read_cr0() & X86_CR0_TS);