linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta1@synopsys.com>
To: <linux-snps-arc@lists.infradead.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linux-arch@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Vineet Gupta" <vineet.gupta1@synopsys.com>
Subject: [PATCH 2/2] ARC: show_regs: fix lockdep splat for good
Date: Tue, 18 Dec 2018 10:53:59 -0800	[thread overview]
Message-ID: <1545159239-30628-3-git-send-email-vgupta@synopsys.com> (raw)
In-Reply-To: <1545159239-30628-1-git-send-email-vgupta@synopsys.com>

signal handling core calls ARCH show_regs() with preemption disabled
which causes __might_sleep functions such as mmput leading to lockdep
splat.  Workaround by re-enabling preemption temporarily.

This may not be as bad as it sounds since the preemption disabling
itself was introduced for a supressing smp_processor_id() warning in x86
code by commit 3a9f84d354ce ("signals, debug: fix BUG: using
smp_processor_id() in preemptible code in print_fatal_signal()")

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/kernel/troubleshoot.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 2885bec71fb8..c650d3de13e1 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -177,6 +177,12 @@ void show_regs(struct pt_regs *regs)
 	struct task_struct *tsk = current;
 	struct callee_regs *cregs;
 
+	/*
+	 * generic code calls us with preemption disabled, but some calls
+	 * here could sleep, so re-enable to avoid lockdep splat
+	 */
+	preempt_enable();
+
 	print_task_path_n_nm(tsk);
 	show_regs_print_info(KERN_INFO);
 
@@ -219,6 +225,8 @@ void show_regs(struct pt_regs *regs)
 	cregs = (struct callee_regs *)current->thread.callee_reg;
 	if (cregs)
 		show_callee_regs(cregs);
+
+	preempt_disable();
 }
 
 void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
-- 
2.7.4


  parent reply	other threads:[~2018-12-18 18:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 18:53 [PATCH 0/2] ARC show_regs fixes Vineet Gupta
2018-12-18 18:53 ` [PATCH 1/2] ARC: show_regs: avoid page allocator Vineet Gupta
2018-12-19 17:04   ` Eugeniy Paltsev
2018-12-19 17:36     ` Vineet Gupta
2018-12-20  1:16     ` Vineet Gupta
2018-12-20 13:30       ` Tetsuo Handa
2018-12-20 18:36         ` Vineet Gupta
2018-12-20 18:43         ` Vineet Gupta
2018-12-19 20:46   ` William Kucharski
2018-12-19 21:36     ` Vineet Gupta
2018-12-20 12:57   ` Michal Hocko
2018-12-20 18:38     ` Vineet Gupta
2018-12-18 18:53 ` Vineet Gupta [this message]
2018-12-20 13:04   ` [PATCH 2/2] ARC: show_regs: fix lockdep splat for good Michal Hocko
2018-12-20 18:45     ` Vineet Gupta
2018-12-21 13:04       ` Michal Hocko
2018-12-21 13:27         ` Michal Hocko
2018-12-21 17:55         ` Vineet Gupta
2018-12-24 19:10           ` Michal Hocko

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=1545159239-30628-3-git-send-email-vgupta@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).