Skip to contentSkip to conversation

nios2: Call handle_mm_fault() with interrupts enabled

PATCH New Guenter Roeck 1 participant 1 message Mar 25, 2024 NIOS2 architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
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(+)
arch/nios2/mm/fault.c +2 -0
index e3fa9c15181d..b468d5ca78a1 100644
@@ -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))
Signature · 1 line
2.39.2