public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Andrey Ryabinin <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, hpa@zytor.com, paulmck@linux.vnet.ibm.com,
	tobias.regnery@gmail.com, glider@google.com,
	aryabinin@virtuozzo.com, tglx@linutronix.de, dvyukov@google.com,
	linux-kernel@vger.kernel.org
Subject: [tip:x86/urgent] x86/mm/ptdump: Fix soft lockup in page table walker
Date: Fri, 10 Feb 2017 02:07:05 -0800	[thread overview]
Message-ID: <tip-146fbb766934dc003fcbf755b519acef683576bf@git.kernel.org> (raw)
In-Reply-To: <20170210095405.31802-1-aryabinin@virtuozzo.com>

Commit-ID:  146fbb766934dc003fcbf755b519acef683576bf
Gitweb:     http://git.kernel.org/tip/146fbb766934dc003fcbf755b519acef683576bf
Author:     Andrey Ryabinin <aryabinin@virtuozzo.com>
AuthorDate: Fri, 10 Feb 2017 12:54:05 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 10 Feb 2017 11:00:23 +0100

x86/mm/ptdump: Fix soft lockup in page table walker

CONFIG_KASAN=y needs a lot of virtual memory mapped for its shadow.
In that case ptdump_walk_pgd_level_core() takes a lot of time to
walk across all page tables and doing this without
a rescheduling causes soft lockups:

 NMI watchdog: BUG: soft lockup - CPU#3 stuck for 23s! [swapper/0:1]
 ...
 Call Trace:
  ptdump_walk_pgd_level_core+0x40c/0x550
  ptdump_walk_pgd_level_checkwx+0x17/0x20
  mark_rodata_ro+0x13b/0x150
  kernel_init+0x2f/0x120
  ret_from_fork+0x2c/0x40

I guess that this issue might arise even without KASAN on huge machines
with several terabytes of RAM.

Stick cond_resched() in pgd loop to fix this.

Reported-by: Tobias Regnery <tobias.regnery@gmail.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: kasan-dev@googlegroups.com
Cc: Alexander Potapenko <glider@google.com>
Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20170210095405.31802-1-aryabinin@virtuozzo.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/mm/dump_pagetables.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index ea9c49a..8aa6bea 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -15,6 +15,7 @@
 #include <linux/debugfs.h>
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/sched.h>
 #include <linux/seq_file.h>
 
 #include <asm/pgtable.h>
@@ -406,6 +407,7 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd,
 		} else
 			note_page(m, &st, __pgprot(0), 1);
 
+		cond_resched();
 		start++;
 	}
 

  reply	other threads:[~2017-02-10 10:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 12:46 BUG: soft lockup in 4.10-rc7 with KASAN enabled Tobias Regnery
2017-02-09 16:46 ` Paul E. McKenney
2017-02-09 16:56   ` Paul E. McKenney
2017-02-09 17:23     ` Dmitry Vyukov
2017-02-10  8:14       ` Tobias Regnery
2017-02-10  9:47 ` Andrey Ryabinin
2017-02-10  9:54   ` [PATCH] x86/mm/ptdump: Fix soft lockup in page table walker Andrey Ryabinin
2017-02-10 10:07     ` tip-bot for Andrey Ryabinin [this message]
2017-02-10 10:24     ` Dmitry Vyukov
2017-02-10 11:18       ` Thomas Gleixner
2017-02-10 12:15         ` Andrey Ryabinin
2017-02-10 13:02           ` Dmitry Vyukov
2017-02-10 13:56             ` Andrey Ryabinin
2017-02-10 14:17               ` Dmitry Vyukov
2017-02-10 14:29               ` Mark Rutland
2017-02-10 14:38                 ` Andrey Ryabinin
2017-02-10 14:41                   ` Mark Rutland
2017-02-10 14:38             ` Mark Rutland

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=tip-146fbb766934dc003fcbf755b519acef683576bf@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tobias.regnery@gmail.com \
    /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