Message ID | 20200309085806.155823-8-ravi.bangoria@linux.ibm.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | powerpc/watchpoint: Preparation for more than one watchpoint | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (ab326587bb5fb91cc97df9b9f48e9e1469f04621) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 21 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Le 09/03/2020 à 09:57, Ravi Bangoria a écrit : > Instead of disabling only one watchpooint, get num of available > watchpoints dynamically and disable all of them. > > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> > --- > arch/powerpc/include/asm/hw_breakpoint.h | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h > index 980ac7d9f267..ec61e2b7195c 100644 > --- a/arch/powerpc/include/asm/hw_breakpoint.h > +++ b/arch/powerpc/include/asm/hw_breakpoint.h > @@ -75,14 +75,13 @@ extern void ptrace_triggered(struct perf_event *bp, > struct perf_sample_data *data, struct pt_regs *regs); > static inline void hw_breakpoint_disable(void) > { > - struct arch_hw_breakpoint brk; > - > - brk.address = 0; > - brk.type = 0; > - brk.len = 0; > - brk.hw_len = 0; > - if (ppc_breakpoint_available()) > - __set_breakpoint(&brk, 0); > + int i; > + struct arch_hw_breakpoint null_brk = {0}; > + > + if (ppc_breakpoint_available()) { I think this test should go into nr_wp_slots() which should return zero when no breakpoint is available. This would simplify at least here and patch 4 Christophe > + for (i = 0; i < nr_wp_slots(); i++) > + __set_breakpoint(&null_brk, i); > + } > } > extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs); > int hw_breakpoint_handler(struct die_args *args); >
On 3/17/20 4:02 PM, Christophe Leroy wrote: > > > Le 09/03/2020 à 09:57, Ravi Bangoria a écrit : >> Instead of disabling only one watchpooint, get num of available >> watchpoints dynamically and disable all of them. >> >> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> >> --- >> arch/powerpc/include/asm/hw_breakpoint.h | 15 +++++++-------- >> 1 file changed, 7 insertions(+), 8 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h >> index 980ac7d9f267..ec61e2b7195c 100644 >> --- a/arch/powerpc/include/asm/hw_breakpoint.h >> +++ b/arch/powerpc/include/asm/hw_breakpoint.h >> @@ -75,14 +75,13 @@ extern void ptrace_triggered(struct perf_event *bp, >> struct perf_sample_data *data, struct pt_regs *regs); >> static inline void hw_breakpoint_disable(void) >> { >> - struct arch_hw_breakpoint brk; >> - >> - brk.address = 0; >> - brk.type = 0; >> - brk.len = 0; >> - brk.hw_len = 0; >> - if (ppc_breakpoint_available()) >> - __set_breakpoint(&brk, 0); >> + int i; >> + struct arch_hw_breakpoint null_brk = {0}; >> + >> + if (ppc_breakpoint_available()) { > > I think this test should go into nr_wp_slots() which should return zero when no breakpoint is available. Seems possible. Will change it in next version. Thanks, Ravi
On 3/18/20 12:27 PM, Ravi Bangoria wrote: > > > On 3/17/20 4:02 PM, Christophe Leroy wrote: >> >> >> Le 09/03/2020 à 09:57, Ravi Bangoria a écrit : >>> Instead of disabling only one watchpooint, get num of available >>> watchpoints dynamically and disable all of them. >>> >>> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> >>> --- >>> arch/powerpc/include/asm/hw_breakpoint.h | 15 +++++++-------- >>> 1 file changed, 7 insertions(+), 8 deletions(-) >>> >>> diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h >>> index 980ac7d9f267..ec61e2b7195c 100644 >>> --- a/arch/powerpc/include/asm/hw_breakpoint.h >>> +++ b/arch/powerpc/include/asm/hw_breakpoint.h >>> @@ -75,14 +75,13 @@ extern void ptrace_triggered(struct perf_event *bp, >>> struct perf_sample_data *data, struct pt_regs *regs); >>> static inline void hw_breakpoint_disable(void) >>> { >>> - struct arch_hw_breakpoint brk; >>> - >>> - brk.address = 0; >>> - brk.type = 0; >>> - brk.len = 0; >>> - brk.hw_len = 0; >>> - if (ppc_breakpoint_available()) >>> - __set_breakpoint(&brk, 0); >>> + int i; >>> + struct arch_hw_breakpoint null_brk = {0}; >>> + >>> + if (ppc_breakpoint_available()) { >> >> I think this test should go into nr_wp_slots() which should return zero when no breakpoint is available. > > Seems possible. Will change it in next version. Once we move ppc_breakpoint_available() logic into nr_wp_slots(), 'dawr_force_enable' variable is checked in nr_wp_slots() before it gets initialized in dawr_force_setup(): start_kernel() |-> perf_event_init() | init_hw_breakpoint() | hw_breakpoint_slots() | nr_wp_slots() | /* Check dawr_force_enable variable */ | |-> arch_call_rest_init() rest_init() kernel_thread(kernel_init, ...) ... kernel_init() kernel_init_freeable() ... do_one_initcall() dawr_force_setup() /* Set dawr_force_enable = true */ Because of this, hw-breakpoint infrastructure is initialized with no DAWRs. So I'm thinking to keep the code as it is i.e. not moving ppc_breakpoint_available() test inside nr_wp_slots(). Ravi
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h index 980ac7d9f267..ec61e2b7195c 100644 --- a/arch/powerpc/include/asm/hw_breakpoint.h +++ b/arch/powerpc/include/asm/hw_breakpoint.h @@ -75,14 +75,13 @@ extern void ptrace_triggered(struct perf_event *bp, struct perf_sample_data *data, struct pt_regs *regs); static inline void hw_breakpoint_disable(void) { - struct arch_hw_breakpoint brk; - - brk.address = 0; - brk.type = 0; - brk.len = 0; - brk.hw_len = 0; - if (ppc_breakpoint_available()) - __set_breakpoint(&brk, 0); + int i; + struct arch_hw_breakpoint null_brk = {0}; + + if (ppc_breakpoint_available()) { + for (i = 0; i < nr_wp_slots(); i++) + __set_breakpoint(&null_brk, i); + } } extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs); int hw_breakpoint_handler(struct die_args *args);
Instead of disabling only one watchpooint, get num of available watchpoints dynamically and disable all of them. Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> --- arch/powerpc/include/asm/hw_breakpoint.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)