Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3538070imu; Wed, 7 Nov 2018 11:53:10 -0800 (PST) X-Google-Smtp-Source: AJdET5eO5JbAhFyvzPy8T2XZX86XrrHnluPRPvm2Zd45iSDW7KOseAFlj44KdUs6vEWjCH25Yjuj X-Received: by 2002:a17:902:bf49:: with SMTP id u9-v6mr1642679pls.10.1541620390475; Wed, 07 Nov 2018 11:53:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541620390; cv=none; d=google.com; s=arc-20160816; b=XzwW0SIXHWUUV2yKBkX3mxMLN/sJJWMCFTQEuQ+Nrze19GcB1w/V0c8GiwiAv1bte/ L9JtflzGs0Tnj+CLZbRifek5AbNvNy0/JZ29ABMblq+bl5k8vNZOfUy+XLcj6PZpI6NH G1JLr6JNjlAv31vRb08KCnirW7odS4L2mGrGtVFmnRs/KAB/0fGBEjpeDI/+gqdf99fK UUjeVGBpGD+VihP+bD4EpNECpBbhFehhUOVPcIOjn5unHYFU0FDHLjnPjtNHwnnhNKp9 xDPuOdiaT5zWagDVyp5ReHeVAdSc6PpVZHjVTAGym2WZFnZ53slr1ASwBGroGGhEWUEF hySg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=u0CCbmUwQf0zIIR3n0FHoSED9grc08VkaQZBlrZQHT0=; b=PbN6xkPBuIXlcpY4/9yDach72DZO9wMpV2Umizo2u7rOHPYQk66FFuoeMKt2GQbaa0 v52EHxY9wNWY0uvE3xnYa9DKmNeLacijHkFYFtQX8F6PpFPPQTlcyfyg9yG+uOBDlAjz KfMh73X8PmMKqcyRm19U0e8sR+5jaa07tg97as1DRSc1+eGXb6Aes6SIr+wDuVBi6xWl ohqCHsitSg0mNteC04L4HybQAQYpjOWMwzec8TGWRzqDSK6Topjl6eDJOBtfp/xWLfBR ig2ZwxNmcxxPFqa3ABihrx4mWbyv1aHam3u8dDLJlqEqubug+owyPAkdnKCvEDUZ4vhX C6mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si1451408pgv.397.2018.11.07.11.52.55; Wed, 07 Nov 2018 11:53:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbeKHFVD (ORCPT + 99 others); Thu, 8 Nov 2018 00:21:03 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:41831 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbeKHFVC (ORCPT ); Thu, 8 Nov 2018 00:21:02 -0500 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1gKTp6-00070Q-3X; Wed, 07 Nov 2018 20:49:08 +0100 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Andy Lutomirski , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , kvm@vger.kernel.org, "Jason A. Donenfeld" , Rik van Riel , Dave Hansen , Sebastian Andrzej Siewior Subject: [PATCH 03/23] x86/fpu: Remove fpu__restore() Date: Wed, 7 Nov 2018 20:48:38 +0100 Message-Id: <20181107194858.9380-4-bigeasy@linutronix.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107194858.9380-1-bigeasy@linutronix.de> References: <20181107194858.9380-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no users of fpu__restore() so it is time to remove it. The comment regarding fpu__restore() and TS bit is stale since commit b3b0870ef3ffe ("i387: do not preload FPU state at task switch time") and has no meaning since. Signed-off-by: Sebastian Andrzej Siewior --- Documentation/preempt-locking.txt | 1 - arch/x86/include/asm/fpu/internal.h | 1 - arch/x86/kernel/fpu/core.c | 24 ------------------------ arch/x86/kernel/process_32.c | 4 +--- arch/x86/kernel/process_64.c | 4 +--- 5 files changed, 2 insertions(+), 32 deletions(-) diff --git a/Documentation/preempt-locking.txt b/Documentation/preempt-locking.txt index 509f5a422d571..dce336134e54a 100644 --- a/Documentation/preempt-locking.txt +++ b/Documentation/preempt-locking.txt @@ -52,7 +52,6 @@ preemption must be disabled around such regions. Note, some FPU functions are already explicitly preempt safe. For example, kernel_fpu_begin and kernel_fpu_end will disable and enable preemption. -However, fpu__restore() must be called with preemption disabled. RULE #3: Lock acquire and release must be performed by same task diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 5f7290e6e954e..32ea458f13b5c 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -28,7 +28,6 @@ extern void fpu__initialize(struct fpu *fpu); extern void fpu__prepare_read(struct fpu *fpu); extern void fpu__prepare_write(struct fpu *fpu); extern void fpu__save(struct fpu *fpu); -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 2ea85b32421a0..9387e0fec7d17 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -305,30 +305,6 @@ void fpu__prepare_write(struct fpu *fpu) } } -/* - * 'fpu__restore()' is called to copy FPU registers from - * the FPU fpstate to the live hw registers and to activate - * access to the hardware registers, so that FPU instructions - * can be used afterwards. - * - * Must be called with kernel preemption disabled (for example - * with local interrupts disabled, as it is in the case of - * do_device_not_available()). - */ -void fpu__restore(struct fpu *fpu) -{ - fpu__initialize(fpu); - - /* Avoid __kernel_fpu_begin() right after fpregs_activate() */ - kernel_fpu_disable(); - trace_x86_fpu_before_restore(fpu); - fpregs_activate(fpu); - copy_kernel_to_fpregs(&fpu->state); - trace_x86_fpu_after_restore(fpu); - kernel_fpu_enable(); -} -EXPORT_SYMBOL_GPL(fpu__restore); - /* * Drops current FPU state: deactivates the fpregs and * the fpstate. NOTE: it still leaves previous contents diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 5046a3c9dec2f..d9510452b69a6 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -274,9 +274,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) /* * Leave lazy mode, flushing any hypercalls made here. * This must be done before restoring TLS segments so - * the GDT and LDT are properly updated, and must be - * done before fpu__restore(), so the TS bit is up - * to date. + * the GDT and LDT are properly updated. */ arch_end_context_switch(next_p); diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 0e0b4288a4b2b..cf2c157714594 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -576,9 +576,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) /* * Leave lazy mode, flushing any hypercalls made here. This * must be done after loading TLS entries in the GDT but before - * loading segments that might reference them, and and it must - * be done before fpu__restore(), so the TS bit is up to - * date. + * loading segments that might reference them. */ arch_end_context_switch(next_p); -- 2.19.1