mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Dinh Nguyen <dinguyen@kernel.org>
Cc: linux-kernel@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH] nios2: Call handle_mm_fault() with interrupts enabled
Date: Mon, 25 Mar 2024 15:41:40 -0700	[thread overview]
Message-ID: <20240325224140.1911036-1-linux@roeck-us.net> (raw)

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 <linux@roeck-us.net>
---
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


                 reply	other threads:[~2024-03-25 22:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240325224140.1911036-1-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=dinguyen@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®