[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFy2c88wKndjRAds-3MZ+MsArGBySOog+Rxmd2AciGFGkA@mail.gmail.com>
Date: Mon, 30 Oct 2017 10:20:40 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Borislav Petkov <bp@...e.de>, Len Brown <lenb@...nel.org>,
Tony Luck <tony.luck@...el.com>
Cc: Fengguang Wu <fengguang.wu@...el.com>,
Tyler Baicar <tbaicar@...eaurora.org>,
Huang Ying <ying.huang@...el.com>,
Chen Gong <gong.chen@...ux.intel.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Will Deacon <will.deacon@....com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux ACPI <linux-acpi@...r.kernel.org>
Subject: Re: [ghes_copy_tofrom_phys] BUG: sleeping function called from
invalid context at mm/page_alloc.c:4150
On Mon, Oct 30, 2017 at 4:05 AM, Borislav Petkov <bp@...e.de> wrote:
>
> Looks like Tyler broke it:
>
> 77b246b32b2c ("acpi: apei: check for pending errors when probing GHES entries")
>
> and it went into 4.13 and -stable.
I think this whole driver is garbage.
It does ioremap_page_range() in both NMI and irq context.
The fact that it triggers at probe time is just pure luck, and is
probably because at that point we don't happen to have the page tables
for the ioremap set up yet, so it actually does an allocation, which
is what then causes the warning.
But we should have warned much eariler, and this code has apparently
never worked right.
The driver is COMPLETELY broken. It needs to do the ioremap not at
interrupt time, but when setting up the device, and outside a
spinlock.
I think somebody must have known how broken this whole thing was,
because it literally uses a RAW spinloick, and I suspect the reason
for that is because lockdep complained about the breakage without it.
Reverting just the latest addition is not going to help. The breakage
is much more fundamental than that.
Note that doing this thing in NMI context is *really* wrong, because
the whole ioremap() code is definitely not NMI-safe. I don't think
it's irq-safe either.
I will add a "might_sleep()" to ioremap_page_range() itself, so that
we get this warning more reliably and much eailer. Right now it has
been hidden by the fact that most of the time the time the page tables
may be already allocated, but even then it's broken.
The only safe way to do that kind of access is likely using the FIXMAP model.
Linus
Powered by blists - more mailing lists