2024-03-25 22:42:12

by Guenter Roeck

[permalink] [raw]
Subject: [PATCH] nios2: Call handle_mm_fault() with interrupts enabled

The following log message is reported at each boot if
CONFIG_DEBUG_ATOMIC_SLEEP is enabled.

BUG: sleeping function called from invalid context at mm/rmap.c:194
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 23, name: modprobe
preempt_count: 0, expected: 0
CPU: 0 PID: 23 Comm: modprobe Not tainted 6.9.0-rc1-00033-g5afc2860dc51 #1

Fix by enabling local interrupts while calling handle_mm_fault().

Note: I don't really know what I am doing here.

Signed-off-by: Guenter Roeck <[email protected]>
---
I don't really know what I am doing here, so this is just a wild shot.
It _does_ fix the backtrace, and I have not seen any problems, but that is
just with basic qemu testing.

arch/nios2/mm/fault.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c
index e3fa9c15181d..b468d5ca78a1 100644
--- a/arch/nios2/mm/fault.c
+++ b/arch/nios2/mm/fault.c
@@ -121,7 +121,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
* make sure we exit gracefully rather than endlessly redo
* the fault.
*/
+ local_irq_enable();
fault = handle_mm_fault(vma, address, flags, regs);
+ local_irq_disable();

if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
--
2.39.2