Le 01/04/2020 Ã 08:13, Ravi Bangoria a ÃcritÂ:
Instead of disabling only one watchpoint, get num of available
watchpoints dynamically and disable all of them.
Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx>
---
 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 4e4976c3248b..fae33c729ba9 100644
--- a/arch/powerpc/include/asm/hw_breakpoint.h
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -78,14 +78,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};
Those declaration should be in the block unsigned them below.
+
+ÂÂÂ if (ppc_breakpoint_available()) {
+ÂÂÂÂÂÂÂ for (i = 0; i < nr_wp_slots(); i++)
+ÂÂÂÂÂÂÂÂÂÂÂ __set_breakpoint(&null_brk, i);
+ÂÂÂ }
I would have had a preference to the following, but that's detail I guess:
ÂÂÂÂint i;
ÂÂÂÂstruct arch_hw_breakpoint null_brk = {0};
ÂÂÂÂif (!ppc_breakpoint_available())
ÂÂÂÂÂÂÂ return;
ÂÂÂÂfor (i = 0; i < nr_wp_slots(); i++)
ÂÂÂÂÂÂÂ __set_breakpoint(&null_brk, i);