* [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-03-29 18:16 ` Jisheng Zhang
0 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-03-29 18:16 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, Masami Hiramatsu
Cc: linux-riscv, linux-kernel
From: Jisheng Zhang <jszhang@kernel.org>
Current riscv's kprobe handlers are run with both preemption and
interrupt enabled, this violates kprobe requirements. Fix this issue
by keeping interrupts disabled for BREAKPOINT exception.
Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
arch/riscv/kernel/entry.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 744f3209c48d..4114b65698ec 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -130,6 +130,8 @@ skip_context_tracking:
*/
andi t0, s1, SR_PIE
beqz t0, 1f
+ li t0, EXC_BREAKPOINT
+ beq s4, t0, 1f
#ifdef CONFIG_TRACE_IRQFLAGS
call trace_hardirqs_on
#endif
--
2.31.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-03-29 18:16 ` Jisheng Zhang
0 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-03-29 18:16 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, Masami Hiramatsu
Cc: linux-riscv, linux-kernel
From: Jisheng Zhang <jszhang@kernel.org>
Current riscv's kprobe handlers are run with both preemption and
interrupt enabled, this violates kprobe requirements. Fix this issue
by keeping interrupts disabled for BREAKPOINT exception.
Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
arch/riscv/kernel/entry.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 744f3209c48d..4114b65698ec 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -130,6 +130,8 @@ skip_context_tracking:
*/
andi t0, s1, SR_PIE
beqz t0, 1f
+ li t0, EXC_BREAKPOINT
+ beq s4, t0, 1f
#ifdef CONFIG_TRACE_IRQFLAGS
call trace_hardirqs_on
#endif
--
2.31.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-03-29 18:16 ` Jisheng Zhang
@ 2021-03-30 9:33 ` Masami Hiramatsu
-1 siblings, 0 replies; 24+ messages in thread
From: Masami Hiramatsu @ 2021-03-30 9:33 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
Hi Jisheng,
On Tue, 30 Mar 2021 02:16:24 +0800
Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> Current riscv's kprobe handlers are run with both preemption and
> interrupt enabled, this violates kprobe requirements. Fix this issue
> by keeping interrupts disabled for BREAKPOINT exception.
Not only while the breakpoint exception but also until the end of
the single step (maybe you are using __BUG_INSN_32 ??) need to be
disable interrupts. Can this do that?
Thank you,
>
> Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/kernel/entry.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 744f3209c48d..4114b65698ec 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -130,6 +130,8 @@ skip_context_tracking:
> */
> andi t0, s1, SR_PIE
> beqz t0, 1f
> + li t0, EXC_BREAKPOINT
> + beq s4, t0, 1f
> #ifdef CONFIG_TRACE_IRQFLAGS
> call trace_hardirqs_on
> #endif
> --
> 2.31.0
>
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-03-30 9:33 ` Masami Hiramatsu
0 siblings, 0 replies; 24+ messages in thread
From: Masami Hiramatsu @ 2021-03-30 9:33 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
Hi Jisheng,
On Tue, 30 Mar 2021 02:16:24 +0800
Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> Current riscv's kprobe handlers are run with both preemption and
> interrupt enabled, this violates kprobe requirements. Fix this issue
> by keeping interrupts disabled for BREAKPOINT exception.
Not only while the breakpoint exception but also until the end of
the single step (maybe you are using __BUG_INSN_32 ??) need to be
disable interrupts. Can this do that?
Thank you,
>
> Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/kernel/entry.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 744f3209c48d..4114b65698ec 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -130,6 +130,8 @@ skip_context_tracking:
> */
> andi t0, s1, SR_PIE
> beqz t0, 1f
> + li t0, EXC_BREAKPOINT
> + beq s4, t0, 1f
> #ifdef CONFIG_TRACE_IRQFLAGS
> call trace_hardirqs_on
> #endif
> --
> 2.31.0
>
>
--
Masami Hiramatsu <mhiramat@kernel.org>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-03-30 9:33 ` Masami Hiramatsu
@ 2021-03-31 14:22 ` Jisheng Zhang
-1 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-03-31 14:22 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
On Tue, 30 Mar 2021 18:33:16 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> Hi Jisheng,
Hi Masami,
>
> On Tue, 30 Mar 2021 02:16:24 +0800
> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
>
> > From: Jisheng Zhang <jszhang@kernel.org>
> >
> > Current riscv's kprobe handlers are run with both preemption and
> > interrupt enabled, this violates kprobe requirements. Fix this issue
> > by keeping interrupts disabled for BREAKPOINT exception.
>
> Not only while the breakpoint exception but also until the end of
> the single step (maybe you are using __BUG_INSN_32 ??) need to be
> disable interrupts. Can this do that?
>
interrupt is disabled during "single step" by kprobes_save_local_irqflag()
and kprobes_restore_local_irqflag(). The code flow looks like:
do_trap_break() // for bp
kprobe_breakpoint_handler()
setup_singlestep()
kprobes_restore_local_irqflag()
do_trap_break() // for ss
kprobe_single_step_handler()
kprobes_restore_local_irqflag()
Thanks
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-03-31 14:22 ` Jisheng Zhang
0 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-03-31 14:22 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
On Tue, 30 Mar 2021 18:33:16 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> Hi Jisheng,
Hi Masami,
>
> On Tue, 30 Mar 2021 02:16:24 +0800
> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
>
> > From: Jisheng Zhang <jszhang@kernel.org>
> >
> > Current riscv's kprobe handlers are run with both preemption and
> > interrupt enabled, this violates kprobe requirements. Fix this issue
> > by keeping interrupts disabled for BREAKPOINT exception.
>
> Not only while the breakpoint exception but also until the end of
> the single step (maybe you are using __BUG_INSN_32 ??) need to be
> disable interrupts. Can this do that?
>
interrupt is disabled during "single step" by kprobes_save_local_irqflag()
and kprobes_restore_local_irqflag(). The code flow looks like:
do_trap_break() // for bp
kprobe_breakpoint_handler()
setup_singlestep()
kprobes_restore_local_irqflag()
do_trap_break() // for ss
kprobe_single_step_handler()
kprobes_restore_local_irqflag()
Thanks
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-03-31 14:22 ` Jisheng Zhang
@ 2021-04-01 0:30 ` Masami Hiramatsu
-1 siblings, 0 replies; 24+ messages in thread
From: Masami Hiramatsu @ 2021-04-01 0:30 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
Hi,
On Wed, 31 Mar 2021 22:22:44 +0800
Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> On Tue, 30 Mar 2021 18:33:16 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > Hi Jisheng,
>
> Hi Masami,
>
> >
> > On Tue, 30 Mar 2021 02:16:24 +0800
> > Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> >
> > > From: Jisheng Zhang <jszhang@kernel.org>
> > >
> > > Current riscv's kprobe handlers are run with both preemption and
> > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > by keeping interrupts disabled for BREAKPOINT exception.
> >
> > Not only while the breakpoint exception but also until the end of
> > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > disable interrupts. Can this do that?
> >
>
> interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> and kprobes_restore_local_irqflag(). The code flow looks like:
>
> do_trap_break() // for bp
> kprobe_breakpoint_handler()
> setup_singlestep()
> kprobes_restore_local_irqflag()
>
> do_trap_break() // for ss
> kprobe_single_step_handler()
> kprobes_restore_local_irqflag()
OK, thanks for the confirmation!
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks,
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-01 0:30 ` Masami Hiramatsu
0 siblings, 0 replies; 24+ messages in thread
From: Masami Hiramatsu @ 2021-04-01 0:30 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
Hi,
On Wed, 31 Mar 2021 22:22:44 +0800
Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> On Tue, 30 Mar 2021 18:33:16 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > Hi Jisheng,
>
> Hi Masami,
>
> >
> > On Tue, 30 Mar 2021 02:16:24 +0800
> > Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> >
> > > From: Jisheng Zhang <jszhang@kernel.org>
> > >
> > > Current riscv's kprobe handlers are run with both preemption and
> > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > by keeping interrupts disabled for BREAKPOINT exception.
> >
> > Not only while the breakpoint exception but also until the end of
> > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > disable interrupts. Can this do that?
> >
>
> interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> and kprobes_restore_local_irqflag(). The code flow looks like:
>
> do_trap_break() // for bp
> kprobe_breakpoint_handler()
> setup_singlestep()
> kprobes_restore_local_irqflag()
>
> do_trap_break() // for ss
> kprobe_single_step_handler()
> kprobes_restore_local_irqflag()
OK, thanks for the confirmation!
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks,
--
Masami Hiramatsu <mhiramat@kernel.org>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-04-01 0:30 ` Masami Hiramatsu
@ 2021-04-03 18:30 ` Maciej W. Rozycki
-1 siblings, 0 replies; 24+ messages in thread
From: Maciej W. Rozycki @ 2021-04-03 18:30 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Jisheng Zhang, Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren,
linux-riscv, linux-kernel
On Thu, 1 Apr 2021, Masami Hiramatsu wrote:
> > > > Current riscv's kprobe handlers are run with both preemption and
> > > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > > by keeping interrupts disabled for BREAKPOINT exception.
> > >
> > > Not only while the breakpoint exception but also until the end of
> > > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > > disable interrupts. Can this do that?
> > >
> >
> > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > and kprobes_restore_local_irqflag(). The code flow looks like:
> >
> > do_trap_break() // for bp
> > kprobe_breakpoint_handler()
> > setup_singlestep()
> > kprobes_restore_local_irqflag()
> >
> > do_trap_break() // for ss
> > kprobe_single_step_handler()
> > kprobes_restore_local_irqflag()
>
> OK, thanks for the confirmation!
Is this approach guaranteed to keep interrupt handling latency low enough
for the system not to be negatively affected, e.g. for the purpose of NTP
timekeeping?
Maciej
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-03 18:30 ` Maciej W. Rozycki
0 siblings, 0 replies; 24+ messages in thread
From: Maciej W. Rozycki @ 2021-04-03 18:30 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Jisheng Zhang, Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren,
linux-riscv, linux-kernel
On Thu, 1 Apr 2021, Masami Hiramatsu wrote:
> > > > Current riscv's kprobe handlers are run with both preemption and
> > > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > > by keeping interrupts disabled for BREAKPOINT exception.
> > >
> > > Not only while the breakpoint exception but also until the end of
> > > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > > disable interrupts. Can this do that?
> > >
> >
> > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > and kprobes_restore_local_irqflag(). The code flow looks like:
> >
> > do_trap_break() // for bp
> > kprobe_breakpoint_handler()
> > setup_singlestep()
> > kprobes_restore_local_irqflag()
> >
> > do_trap_break() // for ss
> > kprobe_single_step_handler()
> > kprobes_restore_local_irqflag()
>
> OK, thanks for the confirmation!
Is this approach guaranteed to keep interrupt handling latency low enough
for the system not to be negatively affected, e.g. for the purpose of NTP
timekeeping?
Maciej
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-04-03 18:30 ` Maciej W. Rozycki
@ 2021-04-08 11:23 ` Jisheng Zhang
-1 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-04-08 11:23 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Masami Hiramatsu, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Guo Ren, linux-riscv, linux-kernel
On Sat, 3 Apr 2021 20:30:53 +0200 (CEST)
"Maciej W. Rozycki" <macro@orcam.me.uk> wrote:
> CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
> On Thu, 1 Apr 2021, Masami Hiramatsu wrote:
>
> > > > > Current riscv's kprobe handlers are run with both preemption and
> > > > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > > > by keeping interrupts disabled for BREAKPOINT exception.
> > > >
> > > > Not only while the breakpoint exception but also until the end of
> > > > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > > > disable interrupts. Can this do that?
> > > >
> > >
> > > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > > and kprobes_restore_local_irqflag(). The code flow looks like:
> > >
> > > do_trap_break() // for bp
> > > kprobe_breakpoint_handler()
> > > setup_singlestep()
> > > kprobes_restore_local_irqflag()
> > >
> > > do_trap_break() // for ss
> > > kprobe_single_step_handler()
> > > kprobes_restore_local_irqflag()
> >
> > OK, thanks for the confirmation!
>
> Is this approach guaranteed to keep interrupt handling latency low enough
> for the system not to be negatively affected, e.g. for the purpose of NTP
> timekeeping?
IMHO, interrupt latency can't be ensured if kprobes is triggered.
thanks
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-08 11:23 ` Jisheng Zhang
0 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-04-08 11:23 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Masami Hiramatsu, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Guo Ren, linux-riscv, linux-kernel
On Sat, 3 Apr 2021 20:30:53 +0200 (CEST)
"Maciej W. Rozycki" <macro@orcam.me.uk> wrote:
> CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
> On Thu, 1 Apr 2021, Masami Hiramatsu wrote:
>
> > > > > Current riscv's kprobe handlers are run with both preemption and
> > > > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > > > by keeping interrupts disabled for BREAKPOINT exception.
> > > >
> > > > Not only while the breakpoint exception but also until the end of
> > > > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > > > disable interrupts. Can this do that?
> > > >
> > >
> > > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > > and kprobes_restore_local_irqflag(). The code flow looks like:
> > >
> > > do_trap_break() // for bp
> > > kprobe_breakpoint_handler()
> > > setup_singlestep()
> > > kprobes_restore_local_irqflag()
> > >
> > > do_trap_break() // for ss
> > > kprobe_single_step_handler()
> > > kprobes_restore_local_irqflag()
> >
> > OK, thanks for the confirmation!
>
> Is this approach guaranteed to keep interrupt handling latency low enough
> for the system not to be negatively affected, e.g. for the purpose of NTP
> timekeeping?
IMHO, interrupt latency can't be ensured if kprobes is triggered.
thanks
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-04-08 11:23 ` Jisheng Zhang
@ 2021-04-08 22:38 ` Masami Hiramatsu
-1 siblings, 0 replies; 24+ messages in thread
From: Masami Hiramatsu @ 2021-04-08 22:38 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Maciej W. Rozycki, Masami Hiramatsu, Jisheng Zhang,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
On Thu, 8 Apr 2021 19:23:48 +0800
Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:
> On Sat, 3 Apr 2021 20:30:53 +0200 (CEST)
> "Maciej W. Rozycki" <macro@orcam.me.uk> wrote:
>
> > CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.
> >
> >
> > On Thu, 1 Apr 2021, Masami Hiramatsu wrote:
> >
> > > > > > Current riscv's kprobe handlers are run with both preemption and
> > > > > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > > > > by keeping interrupts disabled for BREAKPOINT exception.
> > > > >
> > > > > Not only while the breakpoint exception but also until the end of
> > > > > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > > > > disable interrupts. Can this do that?
> > > > >
> > > >
> > > > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > > > and kprobes_restore_local_irqflag(). The code flow looks like:
> > > >
> > > > do_trap_break() // for bp
> > > > kprobe_breakpoint_handler()
> > > > setup_singlestep()
> > > > kprobes_restore_local_irqflag()
> > > >
> > > > do_trap_break() // for ss
> > > > kprobe_single_step_handler()
> > > > kprobes_restore_local_irqflag()
> > >
> > > OK, thanks for the confirmation!
> >
> > Is this approach guaranteed to keep interrupt handling latency low enough
> > for the system not to be negatively affected, e.g. for the purpose of NTP
> > timekeeping?
>
> IMHO, interrupt latency can't be ensured if kprobes is triggered.
Indeed. The latency depends on what the kprobe user handler does. Of course
it must be as minimal as possible... On x86, it is less than a few microseconds.
Thus it may be a jitter on hard realtime system, but not a big issue on
usual system like NTP timekeeping.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-08 22:38 ` Masami Hiramatsu
0 siblings, 0 replies; 24+ messages in thread
From: Masami Hiramatsu @ 2021-04-08 22:38 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Maciej W. Rozycki, Masami Hiramatsu, Jisheng Zhang,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, linux-riscv,
linux-kernel
On Thu, 8 Apr 2021 19:23:48 +0800
Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:
> On Sat, 3 Apr 2021 20:30:53 +0200 (CEST)
> "Maciej W. Rozycki" <macro@orcam.me.uk> wrote:
>
> > CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.
> >
> >
> > On Thu, 1 Apr 2021, Masami Hiramatsu wrote:
> >
> > > > > > Current riscv's kprobe handlers are run with both preemption and
> > > > > > interrupt enabled, this violates kprobe requirements. Fix this issue
> > > > > > by keeping interrupts disabled for BREAKPOINT exception.
> > > > >
> > > > > Not only while the breakpoint exception but also until the end of
> > > > > the single step (maybe you are using __BUG_INSN_32 ??) need to be
> > > > > disable interrupts. Can this do that?
> > > > >
> > > >
> > > > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > > > and kprobes_restore_local_irqflag(). The code flow looks like:
> > > >
> > > > do_trap_break() // for bp
> > > > kprobe_breakpoint_handler()
> > > > setup_singlestep()
> > > > kprobes_restore_local_irqflag()
> > > >
> > > > do_trap_break() // for ss
> > > > kprobe_single_step_handler()
> > > > kprobes_restore_local_irqflag()
> > >
> > > OK, thanks for the confirmation!
> >
> > Is this approach guaranteed to keep interrupt handling latency low enough
> > for the system not to be negatively affected, e.g. for the purpose of NTP
> > timekeeping?
>
> IMHO, interrupt latency can't be ensured if kprobes is triggered.
Indeed. The latency depends on what the kprobe user handler does. Of course
it must be as minimal as possible... On x86, it is less than a few microseconds.
Thus it may be a jitter on hard realtime system, but not a big issue on
usual system like NTP timekeeping.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-04-08 22:38 ` Masami Hiramatsu
@ 2021-04-08 22:45 ` Maciej W. Rozycki
-1 siblings, 0 replies; 24+ messages in thread
From: Maciej W. Rozycki @ 2021-04-08 22:45 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Jisheng Zhang, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Guo Ren, linux-riscv, linux-kernel
On Fri, 9 Apr 2021, Masami Hiramatsu wrote:
> > > Is this approach guaranteed to keep interrupt handling latency low enough
> > > for the system not to be negatively affected, e.g. for the purpose of NTP
> > > timekeeping?
> >
> > IMHO, interrupt latency can't be ensured if kprobes is triggered.
>
> Indeed. The latency depends on what the kprobe user handler does. Of course
> it must be as minimal as possible... On x86, it is less than a few microseconds.
> Thus it may be a jitter on hard realtime system, but not a big issue on
> usual system like NTP timekeeping.
Ack. Assuming that the breakpoint exception will only disable interrupts
if kprobes are in use it seems reasonable to me.
Thanks for double-checking.
Maciej
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-08 22:45 ` Maciej W. Rozycki
0 siblings, 0 replies; 24+ messages in thread
From: Maciej W. Rozycki @ 2021-04-08 22:45 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Jisheng Zhang, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Guo Ren, linux-riscv, linux-kernel
On Fri, 9 Apr 2021, Masami Hiramatsu wrote:
> > > Is this approach guaranteed to keep interrupt handling latency low enough
> > > for the system not to be negatively affected, e.g. for the purpose of NTP
> > > timekeeping?
> >
> > IMHO, interrupt latency can't be ensured if kprobes is triggered.
>
> Indeed. The latency depends on what the kprobe user handler does. Of course
> it must be as minimal as possible... On x86, it is less than a few microseconds.
> Thus it may be a jitter on hard realtime system, but not a big issue on
> usual system like NTP timekeeping.
Ack. Assuming that the breakpoint exception will only disable interrupts
if kprobes are in use it seems reasonable to me.
Thanks for double-checking.
Maciej
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-03-31 14:22 ` Jisheng Zhang
@ 2021-04-01 8:49 ` liaochang (A)
-1 siblings, 0 replies; 24+ messages in thread
From: liaochang (A) @ 2021-04-01 8:49 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Masami Hiramatsu, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Guo Ren, linux-riscv, linux-kernel
Hi Jisheng,
在 2021/3/31 22:22, Jisheng Zhang 写道:
> On Tue, 30 Mar 2021 18:33:16 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
>> Hi Jisheng,
>
> Hi Masami,
>
>>
>> On Tue, 30 Mar 2021 02:16:24 +0800
>> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
>>
>>> From: Jisheng Zhang <jszhang@kernel.org>
>>>
>>> Current riscv's kprobe handlers are run with both preemption and
>>> interrupt enabled, this violates kprobe requirements. Fix this issue
>>> by keeping interrupts disabled for BREAKPOINT exception.
>>
>> Not only while the breakpoint exception but also until the end of
>> the single step (maybe you are using __BUG_INSN_32 ??) need to be
>> disable interrupts. Can this do that?
>>
>
> interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> and kprobes_restore_local_irqflag(). The code flow looks like:
>
> do_trap_break() // for bp
> kprobe_breakpoint_handler()
> setup_singlestep()
> kprobes_restore_local_irqflag()
>
> do_trap_break() // for ss
> kprobe_single_step_handler()
> kprobes_restore_local_irqflag()
Recently, kernel hit BUG_ON() on QEMU after I install a probe at "sys_read" via kprobe,
accoriding to my debugging and analysis it looks like caused by the "irq disable" operation for single-stepping.
I present a detailed description about this problem in the mail with title "[PATCH] riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe".
Looking forward to some feedback,Thanks.
BR,
Liao Chang
>
> Thanks
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> .
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-01 8:49 ` liaochang (A)
0 siblings, 0 replies; 24+ messages in thread
From: liaochang (A) @ 2021-04-01 8:49 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Masami Hiramatsu, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Guo Ren, linux-riscv, linux-kernel
Hi Jisheng,
在 2021/3/31 22:22, Jisheng Zhang 写道:
> On Tue, 30 Mar 2021 18:33:16 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
>> Hi Jisheng,
>
> Hi Masami,
>
>>
>> On Tue, 30 Mar 2021 02:16:24 +0800
>> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
>>
>>> From: Jisheng Zhang <jszhang@kernel.org>
>>>
>>> Current riscv's kprobe handlers are run with both preemption and
>>> interrupt enabled, this violates kprobe requirements. Fix this issue
>>> by keeping interrupts disabled for BREAKPOINT exception.
>>
>> Not only while the breakpoint exception but also until the end of
>> the single step (maybe you are using __BUG_INSN_32 ??) need to be
>> disable interrupts. Can this do that?
>>
>
> interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> and kprobes_restore_local_irqflag(). The code flow looks like:
>
> do_trap_break() // for bp
> kprobe_breakpoint_handler()
> setup_singlestep()
> kprobes_restore_local_irqflag()
>
> do_trap_break() // for ss
> kprobe_single_step_handler()
> kprobes_restore_local_irqflag()
Recently, kernel hit BUG_ON() on QEMU after I install a probe at "sys_read" via kprobe,
accoriding to my debugging and analysis it looks like caused by the "irq disable" operation for single-stepping.
I present a detailed description about this problem in the mail with title "[PATCH] riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe".
Looking forward to some feedback,Thanks.
BR,
Liao Chang
>
> Thanks
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> .
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-04-01 8:49 ` liaochang (A)
@ 2021-04-02 13:32 ` Jisheng Zhang
-1 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-04-02 13:32 UTC (permalink / raw)
To: liaochang (A)
Cc: Masami Hiramatsu, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Guo Ren, linux-riscv, linux-kernel
On Thu, 1 Apr 2021 16:49:47 +0800
"liaochang (A)" <liaochang1@huawei.com> wrote:
> Hi Jisheng,
Hi,
>
> 在 2021/3/31 22:22, Jisheng Zhang 写道:
> > On Tue, 30 Mar 2021 18:33:16 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> >> Hi Jisheng,
> >
> > Hi Masami,
> >
> >>
> >> On Tue, 30 Mar 2021 02:16:24 +0800
> >> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> >>
> >>> From: Jisheng Zhang <jszhang@kernel.org>
> >>>
> >>> Current riscv's kprobe handlers are run with both preemption and
> >>> interrupt enabled, this violates kprobe requirements. Fix this issue
> >>> by keeping interrupts disabled for BREAKPOINT exception.
> >>
> >> Not only while the breakpoint exception but also until the end of
> >> the single step (maybe you are using __BUG_INSN_32 ??) need to be
> >> disable interrupts. Can this do that?
> >>
> >
> > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > and kprobes_restore_local_irqflag(). The code flow looks like:
> >
> > do_trap_break() // for bp
> > kprobe_breakpoint_handler()
> > setup_singlestep()
> > kprobes_restore_local_irqflag()
> >
> > do_trap_break() // for ss
> > kprobe_single_step_handler()
> > kprobes_restore_local_irqflag()
>
> Recently, kernel hit BUG_ON() on QEMU after I install a probe at "sys_read" via kprobe,
TIPS: Each line should not exceed 80 chars
> accoriding to my debugging and analysis it looks like caused by the "irq disable" operation for single-stepping.
>
> I present a detailed description about this problem in the mail with title "[PATCH] riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe".
> Looking forward to some feedback,Thanks.
>
I will comment that patch.
thanks
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-02 13:32 ` Jisheng Zhang
0 siblings, 0 replies; 24+ messages in thread
From: Jisheng Zhang @ 2021-04-02 13:32 UTC (permalink / raw)
To: liaochang (A)
Cc: Masami Hiramatsu, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Guo Ren, linux-riscv, linux-kernel
On Thu, 1 Apr 2021 16:49:47 +0800
"liaochang (A)" <liaochang1@huawei.com> wrote:
> Hi Jisheng,
Hi,
>
> 在 2021/3/31 22:22, Jisheng Zhang 写道:
> > On Tue, 30 Mar 2021 18:33:16 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> >> Hi Jisheng,
> >
> > Hi Masami,
> >
> >>
> >> On Tue, 30 Mar 2021 02:16:24 +0800
> >> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
> >>
> >>> From: Jisheng Zhang <jszhang@kernel.org>
> >>>
> >>> Current riscv's kprobe handlers are run with both preemption and
> >>> interrupt enabled, this violates kprobe requirements. Fix this issue
> >>> by keeping interrupts disabled for BREAKPOINT exception.
> >>
> >> Not only while the breakpoint exception but also until the end of
> >> the single step (maybe you are using __BUG_INSN_32 ??) need to be
> >> disable interrupts. Can this do that?
> >>
> >
> > interrupt is disabled during "single step" by kprobes_save_local_irqflag()
> > and kprobes_restore_local_irqflag(). The code flow looks like:
> >
> > do_trap_break() // for bp
> > kprobe_breakpoint_handler()
> > setup_singlestep()
> > kprobes_restore_local_irqflag()
> >
> > do_trap_break() // for ss
> > kprobe_single_step_handler()
> > kprobes_restore_local_irqflag()
>
> Recently, kernel hit BUG_ON() on QEMU after I install a probe at "sys_read" via kprobe,
TIPS: Each line should not exceed 80 chars
> accoriding to my debugging and analysis it looks like caused by the "irq disable" operation for single-stepping.
>
> I present a detailed description about this problem in the mail with title "[PATCH] riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe".
> Looking forward to some feedback,Thanks.
>
I will comment that patch.
thanks
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-04-02 13:32 ` Jisheng Zhang
@ 2021-04-06 7:27 ` liaochang (A)
-1 siblings, 0 replies; 24+ messages in thread
From: liaochang (A) @ 2021-04-06 7:27 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Masami Hiramatsu, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Guo Ren, linux-riscv, linux-kernel
Hi Jisheng,
在 2021/4/2 21:32, Jisheng Zhang 写道:
> On Thu, 1 Apr 2021 16:49:47 +0800
> "liaochang (A)" <liaochang1@huawei.com> wrote:
>
>> Hi Jisheng,
>
> Hi,
>
>>
>> 在 2021/3/31 22:22, Jisheng Zhang 写道:
>>> On Tue, 30 Mar 2021 18:33:16 +0900
>>> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>>>
>>>> Hi Jisheng,
>>>
>>> Hi Masami,
>>>
>>>>
>>>> On Tue, 30 Mar 2021 02:16:24 +0800
>>>> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
>>>>
>>>>> From: Jisheng Zhang <jszhang@kernel.org>
>>>>>
>>>>> Current riscv's kprobe handlers are run with both preemption and
>>>>> interrupt enabled, this violates kprobe requirements. Fix this issue
>>>>> by keeping interrupts disabled for BREAKPOINT exception.
>>>>
>>>> Not only while the breakpoint exception but also until the end of
>>>> the single step (maybe you are using __BUG_INSN_32 ??) need to be
>>>> disable interrupts. Can this do that?
>>>>
>>>
>>> interrupt is disabled during "single step" by kprobes_save_local_irqflag()
>>> and kprobes_restore_local_irqflag(). The code flow looks like:
>>>
>>> do_trap_break() // for bp
>>> kprobe_breakpoint_handler()
>>> setup_singlestep()
>>> kprobes_restore_local_irqflag()
>>>
>>> do_trap_break() // for ss
>>> kprobe_single_step_handler()
>>> kprobes_restore_local_irqflag()
>>
>> Recently, kernel hit BUG_ON() on QEMU after I install a probe at "sys_read" via kprobe,
>
> TIPS: Each line should not exceed 80 chars
>
>> accoriding to my debugging and analysis it looks like caused by the "irq disable" operation for single-stepping.
>>
>> I present a detailed description about this problem in the mail with title "[PATCH] riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe".
>> Looking forward to some feedback,Thanks.
>>
>
> I will comment that patch.
Thanks for your reminder.
>
> thanks
>
> .
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-06 7:27 ` liaochang (A)
0 siblings, 0 replies; 24+ messages in thread
From: liaochang (A) @ 2021-04-06 7:27 UTC (permalink / raw)
To: Jisheng Zhang
Cc: Masami Hiramatsu, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Guo Ren, linux-riscv, linux-kernel
Hi Jisheng,
在 2021/4/2 21:32, Jisheng Zhang 写道:
> On Thu, 1 Apr 2021 16:49:47 +0800
> "liaochang (A)" <liaochang1@huawei.com> wrote:
>
>> Hi Jisheng,
>
> Hi,
>
>>
>> 在 2021/3/31 22:22, Jisheng Zhang 写道:
>>> On Tue, 30 Mar 2021 18:33:16 +0900
>>> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>>>
>>>> Hi Jisheng,
>>>
>>> Hi Masami,
>>>
>>>>
>>>> On Tue, 30 Mar 2021 02:16:24 +0800
>>>> Jisheng Zhang <jszhang3@mail.ustc.edu.cn> wrote:
>>>>
>>>>> From: Jisheng Zhang <jszhang@kernel.org>
>>>>>
>>>>> Current riscv's kprobe handlers are run with both preemption and
>>>>> interrupt enabled, this violates kprobe requirements. Fix this issue
>>>>> by keeping interrupts disabled for BREAKPOINT exception.
>>>>
>>>> Not only while the breakpoint exception but also until the end of
>>>> the single step (maybe you are using __BUG_INSN_32 ??) need to be
>>>> disable interrupts. Can this do that?
>>>>
>>>
>>> interrupt is disabled during "single step" by kprobes_save_local_irqflag()
>>> and kprobes_restore_local_irqflag(). The code flow looks like:
>>>
>>> do_trap_break() // for bp
>>> kprobe_breakpoint_handler()
>>> setup_singlestep()
>>> kprobes_restore_local_irqflag()
>>>
>>> do_trap_break() // for ss
>>> kprobe_single_step_handler()
>>> kprobes_restore_local_irqflag()
>>
>> Recently, kernel hit BUG_ON() on QEMU after I install a probe at "sys_read" via kprobe,
>
> TIPS: Each line should not exceed 80 chars
>
>> accoriding to my debugging and analysis it looks like caused by the "irq disable" operation for single-stepping.
>>
>> I present a detailed description about this problem in the mail with title "[PATCH] riscv/kprobe: fix kernel panic when invoking sys_read traced by kprobe".
>> Looking forward to some feedback,Thanks.
>>
>
> I will comment that patch.
Thanks for your reminder.
>
> thanks
>
> .
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
2021-03-29 18:16 ` Jisheng Zhang
@ 2021-04-12 1:09 ` Palmer Dabbelt
-1 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2021-04-12 1:09 UTC (permalink / raw)
To: jszhang3; +Cc: Paul Walmsley, aou, guoren, mhiramat, linux-riscv, linux-kernel
On Mon, 29 Mar 2021 11:16:24 PDT (-0700), jszhang3@mail.ustc.edu.cn wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> Current riscv's kprobe handlers are run with both preemption and
> interrupt enabled, this violates kprobe requirements. Fix this issue
> by keeping interrupts disabled for BREAKPOINT exception.
>
> Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/kernel/entry.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 744f3209c48d..4114b65698ec 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -130,6 +130,8 @@ skip_context_tracking:
> */
> andi t0, s1, SR_PIE
> beqz t0, 1f
> + li t0, EXC_BREAKPOINT
> + beq s4, t0, 1f
> #ifdef CONFIG_TRACE_IRQFLAGS
> call trace_hardirqs_on
> #endif
This is on fixes, with a comment as otherwise I'm just going to forget
why.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception
@ 2021-04-12 1:09 ` Palmer Dabbelt
0 siblings, 0 replies; 24+ messages in thread
From: Palmer Dabbelt @ 2021-04-12 1:09 UTC (permalink / raw)
To: jszhang3; +Cc: Paul Walmsley, aou, guoren, mhiramat, linux-riscv, linux-kernel
On Mon, 29 Mar 2021 11:16:24 PDT (-0700), jszhang3@mail.ustc.edu.cn wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> Current riscv's kprobe handlers are run with both preemption and
> interrupt enabled, this violates kprobe requirements. Fix this issue
> by keeping interrupts disabled for BREAKPOINT exception.
>
> Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/kernel/entry.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 744f3209c48d..4114b65698ec 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -130,6 +130,8 @@ skip_context_tracking:
> */
> andi t0, s1, SR_PIE
> beqz t0, 1f
> + li t0, EXC_BREAKPOINT
> + beq s4, t0, 1f
> #ifdef CONFIG_TRACE_IRQFLAGS
> call trace_hardirqs_on
> #endif
This is on fixes, with a comment as otherwise I'm just going to forget
why.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2021-04-12 1:09 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 18:16 [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception Jisheng Zhang
2021-03-29 18:16 ` Jisheng Zhang
2021-03-30 9:33 ` Masami Hiramatsu
2021-03-30 9:33 ` Masami Hiramatsu
2021-03-31 14:22 ` Jisheng Zhang
2021-03-31 14:22 ` Jisheng Zhang
2021-04-01 0:30 ` Masami Hiramatsu
2021-04-01 0:30 ` Masami Hiramatsu
2021-04-03 18:30 ` Maciej W. Rozycki
2021-04-03 18:30 ` Maciej W. Rozycki
2021-04-08 11:23 ` Jisheng Zhang
2021-04-08 11:23 ` Jisheng Zhang
2021-04-08 22:38 ` Masami Hiramatsu
2021-04-08 22:38 ` Masami Hiramatsu
2021-04-08 22:45 ` Maciej W. Rozycki
2021-04-08 22:45 ` Maciej W. Rozycki
2021-04-01 8:49 ` liaochang (A)
2021-04-01 8:49 ` liaochang (A)
2021-04-02 13:32 ` Jisheng Zhang
2021-04-02 13:32 ` Jisheng Zhang
2021-04-06 7:27 ` liaochang (A)
2021-04-06 7:27 ` liaochang (A)
2021-04-12 1:09 ` Palmer Dabbelt
2021-04-12 1:09 ` Palmer Dabbelt
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.