Skip to content

Commit

Permalink
x86/fpu: Move fpu__clear() to 'struct fpu *' parameter passing
Browse files Browse the repository at this point in the history
Do it like all other high level FPU state handling functions: they
only know about struct fpu, not about the task.

(Also remove a dead prototype while at it.)

Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
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>
  • Loading branch information
Ingo Molnar committed May 19, 2015
1 parent 6ffc152 commit 04c8e01
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions arch/x86/include/asm/fpu/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ int ia32_setup_frame(int sig, struct ksignal *ksig,
#define MXCSR_DEFAULT 0x1f80

extern unsigned int mxcsr_feature_mask;
extern void fpu__init_cpu(void);
extern void eager_fpu_init(void);

extern void fpu__init_cpu(void);
extern void fpu__init_system_xstate(void);
extern void fpu__init_cpu_xstate(void);
extern void fpu__init_system(struct cpuinfo_x86 *c);
Expand All @@ -57,7 +56,7 @@ extern void fpu__restore(void);
extern void fpu__drop(struct fpu *fpu);
extern int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu);
extern void fpu__reset(struct fpu *fpu);
extern void fpu__clear(struct task_struct *tsk);
extern void fpu__clear(struct fpu *fpu);

extern void fpu__init_check_bugs(void);
extern void fpu__resume_cpu(void);
Expand Down
6 changes: 2 additions & 4 deletions arch/x86/kernel/fpu/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,9 @@ void fpu__reset(struct fpu *fpu)
* Called by sys_execve() to clear the FPU fpregs, so that FPU state
* of the previous binary does not leak over into the exec()ed binary:
*/
void fpu__clear(struct task_struct *tsk)
void fpu__clear(struct fpu *fpu)
{
struct fpu *fpu = &tsk->thread.fpu;

WARN_ON_ONCE(tsk != current); /* Almost certainly an anomaly */
WARN_ON_ONCE(fpu != &current->thread.fpu); /* Almost certainly an anomaly */

if (!use_eager_fpu()) {
/* FPU state will be reallocated lazily at the first use. */
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void flush_thread(void)
flush_ptrace_hw_breakpoint(tsk);
memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));

fpu__clear(tsk);
fpu__clear(&tsk->thread.fpu);
}

static void hard_disable_TSC(void)
Expand Down

0 comments on commit 04c8e01

Please sign in to comment.