mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
[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 <[email protected]>
This commit is contained in:
parent
6ea6dd93c9
commit
13b54a5052
8 changed files with 186 additions and 13 deletions
|
|
@ -533,6 +533,11 @@ static inline void __ocd_write(unsigned int reg, unsigned long value)
|
|||
#define ocd_read(reg) __ocd_read(OCD_##reg)
|
||||
#define ocd_write(reg, value) __ocd_write(OCD_##reg, value)
|
||||
|
||||
struct task_struct;
|
||||
|
||||
void ocd_enable(struct task_struct *child);
|
||||
void ocd_disable(struct task_struct *child);
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* __ASM_AVR32_OCD_H */
|
||||
|
|
|
|||
|
|
@ -121,7 +121,15 @@ struct pt_regs {
|
|||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
# define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
|
||||
|
||||
#include <asm/ocd.h>
|
||||
|
||||
#define arch_ptrace_attach(child) ocd_enable(child)
|
||||
|
||||
#define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
|
||||
#define instruction_pointer(regs) ((regs)->pc)
|
||||
#define profile_pc(regs) instruction_pointer(regs)
|
||||
|
||||
extern void show_regs (struct pt_regs *);
|
||||
|
||||
static __inline__ int valid_user_regs(struct pt_regs *regs)
|
||||
|
|
@ -141,9 +149,6 @@ static __inline__ int valid_user_regs(struct pt_regs *regs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define instruction_pointer(regs) ((regs)->pc)
|
||||
|
||||
#define profile_pc(regs) instruction_pointer(regs)
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ static inline struct thread_info *current_thread_info(void)
|
|||
#define TIF_MEMDIE 6
|
||||
#define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */
|
||||
#define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */
|
||||
#define TIF_DEBUG 30 /* debugging enabled */
|
||||
#define TIF_USERSPACE 31 /* true if FS sets userspace */
|
||||
|
||||
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue