From: Matthew Wilcox <willy@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
open list <linux-kernel@vger.kernel.org>,
Linux-Next Mailing List <linux-next@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
lkft-triage@lists.linaro.org, LTP List <ltp@lists.linux.it>,
Andrew Morton <akpm@linux-foundation.org>,
torvalds@linuxfoundation.org, Yang Shi <shy828301@gmail.com>,
Jan Kara <jack@suse.cz>, Michal Hocko <mhocko@suse.com>,
Thomas Gleixner <tglx@linutronix.de>,
Mel Gorman <mgorman@suse.de>, Song Liu <songliubraving@fb.com>,
Zi Yan <ziy@nvidia.com>,
vtolkm@googlemail.com,
Marek Szyprowski <m.szyprowski@samsung.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: kernel BUG at mm/highmem.c:417! invalid opcode: 0000 EIP: zero_user_segments
Date: Wed, 25 Nov 2020 00:46:32 +0000 [thread overview]
Message-ID: <20201125004632.GG4327@casper.infradead.org> (raw)
In-Reply-To: <20201124171628.dk6tle5lh3sx2jxg@linutronix.de>
On Tue, Nov 24, 2020 at 06:16:28PM +0100, Sebastian Andrzej Siewior wrote:
> On 2020-11-24 18:52:44 [+0530], Naresh Kamboju wrote:
> > While running LTP test case access01 the following kernel BUG
> > noticed on linux next 20201124 tag kernel on i386.
> >
> > git short log:
> > ----------------
> > git log --oneline next-20201120..next-20201124 -- mm/highmem.c
> > d9927d46febf Merge branch 'akpm-current/current'
> > 72d22a0d0e86 mm: support THPs in zero_user_segments
> > 2a656cad337e mm/highmem: Take kmap_high_get() properly into account
> >
> > Please find these easy steps to reproduce the kernel build and boot.
>
> This BUG_ON() is in zero_user_segments() which ash been added in commit
> 72d22a0d0e86 mm: support THPs in zero_user_segments
>
> > [ 50.852189] kernel BUG at mm/highmem.c:417!
>
> I managed to capture one invocation with:
> zero_user_segments(0xd4367a90,
> 0x1000, 0x1000,
> 0x0, 0x50)
> page_compound() -> 1
> page_size() -> 4096
Thanks for debugging this! I didn't realise start1 was allowed to be
less than start2. Try this ... (systemd is sabotaging my efforts to
test an i386 kernel)
diff --git a/mm/highmem.c b/mm/highmem.c
index 3e1087f2b735..6306a535dd9c 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -369,46 +369,39 @@ void zero_user_segments(struct page *page, unsigned start1, unsigned end1,
BUG_ON(end1 > page_size(page) || end2 > page_size(page));
for (i = 0; i < compound_nr(page); i++) {
- void *kaddr;
- unsigned this_end;
+ void *kaddr = NULL;
- if (end1 == 0 && start2 >= PAGE_SIZE) {
- start2 -= PAGE_SIZE;
- end2 -= PAGE_SIZE;
- continue;
- }
+ if (start1 < PAGE_SIZE || start2 < PAGE_SIZE)
+ kaddr = kmap_atomic(page + i);
if (start1 >= PAGE_SIZE) {
start1 -= PAGE_SIZE;
end1 -= PAGE_SIZE;
- if (start2) {
- start2 -= PAGE_SIZE;
- end2 -= PAGE_SIZE;
- }
- continue;
- }
-
- kaddr = kmap_atomic(page + i);
+ } else {
+ unsigned this_end = min_t(unsigned, end1, PAGE_SIZE);
- this_end = min_t(unsigned, end1, PAGE_SIZE);
- if (end1 > start1)
- memset(kaddr + start1, 0, this_end - start1);
- end1 -= this_end;
- start1 = 0;
+ if (end1 > start1)
+ memset(kaddr + start1, 0, this_end - start1);
+ end1 -= this_end;
+ start1 = 0;
+ }
if (start2 >= PAGE_SIZE) {
start2 -= PAGE_SIZE;
end2 -= PAGE_SIZE;
} else {
- this_end = min_t(unsigned, end2, PAGE_SIZE);
+ unsigned this_end = min_t(unsigned, end2, PAGE_SIZE);
+
if (end2 > start2)
memset(kaddr + start2, 0, this_end - start2);
end2 -= this_end;
start2 = 0;
}
- kunmap_atomic(kaddr);
- flush_dcache_page(page + i);
+ if (kaddr) {
+ kunmap_atomic(kaddr);
+ flush_dcache_page(page + i);
+ }
if (!end1 && !end2)
break;
next prev parent reply other threads:[~2020-11-25 0:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 13:22 Naresh Kamboju
2020-11-24 17:16 ` Sebastian Andrzej Siewior
2020-11-25 0:46 ` Matthew Wilcox [this message]
2020-11-25 10:46 ` Naresh Kamboju
2020-11-25 11:23 ` Sebastian Andrzej Siewior
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=20201125004632.GG4327@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=lkft-triage@lists.linaro.org \
--cc=ltp@lists.linux.it \
--cc=m.szyprowski@samsung.com \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=naresh.kamboju@linaro.org \
--cc=shy828301@gmail.com \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linuxfoundation.org \
--cc=vtolkm@googlemail.com \
--cc=ziy@nvidia.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