Ingo Molnar
2d75bcf314
x86/fpu: Move __save_fpu() into fpu/core.c
...
This helper function is only used in fpu/core.c, move it there.
This slightly speeds up compilation.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:27 +02:00
Ingo Molnar
384a23f939
x86/fpu: Use 'struct fpu' in switch_fpu_finish()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:27 +02:00
Ingo Molnar
cb8818b6ac
x86/fpu: Use 'struct fpu' in switch_fpu_prepare()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:27 +02:00
Ingo Molnar
af2d94fddc
x86/fpu: Use 'struct fpu' in fpu_reset_state()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:26 +02:00
Ingo Molnar
11f2d50b10
x86/fpu: Use 'struct fpu' in restore_fpu_checking()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:26 +02:00
Ingo Molnar
66ddc2cb0f
x86/fpu: Use 'struct fpu' in fpu_lazy_restore()
...
Also rename it to fpu_want_lazy_restore(), to better indicate that
this function just tests whether we can do a lazy restore. (The old
name suggested that it was doing the lazy restore, which is not
the case.)
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:26 +02:00
Ingo Molnar
eb6a3251bf
x86/fpu: Remove task_disable_lazy_fpu_restore()
...
Replace task_disable_lazy_fpu_restore() with easier to read
open-coded uses: we already update the fpu->last_cpu field
explicitly in other cases.
(This also removes yet another task_struct using FPU method.)
Better explain the fpu::last_cpu field in the structure definition.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:26 +02:00
Ingo Molnar
ca6787ba0f
x86/fpu: Remove 'struct task_struct' usage from drop_fpu()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:25 +02:00
Ingo Molnar
c5bedc6847
x86/fpu: Get rid of PF_USED_MATH usage, convert it to fpu->fpstate_active
...
Introduce a simple fpu->fpstate_active flag in the fpu context data structure
and use that instead of PF_USED_MATH in task->flags.
Testing for this flag byte should be slightly more efficient than
testing a bit in a bitmask, but the main advantage is that most
FPU functions can now be performed on a 'struct fpu' alone, they
don't need access to 'struct task_struct' anymore.
There's a slight linecount increase, mostly due to the 'fpu' local
variables and due to extra comments. The local variables will go away
once we move most of the FPU methods to pure 'struct fpu' parameters.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:25 +02:00
Ingo Molnar
4c1384100e
x86/fpu: Open code PF_USED_MATH usages
...
PF_USED_MATH is used directly, but also in a handful of helper inlines.
To ease the elimination of PF_USED_MATH, convert all inline helpers
to open-coded PF_USED_MATH usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:24 +02:00
Ingo Molnar
4540d3faa7
x86/fpu: Remove 'struct task_struct' usage from __thread_fpu_begin()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:24 +02:00
Ingo Molnar
35191e3f07
x86/fpu: Remove 'struct task_struct' usage from __thread_fpu_end()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:24 +02:00
Ingo Molnar
c0311f63e3
x86/fpu: Remove 'struct task_struct' usage from __thread_set_has_fpu()
...
Migrate this function to pure 'struct fpu' usage.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:23 +02:00
Ingo Molnar
36b544dcd3
x86/fpu: Change fpu_owner_task to fpu_fpregs_owner_ctx
...
Track the FPU owner context instead of the owner task: this change,
together with other changes, will allow in subsequent patches the
elimination of 'struct task_struct' usage in various FPU code:
we'll be able to use 'struct fpu' only.
There's no change in code size:
text data bss dec hex filename
13066467 2545248 1626112 17237827 1070743 vmlinux.before
13066467 2545248 1626112 17237827 1070743 vmlinux.after
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:23 +02:00
Ingo Molnar
36fe6175be
x86/fpu: Change __thread_clear_has_fpu() to 'struct fpu' parameter
...
We do this to make the code more readable, and also to be able to eliminate
task_struct usage from most of the FPU code.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:22 +02:00
Ingo Molnar
276983f808
x86/fpu: Eliminate the __thread_has_fpu() wrapper
...
Start migrating FPU methods towards using 'struct fpu *fpu'
directly. __thread_has_fpu() is just a trivial wrapper around
fpu->has_fpu, eliminate it.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:22 +02:00
Ingo Molnar
e102f30f4e
x86/fpu: Move fpu_copy() to fpu/core.c
...
Move fpu_copy() where its only user is.
Beyond readability this also speeds up compilation, as fpu-internal.h
is included in over a dozen .c files.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:21 +02:00
Ingo Molnar
6522d78377
x86/fpu: Remove __save_init_fpu()
...
__save_init_fpu() is just a trivial wrapper around fpu_save_init().
Remove the extra layer of obfuscation.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:21 +02:00
Ingo Molnar
416d49ac67
x86/fpu: Make kernel_fpu_disable/enable() static
...
This allows the compiler to inline them and to eliminate them:
arch/x86/kernel/fpu/core.o:
text data bss dec hex filename
6741 4 8 6753 1a61 core.o.before
6716 4 8 6728 1a48 core.o.after
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:20 +02:00
Ingo Molnar
f55f88e25e
x86/fpu: Make task_xstate_cachep static
...
It's now local to fpu/core.c, make it static.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:20 +02:00
Ingo Molnar
5a12bf6332
x86/fpu: Uninline fpstate_free() and move it next to the allocation function
...
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:20 +02:00
Ingo Molnar
a752b53d9d
x86/fpu: Factor out fpu__copy()
...
Introduce fpu__copy() and use it in arch_dup_task_struct(),
thus moving another chunk of FPU logic to fpu/core.c.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:19 +02:00
Ingo Molnar
8ffb53ab98
x86/fpu: Move task_xstate_cachep handling to core.c
...
This code was historically in process.c, now we have FPU core internals in
fpu/core.c instead - move it there.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:19 +02:00
Ingo Molnar
0afc4a941c
x86/fpu: Remove fpu_xsave()
...
It's a pointless wrapper now - use xsave_state().
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:19 +02:00
Ingo Molnar
3e261c14e4
x86/fpu: Simplify the xsave_state*() methods
...
These functions (xsave_state() and xsave_state_booting()) have a 'mask'
argument that is always -1.
Propagate this into the functions instead and eliminate the extra argument.
Does not change the generated code, because these were inlined functions.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:18 +02:00
Ingo Molnar
4d1640927b
x86/fpu: Factor out the FPU bug detection code into fpu__init_check_bugs()
...
Move the boot-time FPU bug detection code to the other FPU boot time
init code in fpu/init.c.
No change in code size:
text data bss dec hex filename
13044568 1884440 1130496 16059504 f50c70 vmlinux.before
13044568 1884440 1130496 16059504 f50c70 vmlinux.after
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:18 +02:00
Ingo Molnar
3a0aee4801
x86/fpu: Rename math_state_restore() to fpu__restore()
...
Move to the new fpu__*() namespace.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:18 +02:00
Ingo Molnar
81683cc827
x86/fpu: Factor out fpu__flush_thread() from flush_thread()
...
flush_thread() open codes a lot of FPU internals - create a separate
function for it in fpu/core.c.
Turns out that this does not hurt performance:
text data bss dec hex filename
11843039 1884440 1130496 14857975 e2b6f7 vmlinux.before
11843039 1884440 1130496 14857975 e2b6f7 vmlinux.after
and since this is a slowpath clarity comes first anyway.
We can reconsider inlining decisions after the FPU code has been cleaned up.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:17 +02:00
Ingo Molnar
11ad19277e
x86/fpu: Remove the free_thread_xstate() complication
...
Use fpstate_free() directly to manage FPU state.
Only process.c was using this method, so this is a speedup as well,
as it removes the extra function call and related clobbers.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:17 +02:00
Ingo Molnar
f89e32e0a3
x86/fpu: Fix header file dependencies of fpu-internal.h
...
Fix a minor header file dependency bug in asm/fpu-internal.h: it
relies on i387.h but does not include it. All users of fpu-internal.h
included it explicitly.
Also remove unnecessary includes, to reduce compilation time.
This also makes it easier to use it as a standalone header file
for FPU internals, such as an upcoming C module in arch/x86/kernel/fpu/.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:16 +02:00
Ingo Molnar
47bc510634
x86/fpu: Clean up asm/fpu/types.h
...
- add header guards
- standardize vertical alignment
- add comments about MPX
No code changed.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:15 +02:00
Ingo Molnar
14b9675ae9
x86/fpu: Move FPU data structures to asm/fpu_types.h
...
Move the FPU details to asm/fpu_types.h, to further factor out the
FPU code.
( As an added bonus, the 'struct orig_ist' definition now moves
next to its other data types - the FPU definitions were
slapped in the middle of them for some mysterious reason. )
No code changed.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:15 +02:00
Ingo Molnar
126009993f
x86/fpu: Improve the comment for the fpu::counter field
...
This was pretty hard to read, improve it.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:14 +02:00
Ingo Molnar
c0c2803dee
x86/fpu: Move thread_info::fpu_counter into thread_info::fpu.counter
...
This field is kept separate from the main FPU state structure for
no good reason.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:14 +02:00
Ingo Molnar
3a9c4b0d7e
x86/fpu: Rename fpu_init() to fpu__cpu_init()
...
fpu_init() is a bit of a misnomer in that it (falsely) creates the
impression that it's related to the (old) fpu_finit() function,
which initializes FPU ctx state.
Rename it to fpu__cpu_init() to make its boot time initialization
clear, and to move it to the fpu__*() namespace.
Also fix and extend its comment block to point out that it's
called not only on the boot CPU, but on secondary CPUs as well.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:14 +02:00
Ingo Molnar
c0ee2cf61b
x86/fpu: Rename fpu_finit() to fpstate_init()
...
Make it clear that we are initializing the in-memory FPU context area,
no the FPU registers.
Also move it to the fpu__*() namespace.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:13 +02:00
Ingo Molnar
a7c2a83364
x86/fpu: Rename fpu_free() to fpstate_free()
...
Use the fpu__*() namespace.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:13 +02:00
Ingo Molnar
ed97b08546
x86/fpu: Rename fpu_alloc() to fpstate_alloc()
...
Use the fpu__*() namespace for fpstate_alloc() as well.
Also add a comment about FPU state alignment.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:13 +02:00
Ingo Molnar
6fbe671248
x86/fpu: Move fpu_alloc() out of line
...
This is not a small function, and it's used in several places,
one of them a popular module (KVM).
Move the function out of line. This saves a bit of text,
even with the symbol export overhead:
text data bss dec hex filename
12566052 1619504 1089536 15275092 e91454 vmlinux.before
12566046 1619504 1089536 15275086 e9144e vmlinux.after
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:12 +02:00
Ingo Molnar
373244221a
x86/fpu: Remove fpu_allocated()
...
It's an unnecessary obfuscation of a very simple allocation pattern.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:12 +02:00
Ingo Molnar
bda283796b
x86/fpu: Make init_fpu() static
...
Now that the allocation users have been split off into a separate
function, init_fpu() has become local to i387.c: make it static.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:11 +02:00
Ingo Molnar
97185c95f7
x86/fpu: Split an fpstate_alloc_init() function out of init_fpu()
...
Most init_fpu() users don't want the register-saving aspect of the
function, they are calling it for 'current' and when FPU registers
are not allocated and initialized yet.
Split out a simplified API that does just that (and add debug-checks
for these conditions): fpstate_alloc_init().
Use it where appropriate.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:10 +02:00
Ingo Molnar
68ad8b9fea
x86/fpu: Remove stale init_fpu() prototype
...
We are going to split init_fpu() so keep only a single prototype, in i387.h.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:10 +02:00
Ingo Molnar
1a7dc0db71
x86/fpu: Rename fpu_detect() to fpu__detect()
...
Use the fpu__*() namespace to organize FPU ops better.
Also document fpu__detect() a bit.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:10 +02:00
Ingo Molnar
0a78155154
x86/fpu: Rename unlazy_fpu() to fpu__save()
...
This function is a misnomer on two levels:
1) it doesn't really manipulate TS on modern CPUs anymore, its
primary purpose is to save FPU state, used:
- when executing fork()/clone(): to copy current FPU state
to the child's FPU state.
- when handling math exceptions: to generate the math error
si_code in the signal frame.
2) even on legacy CPUs it doesn't actually 'unlazy', if then
it lazies the FPU state: as a side effect of the old FNSAVE
instruction which clears (destroys) FPU state it's necessary
to set CR0::TS.
So rename it to fpu__save() to better reflect its purpose.
Reviewed-by: Borislav Petkov <bp@alien8.de >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 15:47:09 +02:00
Paul Gortmaker
ea6cd25058
x86: Rename eisa_set_level_irq to elcr_set_level_irq
...
This routine has been around for over a decade, but with EISA
being dead and abandoned for about twice that long, the name can
be kind of confusing. The function is going at the PIC Edge/Level
Configuration Registers (ELCR), so rename it as such and mentally
decouple it from the long since dead EISA bus.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com >
Reviewed-by: Maciej W. Rozycki <macro@linux-mips.org >
Acked-by: Pavel Machek <pavel@ucw.cz >
Cc: Rafael J. Wysocki <rjw@rjwysocki.net >
Cc: Len Brown <len.brown@intel.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/1431217657-934-1-git-send-email-paul.gortmaker@windriver.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
2015-05-19 11:23:38 +02:00
David Hildenbrand
b3c395ef55
mm/uaccess, mm/fault: Clarify that uaccess may only sleep if pagefaults are enabled
...
In general, non-atomic variants of user access functions must not sleep
if pagefaults are disabled.
Let's update all relevant comments in uaccess code. This also reflects
the might_sleep() checks in might_fault().
Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: David.Laight@ACULAB.COM
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: airlied@linux.ie
Cc: akpm@linux-foundation.org
Cc: benh@kernel.crashing.org
Cc: bigeasy@linutronix.de
Cc: borntraeger@de.ibm.com
Cc: daniel.vetter@intel.com
Cc: heiko.carstens@de.ibm.com
Cc: herbert@gondor.apana.org.au
Cc: hocko@suse.cz
Cc: hughd@google.com
Cc: mst@redhat.com
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: schwidefsky@de.ibm.com
Cc: yang.shi@windriver.com
Link: http://lkml.kernel.org/r/1431359540-32227-4-git-send-email-dahi@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 08:39:14 +02:00
Peter Zijlstra
b92b8b35a2
locking/arch: Rename set_mb() to smp_store_mb()
...
Since set_mb() is really about an smp_mb() -- not a IO/DMA barrier
like mb() rename it to match the recent smp_load_acquire() and
smp_store_release().
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 08:32:00 +02:00
Peter Zijlstra
ab3f02fc23
locking/arch: Add WRITE_ONCE() to set_mb()
...
Since we assume set_mb() to result in a single store followed by a
full memory barrier, employ WRITE_ONCE().
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2015-05-19 08:31:59 +02:00
Greg Kroah-Hartman
02730d3c05
Merge 4.1-rc4 into tty-next
...
This resolves some tty driver merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-05-18 14:08:58 -07:00