[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-6d79d86f9600510e08ad45c72b9d7e664e439e62@git.kernel.org>
Date: Mon, 17 Jun 2019 03:31:49 -0700
From: tip-bot for Christoph Hellwig <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, hpa@...or.com, hch@....de, bp@...e.de,
bigeasy@...utronix.de, x86@...nel.org, riel@...riel.com,
nstange@...e.de, tglx@...utronix.de, mingo@...hat.com,
dave.hansen@...el.com, linux-kernel@...r.kernel.org
Subject: [tip:x86/fpu] x86/fpu: Simplify kernel_fpu_begin()
Commit-ID: 6d79d86f9600510e08ad45c72b9d7e664e439e62
Gitweb: https://git.kernel.org/tip/6d79d86f9600510e08ad45c72b9d7e664e439e62
Author: Christoph Hellwig <hch@....de>
AuthorDate: Tue, 4 Jun 2019 09:15:23 +0200
Committer: Borislav Petkov <bp@...e.de>
CommitDate: Mon, 17 Jun 2019 12:19:49 +0200
x86/fpu: Simplify kernel_fpu_begin()
Merge two helpers into the main function, remove a pointless local
variable and flatten a conditional.
Signed-off-by: Christoph Hellwig <hch@....de>
Signed-off-by: Borislav Petkov <bp@...e.de>
Acked-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Nicolai Stange <nstange@...e.de>
Cc: Rik van Riel <riel@...riel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: x86-ml <x86@...nel.org>
Link: https://lkml.kernel.org/r/20190604071524.12835-3-hch@lst.de
---
arch/x86/kernel/fpu/core.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 8e046068d20f..3f92cfad88f0 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -43,12 +43,6 @@ static DEFINE_PER_CPU(bool, in_kernel_fpu);
*/
DEFINE_PER_CPU(struct fpu *, fpu_fpregs_owner_ctx);
-static void kernel_fpu_disable(void)
-{
- WARN_ON_FPU(this_cpu_read(in_kernel_fpu));
- this_cpu_write(in_kernel_fpu, true);
-}
-
static bool kernel_fpu_disabled(void)
{
return this_cpu_read(in_kernel_fpu);
@@ -88,32 +82,26 @@ bool irq_fpu_usable(void)
}
EXPORT_SYMBOL(irq_fpu_usable);
-static void __kernel_fpu_begin(void)
+void kernel_fpu_begin(void)
{
- struct fpu *fpu = ¤t->thread.fpu;
+ preempt_disable();
WARN_ON_FPU(!irq_fpu_usable());
+ WARN_ON_FPU(this_cpu_read(in_kernel_fpu));
- kernel_fpu_disable();
+ this_cpu_write(in_kernel_fpu, true);
- if (!(current->flags & PF_KTHREAD)) {
- if (!test_thread_flag(TIF_NEED_FPU_LOAD)) {
- set_thread_flag(TIF_NEED_FPU_LOAD);
- /*
- * Ignore return value -- we don't care if reg state
- * is clobbered.
- */
- copy_fpregs_to_fpstate(fpu);
- }
+ if (!(current->flags & PF_KTHREAD) &&
+ !test_thread_flag(TIF_NEED_FPU_LOAD)) {
+ set_thread_flag(TIF_NEED_FPU_LOAD);
+ /*
+ * Ignore return value -- we don't care if reg state
+ * is clobbered.
+ */
+ copy_fpregs_to_fpstate(¤t->thread.fpu);
}
__cpu_invalidate_fpregs_state();
}
-
-void kernel_fpu_begin(void)
-{
- preempt_disable();
- __kernel_fpu_begin();
-}
EXPORT_SYMBOL_GPL(kernel_fpu_begin);
void kernel_fpu_end(void)
Powered by blists - more mailing lists