Merge branch 'master' into sh/hw-breakpoints
authorPaul Mundt <lethal@linux-sh.org>
Tue, 8 Dec 2009 06:47:12 +0000 (15:47 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 8 Dec 2009 06:47:12 +0000 (15:47 +0900)
Conflict between FPU thread flag migration and debug
thread flag addition.

Conflicts:
arch/sh/include/asm/thread_info.h
arch/sh/include/asm/ubc.h
arch/sh/kernel/process_32.c

1  2 
arch/sh/Kconfig
arch/sh/include/asm/processor_32.h
arch/sh/include/asm/system.h
arch/sh/include/asm/thread_info.h
arch/sh/include/asm/ubc.h
arch/sh/kernel/Makefile
arch/sh/kernel/process_32.c

diff --cc arch/sh/Kconfig
@@@ -37,9 -39,9 +39,10 @@@ config SUPERH3
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FUNCTION_TRACE_MCOUNT_TEST
+       select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_ARCH_KGDB
 +      select HAVE_HW_BREAKPOINT if CPU_SH4A
        select ARCH_HIBERNATION_POSSIBLE if MMU
  
  config SUPERH64
Simple merge
Simple merge
@@@ -117,8 -118,6 +118,7 @@@ extern void free_thread_info(struct thr
  #define TIF_SECCOMP           6       /* secure computing */
  #define TIF_NOTIFY_RESUME     7       /* callback before returning to user */
  #define TIF_SYSCALL_TRACEPOINT        8       /* for ftrace syscall instrumentation */
- #define TIF_USEDFPU           16      /* FPU was used by this task this quantum (SMP) */
 +#define TIF_DEBUG             9       /* uses UBC */
  #define TIF_POLLING_NRFLAG    17      /* true if poll_idle() is polling TIF_NEED_RESCHED */
  #define TIF_MEMDIE            18
  #define TIF_FREEZE            19      /* Freezing for suspend */
  #define _TIF_SECCOMP          (1 << TIF_SECCOMP)
  #define _TIF_NOTIFY_RESUME    (1 << TIF_NOTIFY_RESUME)
  #define _TIF_SYSCALL_TRACEPOINT       (1 << TIF_SYSCALL_TRACEPOINT)
- #define _TIF_USEDFPU          (1 << TIF_USEDFPU)
 +#define _TIF_DEBUG            (1 << TIF_DEBUG)
  #define _TIF_POLLING_NRFLAG   (1 << TIF_POLLING_NRFLAG)
  #define _TIF_FREEZE           (1 << TIF_FREEZE)
  
  #define BRCR_UBDE             (1 << 0)
  #endif
  
- #ifndef __ASSEMBLY__
- /* arch/sh/kernel/cpu/ubc.S */
- extern void ubc_sleep(void);
- #ifdef CONFIG_UBC_WAKEUP
- extern void ubc_wakeup(void);
- #else
- #define ubc_wakeup()  do { } while (0)
- #endif
- #endif
 +/*
 + * All SH parts have 2 UBC channels. I defy any hardware designer to
 + * invalidate this assertion.
 + */
 +#define NR_UBC_CHANNELS               2
 +
  #endif /* __KERNEL__ */
  #endif /* __ASM_SH_UBC_H */
@@@ -35,8 -38,8 +38,9 @@@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += 
  obj-$(CONFIG_DUMP_CODE)               += disassemble.o
  obj-$(CONFIG_HIBERNATION)     += swsusp.o
  obj-$(CONFIG_DWARF_UNWINDER)  += dwarf.o
+ obj-$(CONFIG_PERF_EVENTS)     += perf_event.o perf_callchain.o
  
 +obj-$(CONFIG_HAVE_HW_BREAKPOINT)              += hw_breakpoint.o
  obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)   += localtimer.o
  
  EXTRA_CFLAGS += -Werror
@@@ -193,15 -209,11 +207,10 @@@ int copy_thread(unsigned long clone_fla
  {
        struct thread_info *ti = task_thread_info(p);
        struct pt_regs *childregs;
-       struct task_struct *tsk = current;
- #if defined(CONFIG_SH_FPU)
-       unlazy_fpu(tsk, regs);
-       p->thread.fpu = tsk->thread.fpu;
-       copy_to_stopped_child_used_math(p);
- #endif
 +
  #if defined(CONFIG_SH_DSP)
 -#endif
+       struct task_struct *tsk = current;
 -#if defined(CONFIG_SH_DSP)
        if (is_dsp_enabled(tsk)) {
                /* We can use the __save_dsp or just copy the struct:
                 * __save_dsp(p);
@@@ -256,6 -316,33 +271,14 @@@ __switch_to(struct task_struct *prev, s
                     : "r" (task_thread_info(next)));
  #endif
  
 -      /* If no tasks are using the UBC, we're done */
 -      if (ubc_usercnt == 0)
 -              /* If no tasks are using the UBC, we're done */;
 -      else if (next->thread.ubc_pc && next->mm) {
 -              int asid = 0;
 -#ifdef CONFIG_MMU
 -              asid |= cpu_asid(smp_processor_id(), next->mm);
 -#endif
 -              ubc_set_tracing(asid, next->thread.ubc_pc);
 -      } else {
 -#if defined(CONFIG_CPU_SH4A)
 -              ctrl_outl(UBC_CBR_INIT, UBC_CBR0);
 -              ctrl_outl(UBC_CRR_INIT, UBC_CRR0);
 -#else
 -              ctrl_outw(0, UBC_BBRA);
 -              ctrl_outw(0, UBC_BBRB);
 -#endif
 -      }
 -
+       /*
+        * 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
+        */
+       if (next->fpu_counter > 5)
+               fpu_state_restore(task_pt_regs(next));
        return prev;
  }