]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge branch 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 May 2012 17:59:07 +0000 (10:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 May 2012 17:59:07 +0000 (10:59 -0700)
Pull fpu state cleanups from Ingo Molnar:
 "This tree streamlines further aspects of FPU handling by eliminating
  the prepare_to_copy() complication and moving that logic to
  arch_dup_task_struct().

  It also fixes the FPU dumps in threaded core dumps, removes and old
  (and now invalid) assumption plus micro-optimizes the exit path by
  avoiding an FPU save for dead tasks."

Fixed up trivial add-add conflict in arch/sh/kernel/process.c that came
in because we now do the FPU handling in arch_dup_task_struct() rather
than the legacy (and now gone) prepare_to_copy().

* 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, fpu: drop the fpu state during thread exit
  x86, xsave: remove thread_has_fpu() bug check in __sanitize_i387_state()
  coredump: ensure the fpu state is flushed for proper multi-threaded core dump
  fork: move the real prepare_to_copy() users to arch_dup_task_struct()

41 files changed:
arch/alpha/include/asm/processor.h
arch/arm/include/asm/processor.h
arch/avr32/include/asm/processor.h
arch/blackfin/include/asm/processor.h
arch/c6x/include/asm/processor.h
arch/cris/include/asm/processor.h
arch/frv/include/asm/processor.h
arch/frv/kernel/process.c
arch/h8300/include/asm/processor.h
arch/hexagon/include/asm/processor.h
arch/ia64/include/asm/processor.h
arch/m32r/include/asm/processor.h
arch/m68k/include/asm/processor.h
arch/microblaze/include/asm/processor.h
arch/mips/include/asm/processor.h
arch/mn10300/include/asm/processor.h
arch/mn10300/kernel/process.c
arch/openrisc/include/asm/processor.h
arch/parisc/include/asm/processor.h
arch/powerpc/include/asm/processor.h
arch/powerpc/kernel/process.c
arch/s390/include/asm/processor.h
arch/score/include/asm/processor.h
arch/sh/include/asm/processor_32.h
arch/sh/include/asm/processor_64.h
arch/sh/kernel/process.c
arch/sh/kernel/process_32.c
arch/sparc/include/asm/processor_32.h
arch/sparc/include/asm/processor_64.h
arch/tile/include/asm/processor.h
arch/um/include/asm/processor-generic.h
arch/unicore32/include/asm/processor.h
arch/x86/include/asm/processor.h
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/xsave.c
arch/xtensa/include/asm/processor.h
arch/xtensa/kernel/process.c
fs/exec.c
kernel/fork.c

index 94afe5859301f272eb6dedf7343f6e877f8fd77c..e37b887b3d9f636fdcb0b4615a8c648dfc3d364f 100644 (file)
@@ -49,9 +49,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 /* Create a kernel thread without removing it from tasklists.  */
 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
index d7038fa223436227f14276406128ff9b247061d4..99afa7498260cdad985eaf9c74fd713095dd09f6 100644 (file)
@@ -77,9 +77,6 @@ struct task_struct;
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 #if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327)
index 108502bc67706786d3125dff42be43f6a1d9b7d2..87d8baccc60e908c475c72dff993e4f5ec79a817 100644 (file)
@@ -145,9 +145,6 @@ extern void release_thread(struct task_struct *);
 /* Create a kernel thread without removing it from tasklists */
 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk) do { } while(0)
-
 /* Return saved PC of a blocked thread */
 #define thread_saved_pc(tsk)    ((tsk)->thread.cpu_context.pc)
 
index 8af7772e84ccfdcfbba38d1b11eca4cad1926d45..4ef7cfe43cebce8441a88c5dc876f980760e65ef 100644 (file)
@@ -75,8 +75,6 @@ static inline void release_thread(struct task_struct *dead_task)
 {
 }
 
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
 
 /*
index 3ff7fab956ba1c2158f087a59050f8c45006f25a..c50af7ef1c96a5538252474e6ab37681141583a5 100644 (file)
@@ -92,9 +92,6 @@ static inline void release_thread(struct task_struct *dead_task)
 {
 }
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 #define copy_segments(tsk, mm)         do { } while (0)
index 8dc56ef08712dbf7e781ca7d92120fa006f8ef91..ef4e1bc3efc88686fbc4092f1e3661adffa285dc 100644 (file)
@@ -49,10 +49,6 @@ struct task_struct;
 #define task_pt_regs(task) user_regs(task_thread_info(task))
 #define current_regs() task_pt_regs(current)
 
-static inline void prepare_to_copy(struct task_struct *tsk)
-{
-}
-
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 unsigned long get_wchan(struct task_struct *p);
index 9b1a92b73f6009af3f19fedafd9e3be0d3ab445c..a8311d364e2af377851d763ace6d0e38f8eabf93 100644 (file)
@@ -103,8 +103,6 @@ do {                                                        \
        __frame->sp     = (_usp);                       \
 } while(0)
 
-extern void prepare_to_copy(struct task_struct *tsk);
-
 /* Free all resources held by a thread. */
 static inline void release_thread(struct task_struct *dead_task)
 {
index ed09e9e2c6531aba44d51780631bce107f56e3c0..ff95f50efea5cf950829ffd455e7a1b9552a7ddf 100644 (file)
@@ -165,17 +165,6 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
        return do_fork(clone_flags, newsp, __frame, 0, parent_tidptr, child_tidptr);
 } /* end sys_clone() */
 
-/*****************************************************************************/
-/*
- * This gets called before we allocate a new thread and copy
- * the current task into it.
- */
-void prepare_to_copy(struct task_struct *tsk)
-{
-       //unlazy_fpu(tsk);
-} /* end prepare_to_copy() */
-
-/*****************************************************************************/
 /*
  * set up the kernel stack and exception frames for a new process
  */
index 61fabf1788c6b4e1a9c006d29a070b2b1bfb5904..4c9f6f87b6179f1c493ee3f2ed289dcda0a46bdc 100644 (file)
@@ -109,8 +109,6 @@ static inline void release_thread(struct task_struct *dead_task)
 
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-#define prepare_to_copy(tsk)   do { } while (0)
-
 /*
  * Free current thread data structures etc..
  */
index 20c5ddabbd8b4297e224a0557f5ca89b6a50e4d7..e8ea459002a4cf6adfc824092c87b94a5cacc891 100644 (file)
@@ -58,13 +58,6 @@ struct thread_struct {
 
 #define cpu_relax() __vmyield()
 
-/*
- * "Unlazying all lazy status" occurs here.
- */
-static inline void prepare_to_copy(struct task_struct *tsk)
-{
-}
-
 /*
  * Decides where the kernel will search for a free chunk of vm space during
  * mmaps.
index f92f67aba6187b095f27cd4b2e751eed8f4dc38d..5a994ec8f06d4e358a3ee478f2057fd91d47cfbf 100644 (file)
@@ -343,9 +343,6 @@ struct task_struct;
  */
 #define release_thread(dead_task)
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 /*
  * This is the mechanism for creating a new kernel thread.
  *
index e1f46d7574602aa5ca4f3934097fed74c94cb005..da17253b5735ba2d81b37e929f59126628449da7 100644 (file)
@@ -118,8 +118,6 @@ struct mm_struct;
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-#define prepare_to_copy(tsk)   do { } while (0)
-
 /*
  * create a kernel thread without removing it from tasklists
  */
index 46460fa15d5cc66cbc68f39a3016b596c03af2ad..f17c42aff7ffb9aa592aebf2e118d99309d8e699 100644 (file)
@@ -153,9 +153,6 @@ static inline void release_thread(struct task_struct *dead_task)
 {
 }
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 /*
index bffb545272997b54c2a0090b398618f83320662a..af2bb9652392e9ecb80980c51a0ebf2b3390e526 100644 (file)
@@ -23,7 +23,6 @@ extern const struct seq_operations cpuinfo_op;
 
 # define cpu_relax()           barrier()
 # define cpu_sleep()           do {} while (0)
-# define prepare_to_copy(tsk)  do {} while (0)
 
 #define task_pt_regs(tsk) \
                (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
index 20e9dcf42b27461f0584f01f79cfc3c1bb385edc..5e33fabe354de7e12e11dc4f64aa5d0be7464090 100644 (file)
@@ -310,9 +310,6 @@ struct task_struct;
 /* Free all resources held by a thread. */
 #define release_thread(thread) do { } while(0)
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 extern unsigned long thread_saved_pc(struct task_struct *tsk);
index f7b3c9ab2cb581fed5a838dfed13b916f9abbf4f..247928c9f549ec239e1e5556a1c7157674833bba 100644 (file)
@@ -139,9 +139,6 @@ static inline void start_thread(struct pt_regs *regs,
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-extern void prepare_to_copy(struct task_struct *tsk);
-
 /*
  * create a kernel thread without removing it from tasklists
  */
index 14707f25153b15f46e97a4ad68ca5dc521bc1984..7dab0cd364663e9ab9b6c8418cf9da51a28525c3 100644 (file)
@@ -208,12 +208,14 @@ void copy_segments(struct task_struct *p, struct mm_struct *new_mm)
 }
 
 /*
- * this gets called before we allocate a new thread and copy the current task
- * into it so that we can store lazy state into memory
+ * this gets called so that we can store lazy state into memory and copy the
+ * current task into the new thread.
  */
-void prepare_to_copy(struct task_struct *tsk)
+int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
-       unlazy_fpu(tsk);
+       unlazy_fpu(src);
+       *dst = *src;
+       return 0;
 }
 
 /*
index f7516fa78b58a2e2311433f63a1a401d7de9d044..30462f1fe959298cdf492bd8c18e3879fce7a50f 100644 (file)
@@ -72,10 +72,6 @@ struct thread_struct {
 #define task_pt_regs(task) user_regs(task_thread_info(task))
 #define current_regs() user_regs(current_thread_info())
 
-extern inline void prepare_to_copy(struct task_struct *tsk)
-{
-}
-
 #define INIT_SP         (sizeof(init_stack) + (unsigned long) &init_stack)
 
 #define INIT_THREAD  { }
index acdf4cad6125ae78203c60ce06337e6a9e0354cb..0e8b7b8ce8a25046830f28367b4d4eb84d9e0813 100644 (file)
@@ -328,9 +328,6 @@ struct mm_struct;
 extern void release_thread(struct task_struct *);
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
 
 extern unsigned long get_wchan(struct task_struct *p);
index 48a26d379222ddee0be8d4e9e1a5fb06d18a71eb..55e85631c42e3be5ab150ce48e2d3dbf767e9c6a 100644 (file)
@@ -74,9 +74,6 @@ struct task_struct;
 void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
 void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-extern void prepare_to_copy(struct task_struct *tsk);
-
 /* Create a new kernel thread. */
 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
index 7f8ec1de0ace499e57b9bd760adf7d56f11af98a..710f400476deb8461a98a1342c6ee1b669fbe686 100644 (file)
@@ -711,18 +711,21 @@ release_thread(struct task_struct *t)
 }
 
 /*
- * This gets called before we allocate a new thread and copy
- * the current task into it.
+ * this gets called so that we can store coprocessor state into memory and
+ * copy the current task into the new thread.
  */
-void prepare_to_copy(struct task_struct *tsk)
+int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
-       flush_fp_to_thread(current);
-       flush_altivec_to_thread(current);
-       flush_vsx_to_thread(current);
-       flush_spe_to_thread(current);
+       flush_fp_to_thread(src);
+       flush_altivec_to_thread(src);
+       flush_vsx_to_thread(src);
+       flush_spe_to_thread(src);
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
-       flush_ptrace_hw_breakpoint(tsk);
+       flush_ptrace_hw_breakpoint(src);
 #endif /* CONFIG_HAVE_HW_BREAKPOINT */
+
+       *dst = *src;
+       return 0;
 }
 
 /*
index d499b30ea487107b339c252dff39bf3ae5c9dfe9..6cbf31311673a37bc83de2be5add15bbc42ece5e 100644 (file)
@@ -141,9 +141,6 @@ struct seq_file;
 extern void release_thread(struct task_struct *);
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 /*
  * Return saved PC of a blocked thread.
  */
index 7e22f216d771ac93749ff5c1e876bd93c275eaf7..ab3aceb542094e7a80eda7158c96665ace799214 100644 (file)
@@ -26,7 +26,6 @@ extern unsigned long get_wchan(struct task_struct *p);
 
 #define cpu_relax()            barrier()
 #define release_thread(thread) do {} while (0)
-#define prepare_to_copy(tsk)   do {} while (0)
 
 /*
  * User space process size: 2GB. This is hardcoded into a few places,
index 900f8d72ffe2d86e902e590d53b180d73871da7a..b6311fd2d066a1db774409f1dac29f2b856290e4 100644 (file)
@@ -126,9 +126,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned lo
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-void prepare_to_copy(struct task_struct *tsk);
-
 /*
  * create a kernel thread without removing it from tasklists
  */
index 740e268765963b9c91dcce4d4b204be0aeeceea2..cd6029fb2c015f89742e3519b5b04172ef39ce5e 100644 (file)
@@ -169,7 +169,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 #define copy_segments(p, mm)   do { } while (0)
 #define release_segments(mm)   do { } while (0)
 #define forget_segments()      do { } while (0)
-#define prepare_to_copy(tsk)   do { } while (0)
 /*
  * FPU lazy state save handling.
  */
index e77feaf117abbb404cf43f5d200f44f2acaa6e27..9b7a459a4613d8573a7c84ac3bf970402431c31e 100644 (file)
@@ -13,8 +13,15 @@ unsigned long __stack_chk_guard __read_mostly;
 EXPORT_SYMBOL(__stack_chk_guard);
 #endif
 
+/*
+ * this gets called so that we can store lazy state into memory and copy the
+ * current task into the new thread.
+ */
 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
+#ifdef CONFIG_SUPERH32
+       unlazy_fpu(src, task_pt_regs(src));
+#endif
        *dst = *src;
 
        if (src->thread.xstate) {
index f78cc421e6659787585e54cb3fc9295ab32c3020..59521e8a164dae01da367f2f60aef2e0a737551e 100644 (file)
@@ -156,15 +156,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
 }
 EXPORT_SYMBOL(dump_fpu);
 
-/*
- * This gets called before we allocate a new thread and copy
- * the current task into it.
- */
-void prepare_to_copy(struct task_struct *tsk)
-{
-       unlazy_fpu(tsk, task_pt_regs(tsk));
-}
-
 asmlinkage void ret_from_fork(void);
 
 int copy_thread(unsigned long clone_flags, unsigned long usp,
index 9cbd854fdfdd8a4fc0e49e52b838170941026309..f74ac9ee33a8ef461f0277af60731adf7a0f904a 100644 (file)
@@ -108,9 +108,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
 #define release_thread(tsk)            do { } while(0)
 extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern unsigned long get_wchan(struct task_struct *);
 
 #define task_pt_regs(tsk) ((tsk)->thread.kregs)
index e713db249931fb3895cfcd842176187b8d948f71..67df5cc1001126cbc3fddaaabebc9e7e53e556f8 100644 (file)
@@ -186,9 +186,6 @@ do { \
 /* Free all resources held by a thread. */
 #define release_thread(tsk)            do { } while (0)
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 extern unsigned long get_wchan(struct task_struct *task);
index 34c1e01ffb5e24648c4171fccedcd3257ef5e0da..15cd8a4a06ce1dc62170444629edc7c17d9da2ab 100644 (file)
@@ -210,9 +210,6 @@ static inline void release_thread(struct task_struct *dead_task)
        /* Nothing for now */
 }
 
-/* Prepare to copy thread state - unlazy all lazy status. */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
 extern int do_work_pending(struct pt_regs *regs, u32 flags);
index 7827394a5b6cd0443fb2b0201244a0e790506920..69f1c57a8d0dc895c727b74e1a53f8acd6c94a4c 100644 (file)
@@ -74,11 +74,6 @@ static inline void release_thread(struct task_struct *task)
 
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
-static inline void prepare_to_copy(struct task_struct *tsk)
-{
-}
-
-
 extern unsigned long thread_saved_pc(struct task_struct *t);
 
 static inline void mm_copy_segments(struct mm_struct *from_mm,
index f0d780a51f9b5dec74a5310fe0f1fd2c4fdc7b28..14382cb09657f67333f5a32f4d95910ae10e0b1d 100644 (file)
@@ -68,9 +68,6 @@ struct task_struct;
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)   do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 #define cpu_relax()                    barrier()
index ccbb1ea99ccbd24dc63fa73721e05832fd93e25a..7745b257f035a8b1438078c670ce49dc1613051f 100644 (file)
@@ -579,9 +579,6 @@ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Prepare to copy thread state - unlazy all lazy state */
-extern void prepare_to_copy(struct task_struct *tsk);
-
 unsigned long get_wchan(struct task_struct *p);
 
 /*
index f2e8c0f951d632c9d675d6801940ebb406c6865e..735279e54e59a56d3f3ce97288f2d81fc98491d6 100644 (file)
@@ -56,10 +56,16 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister);
 struct kmem_cache *task_xstate_cachep;
 EXPORT_SYMBOL_GPL(task_xstate_cachep);
 
+/*
+ * this gets called so that we can store lazy state into memory and copy the
+ * current task into the new thread.
+ */
 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
        int ret;
 
+       unlazy_fpu(src);
+
        *dst = *src;
        if (fpu_allocated(&src->thread.fpu)) {
                memset(&dst->thread.fpu, 0, sizeof(dst->thread.fpu));
@@ -89,6 +95,16 @@ void arch_task_cache_init(void)
                                  SLAB_PANIC | SLAB_NOTRACK, NULL);
 }
 
+static inline void drop_fpu(struct task_struct *tsk)
+{
+       /*
+        * Forget coprocessor state..
+        */
+       tsk->fpu_counter = 0;
+       clear_fpu(tsk);
+       clear_used_math();
+}
+
 /*
  * Free current thread data structures etc..
  */
@@ -111,6 +127,8 @@ void exit_thread(void)
                put_cpu();
                kfree(bp);
        }
+
+       drop_fpu(me);
 }
 
 void show_regs_common(void)
@@ -145,12 +163,7 @@ void flush_thread(void)
 
        flush_ptrace_hw_breakpoint(tsk);
        memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
-       /*
-        * Forget coprocessor state..
-        */
-       tsk->fpu_counter = 0;
-       clear_fpu(tsk);
-       clear_used_math();
+       drop_fpu(tsk);
 }
 
 static void hard_disable_TSC(void)
index 01d8d40ccaf63cda8e6e2ac9eceb6c60e0fb7c6a..516fa186121b6d7dd82d9b73e1fa79ed11aa323a 100644 (file)
@@ -126,15 +126,6 @@ void release_thread(struct task_struct *dead_task)
        release_vm86_irqs(dead_task);
 }
 
-/*
- * This gets called before we allocate a new thread and copy
- * the current task into it.
- */
-void prepare_to_copy(struct task_struct *tsk)
-{
-       unlazy_fpu(tsk);
-}
-
 int copy_thread(unsigned long clone_flags, unsigned long sp,
        unsigned long unused,
        struct task_struct *p, struct pt_regs *regs)
index 28e810255a0a90396c4ad69d94e31796edc0bffb..61cdf7fdf09961757d7a6f8ba595df63a5a123b3 100644 (file)
@@ -145,15 +145,6 @@ static inline u32 read_32bit_tls(struct task_struct *t, int tls)
        return get_desc_base(&t->thread.tls_array[tls]);
 }
 
-/*
- * This gets called before we allocate a new thread and copy
- * the current task into it.
- */
-void prepare_to_copy(struct task_struct *tsk)
-{
-       unlazy_fpu(tsk);
-}
-
 int copy_thread(unsigned long clone_flags, unsigned long sp,
                unsigned long unused,
        struct task_struct *p, struct pt_regs *regs)
index e62728e30b014a0214a3735210c7d51cde7e061c..bd18149b2b0f09532870075a274ff1576b5de1d7 100644 (file)
@@ -48,8 +48,6 @@ void __sanitize_i387_state(struct task_struct *tsk)
        if (!fx)
                return;
 
-       BUG_ON(__thread_has_fpu(tsk));
-
        xstate_bv = tsk->thread.fpu.state->xsave.xsave_hdr.xstate_bv;
 
        /*
index 3acb26e8dead4d2336e1313333027b6e74461ed3..5c371d8d45284a1c35808d2b9e4928db03cc7652 100644 (file)
@@ -168,9 +168,6 @@ struct mm_struct;
 /* Free all resources held by a thread. */
 #define release_thread(thread) do { } while(0)
 
-/* Prepare to copy thread state - unlazy all lazy status */
-extern void prepare_to_copy(struct task_struct*);
-
 /* Create a kernel thread without removing it from tasklists */
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
index 6a2d6edf8f728af36bf4da4fc1587e79057bdf46..9b306e550e3f06ddfa342c041c7793543702c4b3 100644 (file)
@@ -140,13 +140,16 @@ void flush_thread(void)
 }
 
 /*
- * This is called before the thread is copied. 
+ * this gets called so that we can store coprocessor state into memory and
+ * copy the current task into the new thread.
  */
-void prepare_to_copy(struct task_struct *tsk)
+int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
 #if XTENSA_HAVE_COPROCESSORS
-       coprocessor_flush_all(task_thread_info(tsk));
+       coprocessor_flush_all(task_thread_info(src));
 #endif
+       *dst = *src;
+       return 0;
 }
 
 /*
index d038968b54b420a3844c6e07f6bf25bee34d7e5c..1e8efdc80412794d0e566db69783f2a310408aa6 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1938,8 +1938,21 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
                core_waiters = zap_threads(tsk, mm, core_state, exit_code);
        up_write(&mm->mmap_sem);
 
-       if (core_waiters > 0)
+       if (core_waiters > 0) {
+               struct core_thread *ptr;
+
                wait_for_completion(&core_state->startup);
+               /*
+                * Wait for all the threads to become inactive, so that
+                * all the thread context (extended register state, like
+                * fpu etc) gets copied to the memory.
+                */
+               ptr = core_state->dumper.next;
+               while (ptr != NULL) {
+                       wait_task_inactive(ptr->task, 0);
+                       ptr = ptr->next;
+               }
+       }
 
        return core_waiters;
 }
index ad54c833116a60f7c384780c31181a80b1347b5d..05c813dc9ecc50efbf9012e765dfc64b8ddf9b6b 100644 (file)
@@ -292,8 +292,6 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
        int node = tsk_fork_get_node(orig);
        int err;
 
-       prepare_to_copy(orig);
-
        tsk = alloc_task_struct_node(node);
        if (!tsk)
                return NULL;