public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Enable IRQ during exception handling
@ 2018-01-30  7:51 Zong Li
  2018-02-02  9:45 ` [patches] " Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Zong Li @ 2018-01-30  7:51 UTC (permalink / raw)
  To: palmer, albert, patches, linux-kernel; +Cc: zongbox, zong

Interrupt is allowed during exception handling.
There are warning messages if the kernel enables the configuration
'CONFIG_DEBUG_ATOMIC_SLEEP=y'.

BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:23
in_atomic(): 0, irqs_disabled(): 1, pid: 43, name: ash
CPU: 0 PID: 43 Comm: ash Tainted:  G        W        4.15.0-rc8-00089-g89ffdae-dirty #17
Call Trace:
[<000000009abb1587>] walk_stackframe+0x0/0x7a
[<00000000d4f3d088>] ___might_sleep+0x102/0x11a
[<00000000b1fd792a>] down_read+0x18/0x28
[<000000000289ec01>] do_page_fault+0x86/0x2f6
[<00000000012441f6>] _do_fork+0x1b4/0x1e0
[<00000000f46c3e3b>] ret_from_syscall+0xa/0xe

Signed-off-by: Zong Li <zong@andestech.com>
---
 arch/riscv/kernel/entry.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 7404ec2..61f063e 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -169,6 +169,9 @@ ENTRY(handle_exception)
 	move a1, sp /* pt_regs */
 	tail do_IRQ
 1:
+	/* Exceptions run with interrupts enabled */
+	csrs sstatus, SR_SIE
+
 	/* Handle syscalls */
 	li t0, EXC_SYSCALL
 	beq s4, t0, handle_syscall
@@ -195,8 +198,6 @@ handle_syscall:
 	 */
 	addi s2, s2, 0x4
 	REG_S s2, PT_SEPC(sp)
-	/* System calls run with interrupts enabled */
-	csrs sstatus, SR_SIE
 	/* Trace syscalls, but only if requested by the user. */
 	REG_L t0, TASK_TI_FLAGS(tp)
 	andi t0, t0, _TIF_SYSCALL_TRACE
-- 
2.9.3

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

* Re: [patches] [PATCH] RISC-V: Enable IRQ during exception handling
  2018-01-30  7:51 [PATCH] RISC-V: Enable IRQ during exception handling Zong Li
@ 2018-02-02  9:45 ` Christoph Hellwig
  2018-02-08 18:00   ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2018-02-02  9:45 UTC (permalink / raw)
  To: Zong Li; +Cc: palmer, albert, patches, linux-kernel, zong

Looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [patches] [PATCH] RISC-V: Enable IRQ during exception handling
  2018-02-02  9:45 ` [patches] " Christoph Hellwig
@ 2018-02-08 18:00   ` Palmer Dabbelt
  0 siblings, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2018-02-08 18:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zongbox, albert, patches, linux-kernel, zong

On Fri, 02 Feb 2018 01:45:28 PST (-0800), Christoph Hellwig wrote:
> Looks fine:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks, I'm still working through my FOSDEM-related email backlog.  I'll target 
this for the next RC, as it seems like a small enough fix.  It should be in the 
next linux-next.

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

end of thread, other threads:[~2018-02-08 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-30  7:51 [PATCH] RISC-V: Enable IRQ during exception handling Zong Li
2018-02-02  9:45 ` [patches] " Christoph Hellwig
2018-02-08 18:00   ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox