diff options
author | zongbox@gmail.com <zongbox@gmail.com> | 2018-01-30 02:51:45 -0500 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-02-20 13:56:14 -0500 |
commit | bcae803a213172c79ab5d077f169e3428e44d2ba (patch) | |
tree | 328b45257ac024fc5885ae3d2138b2a3e07bcc0f | |
parent | a5033609896ccc58afd6bda365742fffd1dba7aa (diff) |
RISC-V: Enable IRQ during exception handling
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
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zong Li <zong@andestech.com>
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
-rw-r--r-- | arch/riscv/kernel/entry.S | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 87fc045be51f..56fa592cfa34 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S | |||
@@ -172,6 +172,9 @@ ENTRY(handle_exception) | |||
172 | move a1, sp /* pt_regs */ | 172 | move a1, sp /* pt_regs */ |
173 | tail do_IRQ | 173 | tail do_IRQ |
174 | 1: | 174 | 1: |
175 | /* Exceptions run with interrupts enabled */ | ||
176 | csrs sstatus, SR_SIE | ||
177 | |||
175 | /* Handle syscalls */ | 178 | /* Handle syscalls */ |
176 | li t0, EXC_SYSCALL | 179 | li t0, EXC_SYSCALL |
177 | beq s4, t0, handle_syscall | 180 | beq s4, t0, handle_syscall |
@@ -198,8 +201,6 @@ handle_syscall: | |||
198 | */ | 201 | */ |
199 | addi s2, s2, 0x4 | 202 | addi s2, s2, 0x4 |
200 | REG_S s2, PT_SEPC(sp) | 203 | REG_S s2, PT_SEPC(sp) |
201 | /* System calls run with interrupts enabled */ | ||
202 | csrs sstatus, SR_SIE | ||
203 | /* Trace syscalls, but only if requested by the user. */ | 204 | /* Trace syscalls, but only if requested by the user. */ |
204 | REG_L t0, TASK_TI_FLAGS(tp) | 205 | REG_L t0, TASK_TI_FLAGS(tp) |
205 | andi t0, t0, _TIF_SYSCALL_TRACE | 206 | andi t0, t0, _TIF_SYSCALL_TRACE |