linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Bhupesh Sharma <bhsharma@redhat.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Mark Rutland <mark.rutland@arm.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	bhsharma@redhat.com, linux-kernel@vger.kernel.org,
	bhupesh.linux@gmail.com, Will Deacon <will@kernel.org>
Subject: [PATCH 2/2] perf/arm64: Allow per-task kernel breakpoints
Date: Tue,  4 Feb 2020 03:56:24 +0530	[thread overview]
Message-ID: <1580768784-25868-3-git-send-email-bhsharma@redhat.com> (raw)
In-Reply-To: <1580768784-25868-1-git-send-email-bhsharma@redhat.com>

commit 478fcb2cdb23 ("arm64: Debugging support") disallowed per-task
kernel breakpoints on arm64 since these would have potentially
complicated the stepping code.

However, we now have several use-cases (for e.g. perf) which require
per-task address execution h/w breakpoint to be exercised/set on arm64:

For e.g. we can set address execution h/w breakpoints, using the
format prescribed by 'perf-list' command:
mem:<addr>[/len][:access]                          [Hardware breakpoint]

Without this patch, currently 'perf stat -e' reports that per-task
address execution h/w breakpoints are 'not supported' on arm64. See
below:

$ TEST_FUNC="vfs_read"
$ ADDR=0x`cat /proc/kallsyms | grep -P "\\s$TEST_FUNC\$" | cut -f1 -d' '`
$ perf stat -e mem:$ADDR:x -x';' -- cat /proc/cpuinfo > /dev/null

<not supported>;;mem:0xffff00001031dd68:x;0;100.00;;

After this patch, this use-case can be supported:

$ TEST_FUNC="vfs_read"
$ ADDR=0x`cat /proc/kallsyms | grep -P "\\s$TEST_FUNC\$" | cut -f1 -d' '`
$ perf stat -e mem:$ADDR:x -x';' -- cat /proc/cpuinfo > /dev/null

5;;mem:0xfffffe0010361d20:x;912200;100.00;;

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
---
 arch/arm64/kernel/hw_breakpoint.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 0b727edf4104..c28f04e02845 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -562,13 +562,6 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
 	hw->address &= ~alignment_mask;
 	hw->ctrl.len <<= offset;
 
-	/*
-	 * Disallow per-task kernel breakpoints since these would
-	 * complicate the stepping code.
-	 */
-	if (hw->ctrl.privilege == AARCH64_BREAKPOINT_EL1 && bp->hw.target)
-		return -EINVAL;
-
 	return 0;
 }
 
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-02-03 22:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 22:26 [PATCH 0/2] Fix some arm64 perf issues Bhupesh Sharma
2020-02-03 22:26 ` [PATCH 1/2] hw_breakpoint: Remove unused '__register_perf_hw_breakpoint' declaration Bhupesh Sharma
2020-02-03 22:26 ` Bhupesh Sharma [this message]
2020-02-06 10:38   ` [PATCH 2/2] perf/arm64: Allow per-task kernel breakpoints Will Deacon
2020-02-07  7:22     ` Bhupesh Sharma

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=1580768784-25868-3-git-send-email-bhsharma@redhat.com \
    --to=bhsharma@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bhupesh.linux@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.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).