aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/kernel/process.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-11-27 07:50:45 -0500
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2008-01-25 02:31:39 -0500
commit13b54a50525a9685065684e1e11258d27dd27bdf (patch)
tree5cc2dbceb4efff1810e5425617ce9bc850e1e8cb /arch/avr32/kernel/process.c
parent6ea6dd93c9454cc9521134f907bc970d09f460e4 (diff)
[AVR32] Enable debugging only when needed
Keep track of processes being debugged (including the kernel itself) and turn the OCD system on and off as appropriate. Since enabling debugging turns off some optimizations in the CPU core, this fixes the issue that enabling KProbes support or simply running a program under gdbserver will reduce system performance significantly until the next reboot. The CPU performance will still be reduced for all processes while a process is being debugged, but this is a lot better than reducing the performance forever. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/kernel/process.c')
-rw-r--r--arch/avr32/kernel/process.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index 9d6dac8af7a2..eaaa69bbdc38 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -103,7 +103,7 @@ EXPORT_SYMBOL(kernel_thread);
103 */ 103 */
104void exit_thread(void) 104void exit_thread(void)
105{ 105{
106 /* nothing to do */ 106 ocd_disable(current);
107} 107}
108 108
109void flush_thread(void) 109void flush_thread(void)
@@ -345,6 +345,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
345 p->thread.cpu_context.ksp = (unsigned long)childregs; 345 p->thread.cpu_context.ksp = (unsigned long)childregs;
346 p->thread.cpu_context.pc = (unsigned long)ret_from_fork; 346 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
347 347
348 if ((clone_flags & CLONE_PTRACE) && test_thread_flag(TIF_DEBUG))
349 ocd_enable(p);
350
348 return 0; 351 return 0;
349} 352}
350 353