From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: xenomai@lists.linux.dev, Jan Kiszka <jan.kiszka@siemens.com>,
Tobias Schaffner <tobias.schaffner@siemens.com>
Subject: Re: [PATCH Dovetail v3 3/6] arm: irq_pipeline: Fix dovetail_fault_{entry,exit} bypass in hw_breakpoint_pending
Date: Mon, 22 Jun 2026 15:51:13 +0200 [thread overview]
Message-ID: <87pl1iel9q.fsf@xenomai.org> (raw)
In-Reply-To: <14287accb71c52ee73c768e6a9b4421670cc39ec.camel@siemens.com> (Florian Bezdeka's message of "Mon, 22 Jun 2026 15:44:58 +0200")
Florian Bezdeka <florian.bezdeka@siemens.com> writes:
> On Mon, 2026-06-22 at 10:05 +0200, Florian Bezdeka wrote:
>> HW breakpoint / watchpoint handling was bypassing the
>> dovetail_fault_{entry,exit} machinery. As a result it could happen that
>> the inband IRQ mask was touched from the OOB stage.
>>
>> There is one more problem in the HW bp/wp handling related to
>> interrupts_enabled(). This one will be fixed in a separate patch.
>>
>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>> ---
>> arch/arm/include/asm/dovetail.h | 1 +
>> arch/arm/include/asm/trace/exceptions.h | 3 ++-
>> arch/arm/kernel/hw_breakpoint.c | 6 ++++++
>> 3 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/include/asm/dovetail.h b/arch/arm/include/asm/dovetail.h
>> index 795a1fb903ec29f4c2fb7b25e70980796804acc0..eeb5d16ad032044a2587822f6b35074d664a9bbc 100644
>> --- a/arch/arm/include/asm/dovetail.h
>> +++ b/arch/arm/include/asm/dovetail.h
>> @@ -16,6 +16,7 @@
>> #define ARM_TRAP_VFP 6 /* VFP floating point exception */
>> #define ARM_TRAP_UNDEFINSTR 7 /* Undefined instruction */
>> #define ARM_TRAP_ALIGNMENT 8 /* Unaligned access exception */
>> +#define ARM_TRAP_HW_BREAK 9 /* HW break or watchpoint exception */
>>
>> #if !defined(__ASSEMBLY__)
>>
>> diff --git a/arch/arm/include/asm/trace/exceptions.h b/arch/arm/include/asm/trace/exceptions.h
>> index bdb666b3da4e364e0d7e33337be3e8ad8aeedb88..f0164e55efc31a4f363764d2c5c84761f3ea34d4 100644
>> --- a/arch/arm/include/asm/trace/exceptions.h
>> +++ b/arch/arm/include/asm/trace/exceptions.h
>> @@ -21,7 +21,8 @@
>> __trace_trap(ARM_TRAP_FPU), \
>> __trace_trap(ARM_TRAP_VFP), \
>> __trace_trap(ARM_TRAP_UNDEFINSTR), \
>> - __trace_trap(ARM_TRAP_ALIGNMENT))
>> + __trace_trap(ARM_TRAP_ALIGNMENT), \
>> + __trace_trap(ARM_TRAP_HW_BREAK))
>>
>> DECLARE_EVENT_CLASS(ARM_trap_event,
>> TP_PROTO(int trapnr, struct pt_regs *regs),
>> diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
>> index cd4b34c96e35e9e63e9a1ade1aeb415c22d32b00..6266380737dd88dca7fe8fde14b786a52ec42635 100644
>> --- a/arch/arm/kernel/hw_breakpoint.c
>> +++ b/arch/arm/kernel/hw_breakpoint.c
>> @@ -26,6 +26,7 @@
>> #include <asm/current.h>
>> #include <asm/hw_breakpoint.h>
>> #include <asm/traps.h>
>> +#include <asm/trap_entry.h>
>>
>> /* Breakpoint currently in use for each BRP. */
>> static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]);
>> @@ -942,9 +943,12 @@ static void hw_breakpoint_cfi_handler(struct pt_regs *regs)
>> static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
>> struct pt_regs *regs)
>> {
>> + unsigned long irqflags;
>> int ret = 0;
>> u32 dscr;
>>
>> + irqflags = dovetail_fault_entry(ARM_TRAP_HW_BREAK, regs);
>> +
>> preempt_disable();
>
> Philippe, is that the right ordering or should I move the
> dovetail_fault_entry() code below the preempt_disable() call?
>
> Normally we want preemption enabled as long as possible and I couldn't
> find a reason why the oob notify mechanism needs it already disabled,
> but as always I might have missed something.
>
I don't see any reason to disable in-band preemption before handling the
fault entry, especially with a potential stage switch. The ordering you
used is correct.
--
Philippe.
next prev parent reply other threads:[~2026-06-22 13:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 8:05 [PATCH Dovetail v3 0/6] Dovetail: arm: Finalize review results Florian Bezdeka
2026-06-22 8:05 ` [PATCH Dovetail v3 1/6] arm: irq_pipeline: Rename and move fault_entry_{enter,exit} Florian Bezdeka
2026-06-22 8:05 ` [PATCH Dovetail v3 2/6] arm: irq_pipeline: Fix dovetail_fault_{entry,exit} bypass in do_kernel_address_page_fault Florian Bezdeka
2026-06-22 8:05 ` [PATCH Dovetail v3 3/6] arm: irq_pipeline: Fix dovetail_fault_{entry,exit} bypass in hw_breakpoint_pending Florian Bezdeka
2026-06-22 13:44 ` Florian Bezdeka
2026-06-22 13:51 ` Philippe Gerum [this message]
2026-06-22 8:05 ` [PATCH Dovetail v3 4/6] arm: irq_pipeline: Fix ordering problem in alignment trap handling Florian Bezdeka
2026-06-22 8:05 ` [PATCH Dovetail v3 5/6] dovetail: Decouple kernel/irq/pipeline.c from irqstate bit definitions Florian Bezdeka
2026-06-22 8:05 ` [PATCH Dovetail v3 6/6] arm: irq_pipeline: Fix IRQ state checking in trap entry paths Florian Bezdeka
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=87pl1iel9q.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=florian.bezdeka@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=tobias.schaffner@siemens.com \
--cc=xenomai@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.