From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
<x86@kernel.org>
Cc: Tobias Regnery <tobias.regnery@gmail.com>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
Dmitry Vyukov <dvyukov@google.com>,
Alexander Potapenko <glider@google.com>,
<kasan-dev@googlegroups.com>, <linux-kernel@vger.kernel.org>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
<stable@vger.kernel.org>
Subject: [PATCH] x86/mm/ptdump: Fix soft lockup in page table walker.
Date: Fri, 10 Feb 2017 12:54:05 +0300
Message-ID: <20170210095405.31802-1-aryabinin@virtuozzo.com> (raw)
In-Reply-To: <0d19ac08-88b0-675d-19bd-4cdc543fdb30@virtuozzo.com>
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 a 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: <stable@vger.kernel.org>
---
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++;
}
--
2.10.2
next prev parent reply index
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 ` Andrey Ryabinin [this message]
2017-02-10 10:07 ` [tip:x86/urgent] x86/mm/ptdump: Fix soft lockup in page table walker tip-bot for Andrey Ryabinin
2017-02-10 10:24 ` [PATCH] " 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=20170210095405.31802-1-aryabinin@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tobias.regnery@gmail.com \
--cc=x86@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
LKML Archive on lore.kernel.org
Archives are clonable:
git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
linux-kernel@vger.kernel.org
public-inbox-index lkml
Example config snippet for mirrors
Newsgroup available over NNTP:
nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git