linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Gray <bgray@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Benjamin Gray <bgray@linux.ibm.com>
Subject: [PATCH 4/7] powerpc/watchpoints: Simplify watchpoint reinsertion
Date: Tue,  1 Aug 2023 11:17:41 +1000	[thread overview]
Message-ID: <20230801011744.153973-5-bgray@linux.ibm.com> (raw)
In-Reply-To: <20230801011744.153973-1-bgray@linux.ibm.com>

We only remove watchpoints when they have the perf_single_step flag set,
so we can reinsert them during the first iteration.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
---
 arch/powerpc/kernel/hw_breakpoint.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 624375c18882..bf8dda1a7e04 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -772,16 +772,6 @@ static int single_step_dabr_instruction(struct die_args *args)
 			perf_bp_event(bp, regs);
 
 		info->perf_single_step = false;
-	}
-
-	if (!found)
-		return NOTIFY_DONE;
-
-	for (int i = 0; i < nr_wp_slots(); i++) {
-		struct perf_event *bp = __this_cpu_read(bp_per_reg[i]);
-		if (!bp)
-			continue;
-
 		__set_breakpoint(i, counter_arch_bp(bp));
 	}
 
@@ -789,7 +779,7 @@ static int single_step_dabr_instruction(struct die_args *args)
 	 * If the process was being single-stepped by ptrace, let the
 	 * other single-step actions occur (e.g. generate SIGTRAP).
 	 */
-	if (test_thread_flag(TIF_SINGLESTEP))
+	if (!found || test_thread_flag(TIF_SINGLESTEP))
 		return NOTIFY_DONE;
 
 	return NOTIFY_STOP;
-- 
2.41.0


  parent reply	other threads:[~2023-08-01  1:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  1:17 [PATCH 0/7] Rework perf and ptrace watchpoint tracking Benjamin Gray
2023-08-01  1:17 ` [PATCH 1/7] powerpc/watchpoints: Explain thread_change_pc() more Benjamin Gray
2023-08-01  1:17 ` [PATCH 2/7] powerpc/watchpoints: Don't track info persistently Benjamin Gray
2023-08-01  1:17 ` [PATCH 3/7] powerpc/watchpoints: Track perf single step directly on the breakpoint Benjamin Gray
2023-08-01  1:17 ` Benjamin Gray [this message]
2023-08-01  1:17 ` [PATCH 5/7] powerpc/watchpoints: Remove ptrace/perf exclusion tracking Benjamin Gray
2023-08-01  1:17 ` [PATCH 6/7] selftests/powerpc/ptrace: Update ptrace-perf watchpoint selftest Benjamin Gray
2023-08-01  1:17 ` [PATCH 7/7] perf/hw_breakpoint: Remove arch breakpoint hooks Benjamin Gray
2023-08-01  9:50 ` [PATCH 0/7] Rework perf and ptrace watchpoint tracking Christophe Leroy
2023-08-02 12:00   ` Michael Ellerman
2023-08-23 11:55 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230801011744.153973-5-bgray@linux.ibm.com \
    --to=bgray@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).