Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp374379imu; Thu, 8 Nov 2018 09:27:00 -0800 (PST) X-Google-Smtp-Source: AJdET5dPOH5+sm2CCIfsLxB5hCbEdhtFWmSlHT9qTte73wCd8r/BLB9MfFksZpwJUBKSt4QeUrU8 X-Received: by 2002:a17:902:f81:: with SMTP id 1-v6mr5352131plz.203.1541698020745; Thu, 08 Nov 2018 09:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541698020; cv=none; d=google.com; s=arc-20160816; b=Gy8+Xc9Y4HJMkxx6CgEJG6fpMTkl6gp9wqUdPeUx7e8wL757eMOcb+xan9HCH6Ytq2 2lHXv8EW1drS8O8j1TnpOz8w+tLV+GC23ZwbC03MesIXbSlI7GhmUza/KDlrGeOg4ftn GSEjNjXp4As56rOlIxUAGPh9qLtnUhow6/r5LE7Cjlv4Q+pA+r7g2W08hibofpxmjZ16 Y+pMT07cwK/s4tSc3/08w23qklNBdRBxbQtWl1Uuber1krwyLC5TTQzH0Jcn1RMG3hwm ccHhMl4W2kB7gb+bxftdcgHxA748GxNb/JdahXZhqDjHKP/l7WXoRUMXx7Q4JThYcC7A I40Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=5etHN3UQXMfjWI3clr9iuXOz3kdlEQoNbXvvJOJaz1Y=; b=kJwHJhulOx6gCEiRjOVoYXcVYPvxqUNcBOVTtLtOIfr31oE6NBPyBd4xkR9tZo+Bsv hvrYD4tF75JYRRnj5E3jpdoghroD8O3vfFCXxOMDSujNrW7mKFYR5ZNrFD3U2vFAyV0S oZMTZPC4w7XJx4iyH8wFHWY029l4HS0xcXyeoaQ8EyYL/K6OJM8wICTOSfS/XtKzClsg QOtNHe0JNubx/qZgfXuby/AcoBKxfavwNO02MY3pirgpEaCd6vmyHhiEN1fH0D/ec5gE HpZhPameByLYBqr+8jbS/HviiH6wieUcB/1cZTyv/cZc7SDXcmXhzjKCExtCxpHN8L2Z 39Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ewPuxByf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 88-v6si4743672plc.34.2018.11.08.09.26.41; Thu, 08 Nov 2018 09:27:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ewPuxByf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727168AbeKIDBy (ORCPT + 99 others); Thu, 8 Nov 2018 22:01:54 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:54382 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbeKIDBy (ORCPT ); Thu, 8 Nov 2018 22:01:54 -0500 Received: by mail-it1-f195.google.com with SMTP id d6so2709756itl.4 for ; Thu, 08 Nov 2018 09:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5etHN3UQXMfjWI3clr9iuXOz3kdlEQoNbXvvJOJaz1Y=; b=ewPuxByfqraObKBmVCcD4j2xgxyYtUA2cnBvH/Q+/Zsxfrk+Azc+DREAy6eLdlm7qQ kdC6IXOpgjfpaIRDuUIOyJX1VqMsTdCqWP4fTASUrCkVAHXZEFAeD/Z3bR7pcD8Zzcch h2+jdGbqTvO/n5JVWux29bHx9ttTJ1cBCsMD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5etHN3UQXMfjWI3clr9iuXOz3kdlEQoNbXvvJOJaz1Y=; b=EkSM54kNzzjiznJOVg6X//3R9btChYTwYDcPRpqXNvLr0F+UZfarV1m1SpbwqVYui3 Hw7t1FpwWgceWDxGsEe4CaOQo+rWMorZgZe45V8b5AvIRm4GbRu08mqUzpgp07qXY17v WBXcQ8+lKk8AUzQtbqGvqXfNXCjIq9lGrYIKOE5EMRfIIXwW3m+wzgy4hFVKsr7P/XpK kPUlJbGFoQEq7rhQHHXLYTIlchBwQoVnq6erUxOOnuRMS1i7GLV61CQYCMW1KsZAqWMT QdcAVWTjfKIbzu3SsB3gBSeccQdaPBhM7VqLdO9bpDgopjG41qU+ezenyymT5kqKwzWH /LQg== X-Gm-Message-State: AGRZ1gJfmDEYyCGsaSCfyh7fUP4kKxDJnIWp5SrTosAc6e7e4Pt34Gdj u71RGllNNDCCzillUrtQZ8bz6z0X8BPP3PIvROfSoA== X-Received: by 2002:a24:8347:: with SMTP id d68-v6mr2106108ite.158.1541697923484; Thu, 08 Nov 2018 09:25:23 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a6b:4f16:0:0:0:0:0 with HTTP; Thu, 8 Nov 2018 09:25:22 -0800 (PST) In-Reply-To: References: From: Ard Biesheuvel Date: Thu, 8 Nov 2018 18:25:22 +0100 Message-ID: Subject: Re: BUG: sleeping function called from invalid context at mm/slab.h:421 To: Qian Cai , Marc Zyngier Cc: Linux Kernel Mailing List , Linux-MM , linux-efi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (+ Marc) On 8 November 2018 at 18:22, Qian Cai 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" >> 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): [] copy_process.isra.32.part.33+0x460/0x1534 >> Nov 8 11:06:36 huawei-t2280-03 kernel: softirqs last enabled at (0): [] 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;