Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762366AbbEESB5 (ORCPT ); Tue, 5 May 2015 14:01:57 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:37316 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992880AbbEESAE (ORCPT ); Tue, 5 May 2015 14:00:04 -0400 From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Borislav Petkov , Dave Hansen , Fenghua Yu , "H. Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner Subject: [PATCH 204/208] x86/fpu: Pass 'struct fpu' to fpu__restore() Date: Tue, 5 May 2015 19:58:28 +0200 Message-Id: <1430848712-28064-44-git-send-email-mingo@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430848712-28064-1-git-send-email-mingo@kernel.org> References: <1430848712-28064-1-git-send-email-mingo@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4022 Lines: 115 This cleans up the call sites and the function a bit, and also makes it more symmetric with the other high level FPU state handling functions. It's still only valid for the current task, as we copy to the FPU registers of the current CPU. No change in functionality. Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/x86/include/asm/fpu/internal.h | 2 +- arch/x86/kernel/fpu/core.c | 9 +++------ arch/x86/kernel/fpu/signal.c | 2 +- arch/x86/kernel/traps.c | 2 +- drivers/lguest/x86/core.c | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 7fdc90b9dd86..a4c1b7dbf70e 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -50,7 +50,7 @@ extern int fpu__exception_code(struct fpu *fpu, int trap_nr); extern void fpu__activate_curr(struct fpu *fpu); extern void fpu__activate_stopped(struct fpu *fpu); extern void fpu__save(struct fpu *fpu); -extern void fpu__restore(void); +extern void fpu__restore(struct fpu *fpu); extern int fpu__restore_sig(void __user *buf, int ia32_frame); extern void fpu__drop(struct fpu *fpu); extern int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu); diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 843901f10754..421a98103820 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -343,11 +343,8 @@ void fpu__activate_stopped(struct fpu *child_fpu) * with local interrupts disabled, as it is in the case of * do_device_not_available()). */ -void fpu__restore(void) +void fpu__restore(struct fpu *fpu) { - struct task_struct *tsk = current; - struct fpu *fpu = &tsk->thread.fpu; - fpu__activate_curr(fpu); /* Avoid __kernel_fpu_begin() right after fpregs_activate() */ @@ -355,9 +352,9 @@ void fpu__restore(void) fpregs_activate(fpu); if (unlikely(copy_fpstate_to_fpregs(fpu))) { fpu__clear(fpu); - force_sig_info(SIGSEGV, SEND_SIG_PRIV, tsk); + force_sig_info(SIGSEGV, SEND_SIG_PRIV, current); } else { - tsk->thread.fpu.counter++; + fpu->counter++; } kernel_fpu_enable(); } diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c index 99f73093333d..50ec9af1bd51 100644 --- a/arch/x86/kernel/fpu/signal.c +++ b/arch/x86/kernel/fpu/signal.c @@ -319,7 +319,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) fpu->fpstate_active = 1; if (use_eager_fpu()) { preempt_disable(); - fpu__restore(); + fpu__restore(fpu); preempt_enable(); } diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 6f581c65c648..a2510f230195 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -803,7 +803,7 @@ do_device_not_available(struct pt_regs *regs, long error_code) return; } #endif - fpu__restore(); /* interrupts still off */ + fpu__restore(¤t->thread.fpu); /* interrupts still off */ #ifdef CONFIG_X86_32 conditional_sti(regs); #endif diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 99bb3009e2d5..6a4cd771a2be 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c @@ -302,7 +302,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu) * before this. */ else if (cpu->regs->trapnum == 7 && !fpregs_active()) - fpu__restore(); + fpu__restore(¤t->thread.fpu); } /*H:130 -- 2.1.0 -- 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/