Thread (36 messages) 36 messages, 2 authors, 2020-04-01

Re: [PATCH v2 08/16] powerpc/watchpoint: Disable all available watchpoints when !dawr_force_enable

From: Christophe Leroy <hidden>
Date: 2020-04-01 06:33:41
Also in: lkml


Le 01/04/2020 à 08:13, Ravi Bangoria a écrit :
Instead of disabling only first watchpoint, disable all available
watchpoints while clearing dawr_force_enable.
Can you also explain why you change the function name ?
quoted hunk ↗ jump to hunk
Signed-off-by: Ravi Bangoria <redacted>
---
  arch/powerpc/kernel/dawr.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/dawr.c b/arch/powerpc/kernel/dawr.c
index 311e51ee09f4..5c882f07ac7d 100644
--- a/arch/powerpc/kernel/dawr.c
+++ b/arch/powerpc/kernel/dawr.c
@@ -50,9 +50,13 @@ int set_dawr(struct arch_hw_breakpoint *brk, int nr)
  	return 0;
  }
  
-static void set_dawr_cb(void *info)
+static void disable_dawrs(void *info)
Wouldn't it be better to keep _cb at the end of the function ?
quoted hunk ↗ jump to hunk
  {
-	set_dawr(info, 0);
+	struct arch_hw_breakpoint null_brk = {0};
+	int i;
+
+	for (i = 0; i < nr_wp_slots(); i++)
+		set_dawr(&null_brk, i);
  }
  
  static ssize_t dawr_write_file_bool(struct file *file,
@@ -74,7 +78,7 @@ static ssize_t dawr_write_file_bool(struct file *file,
  
  	/* If we are clearing, make sure all CPUs have the DAWR cleared */
  	if (!dawr_force_enable)
-		smp_call_function(set_dawr_cb, &null_brk, 0);
+		smp_call_function(disable_dawrs, NULL, 0);
  
  	return rc;
  }
Christophe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help