Linux 3.2.8
Greg KH
maintainerI'm announcing the release of the 3.2.8 kernel.
This is an "interesting" update, in that "only" one bug is being resolved here, handling a floating point issue with new x86 processors running in 32bit mode. But, this also fixes x86-64 issues as well in this area, so all users are encouraged to upgrade. If anyone has any problems, please let us know as soon as possible.
The updated 3.2.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.2.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/x86/include/asm/i387.h | 284 +++++++++++++++++++++++++++++-------- arch/x86/include/asm/processor.h | 1 arch/x86/include/asm/thread_info.h | 2 arch/x86/kernel/process_32.c | 25 --- arch/x86/kernel/process_64.c | 29 --- arch/x86/kernel/traps.c | 41 +++-- arch/x86/kernel/xsave.c | 12 - arch/x86/kvm/vmx.c | 2 9 files changed, 269 insertions(+), 129 deletions(-)
Greg Kroah-Hartman (1):
Linux 3.2.8
Linus Torvalds (10):
i387: math_state_restore() isn't called from asm
i387: make irq_fpu_usable() tests more robust
i387: fix sense of sanity check
i387: fix x86-64 preemption-unsafe user stack save/restore
i387: move TS_USEDFPU clearing out of __save_init_fpu and into callers
i387: don't ever touch TS_USEDFPU directly, use helper functions
i387: do not preload FPU state at task switch time
i387: move AMD K7/K8 fpu fxsave/fxrstor workaround from save to restore
i387: move TS_USEDFPU flag from thread_info to task_struct
i387: re-introduce FPU state preloading at context switch time
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 2 -SUBLEVEL = 7 +SUBLEVEL = 8 EXTRAVERSION = NAME = Saber-toothed Squirrel
arch/x86/include/asm/i387.h +229 -55
362 lines not on this page · raw message
arch/x86/include/asm/processor.h +1 -0
@@ -456,6 +456,7 @@ struct thread_struct {unsigned long trap_no;unsigned long error_code;/* floating point and extended processor state */ +unsigned long has_fpu;struct fpu fpu;#ifdef CONFIG_X86_32 /* Virtual 86 mode info */
arch/x86/include/asm/thread_info.h +0 -2
@@ -242,8 +242,6 @@ static inline struct thread_info *current_thread_info(void)* ever touches our thread-synchronous status, so we don't * have to worry about atomic accesses. */ -#define TS_USEDFPU 0x0001/* FPU was used by this task -this quantum (SMP) */ #define TS_COMPAT 0x0002/* 32bit syscall active (64BIT)*/ #define TS_POLLING 0x0004/* idle task polling need_resched, skip sending interrupt */
arch/x86/kernel/process_32.c +4 -21
@@ -297,22 +297,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) *next = &next_p->thread;int cpu =smp_processor_id ();struct tss_struct *tss = &per_cpu (init_tss, cpu); -bool preload_fpu; +fpu_switch_t fpu;/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */ -/* -* If the task has used fpu the last 5 timeslices, just do a full -* restore of the math state immediately to avoid the trap; the -* chances of needing FPU soon are obviously high now -*/ - preload_fpu =tsk_used_math (next_p) && next_p->fpu_counter >5 ; - -__unlazy_fpu (prev_p); - -/* we're going to use this soon, after a few expensive things */ -if (preload_fpu) -prefetch (next->fpu.state); + fpu =switch_fpu_prepare (prev_p, next_p);/* * Reload esp0.
@@ -352,11 +341,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))__switch_to_xtra (prev_p, next_p, tss); -/* If we're going to preload the fpu context, make sure clts -is run while we're batching the cpu state updates. */ -if (preload_fpu) -clts (); -/* * Leave lazy mode, flushing any hypercalls made here. * This must be done before restoring TLS segments so
@@ -366,15 +350,14 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)*/ arch_end_context_switch (next_p); -if (preload_fpu) -__math_state_restore (); -/* * Restore %gs if needed (which is common) */ if (prev->gs | next->gs)lazy_load_gs (next->gs); +switch_fpu_finish (next_p, fpu); +percpu_write (current_task, next_p);return prev_p;
arch/x86/kernel/process_64.c +4 -25
@@ -381,18 +381,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)int cpu =smp_processor_id ();struct tss_struct *tss = &per_cpu (init_tss, cpu);unsigned fsindex, gsindex; -bool preload_fpu; +fpu_switch_t fpu; -/* -* If the task has used fpu the last 5 timeslices, just do a full -* restore of the math state immediately to avoid the trap; the -* chances of needing FPU soon are obviously high now -*/ - preload_fpu =tsk_used_math (next_p) && next_p->fpu_counter >5 ; - -/* we're going to use this soon, after a few expensive things */ -if (preload_fpu) -prefetch (next->fpu.state); + fpu =switch_fpu_prepare (prev_p, next_p);/* * Reload esp0, LDT and the page table pointer:
@@ -422,13 +413,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)load_TLS (next, cpu); -/* Must be after DS reload */ -__unlazy_fpu (prev_p); - -/* Make sure cpu is ready for new context */ -if (preload_fpu) -clts (); -/* * Leave lazy mode, flushing any hypercalls made here. * This must be done before restoring TLS segments so
@@ -469,6 +453,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)wrmsrl (MSR_KERNEL_GS_BASE , next->gs); prev->gsindex = gsindex; +switch_fpu_finish (next_p, fpu); +/* * Switch the PDA and FPU contexts. */
@@ -487,13 +473,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV))__switch_to_xtra (prev_p, next_p, tss); -/* -* Preload the FPU context, now that we've determined that the -* task is likely to be using it. -*/ -if (preload_fpu) -__math_state_restore (); -return prev_p; }
arch/x86/kernel/traps.c +25 -16
72 lines not on this page · raw message
arch/x86/kernel/xsave.c +4 -8
@@ -47,7 +47,7 @@ void __sanitize_i387_state(struct task_struct *tsk)if (!fx)return ; -BUG_ON (task_thread_info (tsk)->status &TS_USEDFPU ); +BUG_ON (__thread_has_fpu (tsk)); xstate_bv = tsk->thread.fpu.state->xsave.xsave_hdr.xstate_bv;
@@ -168,7 +168,7 @@ int save_i387_xstate(void __user *buf)if (!used_math ())return 0 ; -if (task_thread_info (tsk)->status &TS_USEDFPU ) { +if (user_has_fpu ()) {if (use_xsave ()) err =xsave_user (buf);else
@@ -176,8 +176,7 @@ int save_i387_xstate(void __user *buf)if (err)return err; -task_thread_info (tsk)->status &= ~TS_USEDFPU ; -stts (); +user_fpu_end (); }else {sanitize_i387_state (tsk); if (__copy_to_user(buf, &tsk->thread.fpu.state->fxsave,
@@ -292,10 +291,7 @@ int restore_i387_xstate(void __user *buf)return err; } -if (!(task_thread_info (current)->status &TS_USEDFPU )) { -clts (); -task_thread_info (current)->status |=TS_USEDFPU ; - } +user_fpu_begin ();if (use_xsave ()) err =restore_user_xstate (buf);else
arch/x86/kvm/vmx.c +1 -1
@@ -1456,7 +1456,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)#ifdef CONFIG_X86_64 wrmsrl (MSR_KERNEL_GS_BASE , vmx->msr_host_kernel_gs_base);#endif -if (current_thread_info ()->status &TS_USEDFPU ) +if (__thread_has_fpu (current))clts ();load_gdt (&__get_cpu_var (host_gdt)); }