linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Qian Cai <cai@gmx.us>, Marc Zyngier <marc.zyngier@arm.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	linux-efi <linux-efi@vger.kernel.org>
Subject: Re: BUG: sleeping function called from invalid context at mm/slab.h:421
Date: Thu, 8 Nov 2018 18:25:22 +0100	[thread overview]
Message-ID: <CAKv+Gu_1ckSP_O6TdYRL=+dUbWDsogOaU3-nnWMKijtANw8t6Q@mail.gmail.com> (raw)
In-Reply-To: <trinity-73b7af5e-ab88-495b-932a-2ffd6dd81623-1541697732607@3c-app-mailcom-bs15>

(+ Marc)

On 8 November 2018 at 18:22, Qian Cai <cai@gmx.us> wrote:
> Looks like more of an EFI issue where it called efi_mem_reserve_persistent().
>
>> Sent: Thursday, November 08, 2018 at 11:23 AM
>> From: "Qian Cai" <cai@gmx.us>
>> To: linux-kernel@vger.kernel.org
>> Cc: linux-mm@kvack.org
>> Subject: BUG: sleeping function called from invalid context at mm/slab.h:421
>>
>> Just booting up the latest git master (b00d209) on an aarch64 server and saw this.
>>
>> Nov  8 11:06:36 huawei-t2280-03 kernel: BUG: sleeping function called from invalid context at mm/slab.h:421
>> Nov  8 11:06:36 huawei-t2280-03 kernel: in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/1
>> Nov  8 11:06:36 huawei-t2280-03 kernel: no locks held by swapper/1/0.
>> Nov  8 11:06:36 huawei-t2280-03 kernel: irq event stamp: 0
>> Nov  8 11:06:36 huawei-t2280-03 kernel: hardirqs last  enabled at (0): [<0000000000000000>]           (null)
>> Nov  8 11:06:36 huawei-t2280-03 kernel: hardirqs last disabled at (0): [<ffff2000080e24ec>] copy_process.isra.32.part.33+0x460/0x1534
>> Nov  8 11:06:36 huawei-t2280-03 kernel: softirqs last  enabled at (0): [<ffff2000080e24ec>] copy_process.isra.32.part.33+0x460/0x1534
>> Nov  8 11:06:36 huawei-t2280-03 kernel: softirqs last disabled at (0): [<0000000000000000>]           (null)
>> Nov  8 11:06:36 huawei-t2280-03 kernel: CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.20.0-rc1+ #3
>> Nov  8 11:06:36 huawei-t2280-03 kernel: Call trace:
>> Nov  8 11:06:36 huawei-t2280-03 kernel: dump_backtrace+0x0/0x190
>> Nov  8 11:06:36 huawei-t2280-03 kernel: show_stack+0x24/0x2c
>> Nov  8 11:06:36 huawei-t2280-03 kernel: dump_stack+0xa4/0xe0
>> Nov  8 11:06:36 huawei-t2280-03 kernel: ___might_sleep+0x208/0x234
>> Nov  8 11:06:36 huawei-t2280-03 kernel: __might_sleep+0x58/0x8c
>> Nov  8 11:06:36 huawei-t2280-03 kernel: kmem_cache_alloc_trace+0x29c/0x420
>> Nov  8 11:06:36 huawei-t2280-03 kernel: efi_mem_reserve_persistent+0x50/0xe8
>> Nov  8 11:06:36 huawei-t2280-03 kernel: its_cpu_init_lpis+0x298/0x2e0
>> Nov  8 11:06:36 huawei-t2280-03 kernel: its_cpu_init+0x7c/0x1a8
>> Nov  8 11:06:36 huawei-t2280-03 kernel: gic_starting_cpu+0x28/0x34
>> Nov  8 11:06:36 huawei-t2280-03 kernel: cpuhp_invoke_callback+0x104/0xd04
>> Nov  8 11:06:36 huawei-t2280-03 kernel: notify_cpu_starting+0x60/0xa0
>> Nov  8 11:06:36 huawei-t2280-03 kernel: secondary_start_kernel+0xcc/0x178
>>
>> Any idea?

OK, so apparently, we are being invoked from atomic context

Please try this

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 249eb70691b0..44ed6792de7c 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -971,7 +971,7 @@ int efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
        if (efi.mem_reserve == EFI_INVALID_TABLE_ADDR)
                return -ENODEV;

-       rsv = kmalloc(sizeof(*rsv), GFP_KERNEL);
+       rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC);
        if (!rsv)
                return -ENOMEM;

      reply	other threads:[~2018-11-08 17:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08 16:23 BUG: sleeping function called from invalid context at mm/slab.h:421 Qian Cai
2018-11-08 17:22 ` Qian Cai
2018-11-08 17:25   ` Ard Biesheuvel [this message]

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='CAKv+Gu_1ckSP_O6TdYRL=+dUbWDsogOaU3-nnWMKijtANw8t6Q@mail.gmail.com' \
    --to=ard.biesheuvel@linaro.org \
    --cc=cai@gmx.us \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marc.zyngier@arm.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;
as well as URLs for NNTP newsgroup(s).