[Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
Modify process handling code to recognise hardware debug registers during copy and flush operations. Introduce a new TIF_DEBUG task flag to indicate a process's use of debug register. Load the debug register values into a new CPU during initialisation. Signed-off-by: K.Prasad --- arch/powerpc/kernel/process.c | 15 +++ arch/powerpc/kernel/smp.c |2 ++ 2 files changed, 17 insertions(+) Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c @@ -50,6 +50,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #include #include @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig 11, SIGSEGV) == NOTIFY_STOP) return; +#ifndef CONFIG_PPC64 if (debugger_dabr_match(regs)) return; +#endif /* Clear the DAC and struct entries. One shot trigger */ #if defined(CONFIG_BOOKE) @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t #endif /* CONFIG_SMP */ +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG))) + arch_install_thread_hw_breakpoint(new); +#else if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) set_dabr(new->thread.dabr); +#endif /* CONFIG_PPC64 */ #if defined(CONFIG_BOOKE) /* If new thread DAC (HW breakpoint) is the same then leave it */ @@ -550,6 +558,10 @@ void show_regs(struct pt_regs * regs) void exit_thread(void) { discard_lazy_cpu_state(); +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + flush_thread_hw_breakpoint(current); +#endif /* CONFIG_PPC64 */ } void flush_thread(void) @@ -672,6 +684,9 @@ int copy_thread(unsigned long clone_flag * function. */ kregs->nip = *((unsigned long *)ret_from_fork); + + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + copy_thread_hw_breakpoint(current, p, clone_flags); #else kregs->nip = (unsigned long)ret_from_fork; #endif Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/smp.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c @@ -48,6 +48,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #ifdef DEBUG @@ -537,6 +538,7 @@ int __devinit start_secondary(void *unus local_irq_enable(); + load_debug_registers(); cpu_idle(); return 0; } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
On Thu, Jun 18, 2009 at 11:26:23PM +0530, K.Prasad wrote: > On Wed, Jun 17, 2009 at 02:14:20PM +1000, David Gibson wrote: > > On Wed, Jun 10, 2009 at 02:38:18PM +0530, K.Prasad wrote: [snip] > > > @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig > > > 11, SIGSEGV) == NOTIFY_STOP) > > > return; > > > > > > +#ifndef CONFIG_PPC64 > > > if (debugger_dabr_match(regs)) > > > return; > > > +#endif > > > > Won't this disable the check for breakpoints set by xmon - but I don't > > see anything in this patch series to convert xmon to use the new > > breakpoint interface instead. > > As noted by me here: > http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-May/071832.html the > Xmon integration is pending. When I tried to study and integrate Xmon, I > found that the HW Breakpoint triggering was broken as of 2.6.29 kernel > (tested on a Power5 box). > > This would mean that if Xmon's hardware breakpoint infrastructure is > used in tandem with the given breakpoint interfaces, they would conflict > with each other resulting in difficult-to-predict behaviour (the last to > grab the register will use it). > > I think that tidying up do_dabr() is best done along with Xmon > integration. Hmm, ok. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
On Wed, Jun 17, 2009 at 02:14:20PM +1000, David Gibson wrote: > On Wed, Jun 10, 2009 at 02:38:18PM +0530, K.Prasad wrote: > > Modify process handling code to recognise hardware debug registers during > > copy > > and flush operations. Introduce a new TIF_DEBUG task flag to indicate a > > process's use of debug register. Load the debug register values into a > > new CPU during initialisation. > > > > Signed-off-by: K.Prasad > > --- > > arch/powerpc/kernel/process.c | 15 +++ > > arch/powerpc/kernel/smp.c |2 ++ > > 2 files changed, 17 insertions(+) > > > > Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c > > === > > --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c > > +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c > > @@ -50,6 +50,7 @@ > > #include > > #ifdef CONFIG_PPC64 > > #include > > +#include > > #endif > > #include > > #include > > @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig > > 11, SIGSEGV) == NOTIFY_STOP) > > return; > > > > +#ifndef CONFIG_PPC64 > > if (debugger_dabr_match(regs)) > > return; > > +#endif > > Won't this disable the check for breakpoints set by xmon - but I don't > see anything in this patch series to convert xmon to use the new > breakpoint interface instead. > As noted by me here: http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-May/071832.html the Xmon integration is pending. When I tried to study and integrate Xmon, I found that the HW Breakpoint triggering was broken as of 2.6.29 kernel (tested on a Power5 box). This would mean that if Xmon's hardware breakpoint infrastructure is used in tandem with the given breakpoint interfaces, they would conflict with each other resulting in difficult-to-predict behaviour (the last to grab the register will use it). I think that tidying up do_dabr() is best done along with Xmon integration. > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au| minimalist, thank you. NOT _the_ > _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson Thanks, K.Prasad ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
On Wed, Jun 10, 2009 at 02:38:18PM +0530, K.Prasad wrote: > Modify process handling code to recognise hardware debug registers during copy > and flush operations. Introduce a new TIF_DEBUG task flag to indicate a > process's use of debug register. Load the debug register values into a > new CPU during initialisation. > > Signed-off-by: K.Prasad > --- > arch/powerpc/kernel/process.c | 15 +++ > arch/powerpc/kernel/smp.c |2 ++ > 2 files changed, 17 insertions(+) > > Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c > === > --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c > +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c > @@ -50,6 +50,7 @@ > #include > #ifdef CONFIG_PPC64 > #include > +#include > #endif > #include > #include > @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig > 11, SIGSEGV) == NOTIFY_STOP) > return; > > +#ifndef CONFIG_PPC64 > if (debugger_dabr_match(regs)) > return; > +#endif Won't this disable the check for breakpoints set by xmon - but I don't see anything in this patch series to convert xmon to use the new breakpoint interface instead. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
Modify process handling code to recognise hardware debug registers during copy and flush operations. Introduce a new TIF_DEBUG task flag to indicate a process's use of debug register. Load the debug register values into a new CPU during initialisation. Signed-off-by: K.Prasad --- arch/powerpc/kernel/process.c | 15 +++ arch/powerpc/kernel/smp.c |2 ++ 2 files changed, 17 insertions(+) Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c @@ -50,6 +50,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #include #include @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig 11, SIGSEGV) == NOTIFY_STOP) return; +#ifndef CONFIG_PPC64 if (debugger_dabr_match(regs)) return; +#endif /* Clear the DAC and struct entries. One shot trigger */ #if defined(CONFIG_BOOKE) @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t #endif /* CONFIG_SMP */ +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG))) + arch_install_thread_hw_breakpoint(new); +#else if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) set_dabr(new->thread.dabr); +#endif /* CONFIG_PPC64 */ #if defined(CONFIG_BOOKE) /* If new thread DAC (HW breakpoint) is the same then leave it */ @@ -550,6 +558,10 @@ void show_regs(struct pt_regs * regs) void exit_thread(void) { discard_lazy_cpu_state(); +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + flush_thread_hw_breakpoint(current); +#endif /* CONFIG_PPC64 */ } void flush_thread(void) @@ -672,6 +684,9 @@ int copy_thread(unsigned long clone_flag * function. */ kregs->nip = *((unsigned long *)ret_from_fork); + + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + copy_thread_hw_breakpoint(current, p, clone_flags); #else kregs->nip = (unsigned long)ret_from_fork; #endif Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/smp.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c @@ -48,6 +48,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #ifdef DEBUG @@ -536,6 +537,7 @@ int __devinit start_secondary(void *unus local_irq_enable(); + load_debug_registers(); cpu_idle(); return 0; } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
Modify process handling code to recognise hardware debug registers during copy and flush operations. Introduce a new TIF_DEBUG task flag to indicate a process's use of debug register. Load the debug register values into a new CPU during initialisation. Signed-off-by: K.Prasad --- arch/powerpc/include/asm/thread_info.h |2 ++ arch/powerpc/kernel/process.c | 15 +++ arch/powerpc/kernel/smp.c |2 ++ 3 files changed, 19 insertions(+) Index: linux-2.6-tip.hbkpt/arch/powerpc/include/asm/thread_info.h === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/include/asm/thread_info.h +++ linux-2.6-tip.hbkpt/arch/powerpc/include/asm/thread_info.h @@ -114,6 +114,7 @@ static inline struct thread_info *curren #define TIF_FREEZE 14 /* Freezing for suspend */ #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ #define TIF_ABI_PENDING16 /* 32/64 bit switch needed */ +#define TIF_DEBUG 17 /* uses debug registers */ /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1< #ifdef CONFIG_PPC64 #include +#include #endif #include #include @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig 11, SIGSEGV) == NOTIFY_STOP) return; +#ifndef CONFIG_PPC64 if (debugger_dabr_match(regs)) return; +#endif /* Clear the DAC and struct entries. One shot trigger */ #if defined(CONFIG_BOOKE) @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t #endif /* CONFIG_SMP */ +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG))) + arch_install_thread_hw_breakpoint(new); +#else if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) set_dabr(new->thread.dabr); +#endif /* CONFIG_PPC64 */ #if defined(CONFIG_BOOKE) /* If new thread DAC (HW breakpoint) is the same then leave it */ @@ -550,6 +558,10 @@ void show_regs(struct pt_regs * regs) void exit_thread(void) { discard_lazy_cpu_state(); +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + flush_thread_hw_breakpoint(current); +#endif /* CONFIG_PPC64 */ } void flush_thread(void) @@ -672,6 +684,9 @@ int copy_thread(unsigned long clone_flag * function. */ kregs->nip = *((unsigned long *)ret_from_fork); + + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + copy_thread_hw_breakpoint(current, p, clone_flags); #else kregs->nip = (unsigned long)ret_from_fork; #endif Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/smp.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c @@ -48,6 +48,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #ifdef DEBUG @@ -536,6 +537,7 @@ int __devinit start_secondary(void *unus local_irq_enable(); + load_debug_registers(); cpu_idle(); return 0; } ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
On Mon, May 25, 2009 at 06:46:50AM +0530, K.Prasad wrote: > Modify process handling code to recognise hardware debug registers during copy > and flush operations. Introduce a new TIF_DEBUG task flag to indicate a > process's use of debug register. Load the debug register values into a > new CPU during initialisation. [snip] > Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c > === > --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/process.c > +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/process.c > @@ -50,6 +50,7 @@ > #include > #ifdef CONFIG_PPC64 > #include > +#include > #endif > #include > #include > @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig > 11, SIGSEGV) == NOTIFY_STOP) > return; > > +#ifndef CONFIG_PPC64 > if (debugger_dabr_match(regs)) > return; > +#endif > > /* Clear the DAC and struct entries. One shot trigger */ > #if defined(CONFIG_BOOKE) > @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t > > #endif /* CONFIG_SMP */ > > +#ifdef CONFIG_PPC64 > + if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG))) > + arch_install_thread_hw_breakpoint(new); > +#else > if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) > set_dabr(new->thread.dabr); > +#endif /* CONFIG_PPC64 */ > > #if defined(CONFIG_BOOKE) > /* If new thread DAC (HW breakpoint) is the same then leave it */ > @@ -550,6 +558,10 @@ void show_regs(struct pt_regs * regs) > void exit_thread(void) > { > discard_lazy_cpu_state(); > +#ifdef CONFIG_PPC64 > + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) > + flush_thread_hw_breakpoint(current); > +#endif /* CONFIG_PPC64 */ > } > > void flush_thread(void) > @@ -605,6 +617,9 @@ int copy_thread(unsigned long clone_flag > struct pt_regs *childregs, *kregs; > extern void ret_from_fork(void); > unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; > +#ifdef CONFIG_PPC64 > + struct task_struct *tsk = current; I don't see any point to adding this variable, just reference current directly below. > +#endif > > CHECK_FULL_REGS(regs); > /* Copy registers */ > @@ -672,6 +687,9 @@ int copy_thread(unsigned long clone_flag >* function. >*/ > kregs->nip = *((unsigned long *)ret_from_fork); > + > + if (unlikely(test_tsk_thread_flag(tsk, TIF_DEBUG))) > + copy_thread_hw_breakpoint(tsk, p, clone_flags); > #else > kregs->nip = (unsigned long)ret_from_fork; > #endif -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
Modify process handling code to recognise hardware debug registers during copy and flush operations. Introduce a new TIF_DEBUG task flag to indicate a process's use of debug register. Load the debug register values into a new CPU during initialisation. Signed-off-by: K.Prasad --- arch/powerpc/include/asm/thread_info.h |2 ++ arch/powerpc/kernel/process.c | 18 ++ arch/powerpc/kernel/smp.c |2 ++ 3 files changed, 22 insertions(+) Index: linux-2.6-tip.hbkpt/arch/powerpc/include/asm/thread_info.h === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/include/asm/thread_info.h +++ linux-2.6-tip.hbkpt/arch/powerpc/include/asm/thread_info.h @@ -114,6 +114,7 @@ static inline struct thread_info *curren #define TIF_FREEZE 14 /* Freezing for suspend */ #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ #define TIF_ABI_PENDING16 /* 32/64 bit switch needed */ +#define TIF_DEBUG 17 /* uses debug registers */ /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1< #ifdef CONFIG_PPC64 #include +#include #endif #include #include @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig 11, SIGSEGV) == NOTIFY_STOP) return; +#ifndef CONFIG_PPC64 if (debugger_dabr_match(regs)) return; +#endif /* Clear the DAC and struct entries. One shot trigger */ #if defined(CONFIG_BOOKE) @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t #endif /* CONFIG_SMP */ +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG))) + arch_install_thread_hw_breakpoint(new); +#else if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) set_dabr(new->thread.dabr); +#endif /* CONFIG_PPC64 */ #if defined(CONFIG_BOOKE) /* If new thread DAC (HW breakpoint) is the same then leave it */ @@ -550,6 +558,10 @@ void show_regs(struct pt_regs * regs) void exit_thread(void) { discard_lazy_cpu_state(); +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + flush_thread_hw_breakpoint(current); +#endif /* CONFIG_PPC64 */ } void flush_thread(void) @@ -605,6 +617,9 @@ int copy_thread(unsigned long clone_flag struct pt_regs *childregs, *kregs; extern void ret_from_fork(void); unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; +#ifdef CONFIG_PPC64 + struct task_struct *tsk = current; +#endif CHECK_FULL_REGS(regs); /* Copy registers */ @@ -672,6 +687,9 @@ int copy_thread(unsigned long clone_flag * function. */ kregs->nip = *((unsigned long *)ret_from_fork); + + if (unlikely(test_tsk_thread_flag(tsk, TIF_DEBUG))) + copy_thread_hw_breakpoint(tsk, p, clone_flags); #else kregs->nip = (unsigned long)ret_from_fork; #endif Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/smp.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c @@ -48,6 +48,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #ifdef DEBUG @@ -536,6 +537,7 @@ int __devinit start_secondary(void *unus local_irq_enable(); + load_debug_registers(); cpu_idle(); return 0; } ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[RFC Patch 4/6] Modify process and processor handling code to recognise hardware debug registers
Modify process handling code to recognise hardware debug registers during copy and flush operations. Introduce a new TIF_DEBUG task flag to indicate a process's use of debug register. Load the debug register values into a new CPU during initialisation. Signed-off-by: K.Prasad --- arch/powerpc/include/asm/thread_info.h |2 ++ arch/powerpc/kernel/process.c | 18 ++ arch/powerpc/kernel/smp.c |2 ++ 3 files changed, 22 insertions(+) Index: linux-2.6-tip.hbkpt/arch/powerpc/include/asm/thread_info.h === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/include/asm/thread_info.h +++ linux-2.6-tip.hbkpt/arch/powerpc/include/asm/thread_info.h @@ -114,6 +114,7 @@ static inline struct thread_info *curren #define TIF_FREEZE 14 /* Freezing for suspend */ #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ #define TIF_ABI_PENDING16 /* 32/64 bit switch needed */ +#define TIF_DEBUG 17 /* uses debug registers */ /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1< #ifdef CONFIG_PPC64 #include +#include #endif #include #include @@ -254,8 +255,10 @@ void do_dabr(struct pt_regs *regs, unsig 11, SIGSEGV) == NOTIFY_STOP) return; +#ifndef CONFIG_PPC64 if (debugger_dabr_match(regs)) return; +#endif /* Clear the DAC and struct entries. One shot trigger */ #if defined(CONFIG_BOOKE) @@ -372,8 +375,13 @@ struct task_struct *__switch_to(struct t #endif /* CONFIG_SMP */ +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(new, TIF_DEBUG))) + arch_install_thread_hw_breakpoint(new); +#else if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) set_dabr(new->thread.dabr); +#endif /* CONFIG_PPC64 */ #if defined(CONFIG_BOOKE) /* If new thread DAC (HW breakpoint) is the same then leave it */ @@ -550,6 +558,10 @@ void show_regs(struct pt_regs * regs) void exit_thread(void) { discard_lazy_cpu_state(); +#ifdef CONFIG_PPC64 + if (unlikely(test_tsk_thread_flag(current, TIF_DEBUG))) + flush_thread_hw_breakpoint(current); +#endif /* CONFIG_PPC64 */ } void flush_thread(void) @@ -605,6 +617,9 @@ int copy_thread(unsigned long clone_flag struct pt_regs *childregs, *kregs; extern void ret_from_fork(void); unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; +#ifdef CONFIG_PPC64 + struct task_struct *tsk = current; +#endif CHECK_FULL_REGS(regs); /* Copy registers */ @@ -672,6 +687,9 @@ int copy_thread(unsigned long clone_flag * function. */ kregs->nip = *((unsigned long *)ret_from_fork); + + if (unlikely(test_tsk_thread_flag(tsk, TIF_DEBUG))) + copy_thread_hw_breakpoint(tsk, p, clone_flags); #else kregs->nip = (unsigned long)ret_from_fork; #endif Index: linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c === --- linux-2.6-tip.hbkpt.orig/arch/powerpc/kernel/smp.c +++ linux-2.6-tip.hbkpt/arch/powerpc/kernel/smp.c @@ -48,6 +48,7 @@ #include #ifdef CONFIG_PPC64 #include +#include #endif #ifdef DEBUG @@ -536,6 +537,7 @@ int __devinit start_secondary(void *unus local_irq_enable(); + load_debug_registers(); cpu_idle(); return 0; } ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev