Re: [PATCH 07/15] powerpc/watchpoint: Get watchpoint count dynamically while disabling them

From: Ravi Bangoria
Date: Wed Mar 18 2020 - 02:58:25 EST




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@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 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