linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: Trace irq on only interrupt is enabled
@ 2020-12-19  0:20 Atish Patra
  2021-01-13  4:36 ` Palmer Dabbelt
  0 siblings, 1 reply; 2+ messages in thread
From: Atish Patra @ 2020-12-19  0:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: Atish Patra, stable, Albert Ou, Anup Patel, Guo Ren, linux-riscv,
	Nick Desaulniers, Palmer Dabbelt, Paul Walmsley

We should call irq trace only if interrupt is going to be enabled during
excecption handling. Otherwise, it results in following warning during
boot with lock debugging enabled.

[    0.000000] ------------[ cut here ]------------
[    0.000000] DEBUG_LOCKS_WARN_ON(early_boot_irqs_disabled)
[    0.000000] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:4085 lockdep_hardirqs_on_prepare+0x22a/0x22e
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.10.0-00022-ge20097fb37e2-dirty #548
[    0.000000] epc: c005d5d4 ra : c005d5d4 sp : c1c01e80
[    0.000000]  gp : c1d456e0 tp : c1c0a980 t0 : 00000000
[    0.000000]  t1 : ffffffff t2 : 00000000 s0 : c1c01ea0
[    0.000000]  s1 : c100f360 a0 : 0000002d a1 : c00666ee
[    0.000000]  a2 : 00000000 a3 : 00000000 a4 : 00000000
[    0.000000]  a5 : 00000000 a6 : c1c6b390 a7 : 3ffff00e
[    0.000000]  s2 : c2384fe8 s3 : 00000000 s4 : 00000001
[    0.000000]  s5 : c1c0a980 s6 : c1d48000 s7 : c1613b4c
[    0.000000]  s8 : 00000fff s9 : 80000200 s10: c1613b40
[    0.000000]  s11: 00000000 t3 : 00000000 t4 : 00000000
[    0.000000]  t5 : 00000001 t6 : 00000000

Fixes: 3c4697982982 ("riscv:Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT")
Cc: stable@vger.kernel.org

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 arch/riscv/kernel/entry.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 524d918f3601..7dea5ee5a3ac 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -124,15 +124,15 @@ skip_context_tracking:
 	REG_L a1, (a1)
 	jr a1
 1:
-#ifdef CONFIG_TRACE_IRQFLAGS
-	call trace_hardirqs_on
-#endif
 	/*
 	 * Exceptions run with interrupts enabled or disabled depending on the
 	 * state of SR_PIE in m/sstatus.
 	 */
 	andi t0, s1, SR_PIE
 	beqz t0, 1f
+#ifdef CONFIG_TRACE_IRQFLAGS
+	call trace_hardirqs_on
+#endif
 	csrs CSR_STATUS, SR_IE
 
 1:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: Trace irq on only interrupt is enabled
  2020-12-19  0:20 [PATCH] riscv: Trace irq on only interrupt is enabled Atish Patra
@ 2021-01-13  4:36 ` Palmer Dabbelt
  0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2021-01-13  4:36 UTC (permalink / raw)
  To: Atish Patra
  Cc: linux-kernel, Atish Patra, stable, aou, Anup Patel, guoren,
	linux-riscv, Nick Desaulniers, Paul Walmsley

On Fri, 18 Dec 2020 16:20:51 PST (-0800), Atish Patra wrote:
> We should call irq trace only if interrupt is going to be enabled during
> excecption handling. Otherwise, it results in following warning during
> boot with lock debugging enabled.
>
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] DEBUG_LOCKS_WARN_ON(early_boot_irqs_disabled)
> [    0.000000] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:4085 lockdep_hardirqs_on_prepare+0x22a/0x22e
> [    0.000000] Modules linked in:
> [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.10.0-00022-ge20097fb37e2-dirty #548
> [    0.000000] epc: c005d5d4 ra : c005d5d4 sp : c1c01e80
> [    0.000000]  gp : c1d456e0 tp : c1c0a980 t0 : 00000000
> [    0.000000]  t1 : ffffffff t2 : 00000000 s0 : c1c01ea0
> [    0.000000]  s1 : c100f360 a0 : 0000002d a1 : c00666ee
> [    0.000000]  a2 : 00000000 a3 : 00000000 a4 : 00000000
> [    0.000000]  a5 : 00000000 a6 : c1c6b390 a7 : 3ffff00e
> [    0.000000]  s2 : c2384fe8 s3 : 00000000 s4 : 00000001
> [    0.000000]  s5 : c1c0a980 s6 : c1d48000 s7 : c1613b4c
> [    0.000000]  s8 : 00000fff s9 : 80000200 s10: c1613b40
> [    0.000000]  s11: 00000000 t3 : 00000000 t4 : 00000000
> [    0.000000]  t5 : 00000001 t6 : 00000000
>
> Fixes: 3c4697982982 ("riscv:Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
>  arch/riscv/kernel/entry.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 524d918f3601..7dea5ee5a3ac 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -124,15 +124,15 @@ skip_context_tracking:
>  	REG_L a1, (a1)
>  	jr a1
>  1:
> -#ifdef CONFIG_TRACE_IRQFLAGS
> -	call trace_hardirqs_on
> -#endif
>  	/*
>  	 * Exceptions run with interrupts enabled or disabled depending on the
>  	 * state of SR_PIE in m/sstatus.
>  	 */
>  	andi t0, s1, SR_PIE
>  	beqz t0, 1f
> +#ifdef CONFIG_TRACE_IRQFLAGS
> +	call trace_hardirqs_on
> +#endif
>  	csrs CSR_STATUS, SR_IE
>
>  1:

Thanks, this is on fixes.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-13  4:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19  0:20 [PATCH] riscv: Trace irq on only interrupt is enabled Atish Patra
2021-01-13  4:36 ` Palmer Dabbelt

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).