From 13b54a50525a9685065684e1e11258d27dd27bdf Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Tue, 27 Nov 2007 13:50:45 +0100 Subject: [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 --- arch/avr32/kernel/ptrace.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'arch/avr32/kernel/ptrace.c') diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c index 002369e4409..1fed38fcf59 100644 --- a/arch/avr32/kernel/ptrace.c +++ b/arch/avr32/kernel/ptrace.c @@ -58,6 +58,7 @@ void ptrace_disable(struct task_struct *child) { clear_tsk_thread_flag(child, TIF_SINGLE_STEP); clear_tsk_thread_flag(child, TIF_BREAKPOINT); + ocd_disable(child); } /* @@ -144,10 +145,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) { int ret; - pr_debug("ptrace: Enabling monitor mode...\n"); - ocd_write(DC, ocd_read(DC) | (1 << OCD_DC_MM_BIT) - | (1 << OCD_DC_DBE_BIT)); - switch (request) { /* Read the word at location addr in the child process */ case PTRACE_PEEKTEXT: -- cgit v1.2.3