Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hongyan Xia <hongyan.xia@transsion.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Jiazi Li <jiazi.li@transsion.com>, Pu Hu <hupu@transsion.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH 1/9] arm64/entry: Bound certain debug exception paths in instrumentation windows
Date: Mon, 3 Aug 2026 03:42:06 +0000	[thread overview]
Message-ID: <b1b75a31-24e7-49a4-88c8-bd0d0d441f97@transsion.com> (raw)
In-Reply-To: <amy0HHNl4GIdQ6qu@J2N7QTR9R3>

On 7/31/2026 10:41 PM, Mark Rutland wrote:
> On Mon, Jul 27, 2026 at 12:25:34PM +0000, Hongyan Xia wrote:
>> From: Hongyan Xia <hongyan.xia@transsion.com>
>>
>> The el1 debug exception handlers are noinstr, but their payload calls
>> (do_breakpoint(), do_watchpoint(), try_step_suspended_breakpoints()
>> and the Cortex-A76 erratum handler) are ordinary instrumentable code.
>>
>> Mark the boundaries explicitly with instrumentation_begin()/end(), in
>> the same style as x86 exception entries.
>>
>> The BRK handlers (do_el1_brk64(), do_el1_softstep()) will be dealt with
>> in later patches.
>>
>> Signed-off-by: Hongyan Xia <hongyan.xia@transsion.com>
> 
> Please don't do this.
> 
> The instrumentation_{begin,end}() markers don't do anything useful on
> arm64 (since we don't use objtoo, etc), and adding them to a subset of
> arm64's exception entry code gives the misleading impression that these
> cases are different from other exception entry cases.

Okay. I think it's a bit unclear what the scope of this series is. This 
series started out trying to make the whole debug_exception() path 
noinstr, not just Kprobe. With my recent involvement in Kprobe, the 
Kprobe part is handled carefully while other paths are hit with a giant 
instructiontation_{begin,end}() hammer.

I can see this is confusing. I'll limit the series to just Kprobe 
noinstr and make the commit messages clear. This should also drop a few 
patches in this series.

> 
> Mark.
> 
>> ---
>>   arch/arm64/kernel/entry-common.c | 19 +++++++++++++++++--
>>   1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
>> index ceb4eb11232a..466529cce1c3 100644
>> --- a/arch/arm64/kernel/entry-common.c
>> +++ b/arch/arm64/kernel/entry-common.c
>> @@ -6,6 +6,7 @@
>>    */
>>
>>   #include <linux/context_tracking.h>
>> +#include <linux/instrumentation.h>
>>   #include <linux/irq-entry-common.h>
>>   #include <linux/kasan.h>
>>   #include <linux/linkage.h>
>> @@ -380,7 +381,9 @@ static void noinstr el1_breakpt(struct pt_regs *regs, unsigned long esr)
>>
>>        state = arm64_enter_el1_dbg(regs);
>>        debug_exception_enter(regs);
>> +     instrumentation_begin();
>>        do_breakpoint(esr, regs);
>> +     instrumentation_end();
>>        debug_exception_exit(regs);
>>        arm64_exit_el1_dbg(regs, state);
>>   }
>> @@ -388,9 +391,15 @@ static void noinstr el1_breakpt(struct pt_regs *regs, unsigned long esr)
>>   static void noinstr el1_softstp(struct pt_regs *regs, unsigned long esr)
>>   {
>>        irqentry_state_t state;
>> +     bool handled;
>>
>>        state = arm64_enter_el1_dbg(regs);
>> -     if (!cortex_a76_erratum_1463225_debug_handler(regs)) {
>> +
>> +     instrumentation_begin();
>> +     handled = cortex_a76_erratum_1463225_debug_handler(regs);
>> +     instrumentation_end();
>> +
>> +     if (!handled) {
>>                debug_exception_enter(regs);
>>                /*
>>                 * After handling a breakpoint, we suspend the breakpoint
>> @@ -398,7 +407,11 @@ static void noinstr el1_softstp(struct pt_regs *regs, unsigned long esr)
>>                 * If we are stepping a suspended breakpoint there's nothing more to do:
>>                 * the single-step is complete.
>>                 */
>> -             if (!try_step_suspended_breakpoints(regs))
>> +             instrumentation_begin();
>> +             handled = try_step_suspended_breakpoints(regs);
>> +             instrumentation_end();
>> +
>> +             if (!handled)
>>                        do_el1_softstep(esr, regs);
>>                debug_exception_exit(regs);
>>        }
>> @@ -413,7 +426,9 @@ static void noinstr el1_watchpt(struct pt_regs *regs, unsigned long esr)
>>
>>        state = arm64_enter_el1_dbg(regs);
>>        debug_exception_enter(regs);
>> +     instrumentation_begin();
>>        do_watchpoint(far, esr, regs);
>> +     instrumentation_end();
>>        debug_exception_exit(regs);
>>        arm64_exit_el1_dbg(regs, state);
>>   }
>> --
>> 2.47.3
>>


  reply	other threads:[~2026-08-03  3:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1785153469.git.hongyan.xia@transsion.com>
2026-07-27 12:25 ` [RFC PATCH 1/9] arm64/entry: Bound certain debug exception paths in instrumentation windows Hongyan Xia
2026-07-31 14:41   ` Mark Rutland
2026-08-03  3:42     ` Hongyan Xia [this message]
2026-07-27 12:25 ` [RFC PATCH 2/9] arm64/entry: Make debug_exception_enter/exit() noinstr Hongyan Xia
2026-07-31 14:43   ` Mark Rutland
2026-07-27 12:25 ` [RFC PATCH 3/9] arm64/debug-monitors: Make do_el1_brk64()/do_el1_softstep() noinstr Hongyan Xia
2026-07-31 15:25   ` Mark Rutland
2026-08-03  3:54     ` Hongyan Xia
2026-07-27 12:25 ` [RFC PATCH 4/9] arm64/kprobes: Make the single-step machinery noinstr Hongyan Xia
2026-07-31 15:38   ` Mark Rutland
2026-08-03  4:31     ` Hongyan Xia
2026-08-04  9:27       ` Hongyan Xia
2026-07-27 12:25 ` [RFC PATCH 5/9] arm64/kprobes: Invoke pre/post handlers inside instrumentation Hongyan Xia
2026-07-31 15:44   ` Mark Rutland
2026-08-03  6:11     ` Hongyan Xia
2026-07-27 12:25 ` [RFC PATCH 6/9] arm64/kprobes: Make kprobe_fault_handler() noinstr Hongyan Xia
2026-07-31 15:57   ` Mark Rutland
2026-08-03  6:40     ` Hongyan Xia
2026-07-27 12:25 ` [RFC PATCH 7/9] arm64/kprobes: Drop the KPROBE_HIT_SS reentry special case Hongyan Xia
2026-07-27 12:25 ` [RFC PATCH 8/9] arm64/kprobes: Drop the XOL single-step fault PC check Hongyan Xia
2026-07-31 16:12   ` Mark Rutland
2026-07-27 12:25 ` [RFC PATCH 9/9] arm64/debug: Mark debug exception helpers __always_inline Hongyan Xia
2026-07-27 19:22   ` Nick Desaulniers
2026-07-27 21:49     ` Will Deacon
2026-07-28  2:03     ` Hongyan Xia
2026-07-29 18:08   ` Steven Rostedt
2026-07-30  0:03     ` Masami Hiramatsu
2026-07-30 11:50       ` Hongyan Xia
2026-07-31 16:15   ` Mark Rutland

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=b1b75a31-24e7-49a4-88c8-bd0d0d441f97@transsion.com \
    --to=hongyan.xia@transsion.com \
    --cc=catalin.marinas@arm.com \
    --cc=hupu@transsion.com \
    --cc=jiazi.li@transsion.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --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