linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: panand@redhat.com (Pratyush Anand)
To: linux-arm-kernel@lists.infradead.org
Subject: Query: arm64: hwbreakpoint: single stepping in case of custom overflow_handler
Date: Fri, 26 May 2017 16:42:33 +0530	[thread overview]
Message-ID: <d3b1a128-b97c-7e52-b30c-56ec3990381a@redhat.com> (raw)

Hi Will,

When we run test from samples/hw_breakpoint/data_breakpoint.c, it triggers 
continuous watchpoint exception handler.

Reproducer:
# insmod data_breakpoint.ko ksym=__sysrq_enabled
# cat /proc/sys/kernel/sysrq

So, wanted to understand that why do we not allow single stepping in case 
overflow_handler is a customized one and not from perf infrastructure?

Patch [1] allows to work with a custom overflow_handler, but I am not sure if 
that could be an acceptable choice.

There are issues with samples/hw_breakpoint/data_breakpoint.c, even when using 
patch [1],because overflow_handler  of test calls dump_stack(). I am not yet 
sure,what happened here..my guess is that dump_stack() triggered a SW BRK 
exception somewhere. Anyway,thats a secondary problem,I can look into if patch 
[1] makes sense.


~Pratyush

[1]
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 749f81779420..ea8ab0656dd0 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -661,7 +661,7 @@ static int breakpoint_handler(unsigned long unused, 
unsigned int esr,
                 perf_bp_event(bp, regs);

                 /* Do we need to handle the stepping? */
-               if (is_default_overflow_handler(bp))
+               if (bp->overflow_handler)
                         step = 1;
  unlock:
                 rcu_read_unlock();
@@ -789,7 +789,7 @@ static int watchpoint_handler(unsigned long addr, unsigned 
int esr,
                 perf_bp_event(wp, regs);

                 /* Do we need to handle the stepping? */
-               if (is_default_overflow_handler(wp))
+               if (wp->overflow_handler)
                         step = 1;
         }
         if (min_dist > 0 && min_dist != -1) {
@@ -800,7 +800,7 @@ static int watchpoint_handler(unsigned long addr, unsigned 
int esr,
                 perf_bp_event(wp, regs);

                 /* Do we need to handle the stepping? */
-               if (is_default_overflow_handler(wp))
+               if (wp->overflow_handler)
                         step = 1;
         }
         rcu_read_unlock();

             reply	other threads:[~2017-05-26 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 11:12 Pratyush Anand [this message]
2017-05-26 11:26 ` Query: arm64: hwbreakpoint: single stepping in case of custom overflow_handler Mark Rutland
2017-05-26 14:08   ` Pratyush Anand

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=d3b1a128-b97c-7e52-b30c-56ec3990381a@redhat.com \
    --to=panand@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.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).