Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3195360ybt; Mon, 29 Jun 2020 18:27:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyj32o6b8zSyTZ83U0OtoaV56UJbN9A27lETVoW+Z8p1K8Nqu1efzNZu4yFZ2XYxkZTPbj1 X-Received: by 2002:a50:e14e:: with SMTP id i14mr19624028edl.279.1593480430819; Mon, 29 Jun 2020 18:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593480430; cv=none; d=google.com; s=arc-20160816; b=zK3Eu3rGypipWAGOYl8IrlhLRuBY7I11CfgGONmapqBSfU90R6lNUPRvouroMX/qmc qRqAHcdGhPL/uWYCeUJEqMt/QGIh79hWPorEoeW3zrFMEzHJvNnMJetedDZDmKcWpFWf /bP9Ie99VZ6oBB2xKVom9Mf5mgWJB/YyWKeIU7XmChZJ0mtmoxE5rXdrfVKj7ZFJZ83a Omup260PylamMakIoHzgnvHyl9GN2lx79Rpq1FaRZwgx6Ks3jVanb/Qn9RwzRGrfmx1C S0Bq6e63u+y69+a3GWZVRVM2J2lUKdsbJ3OBN0JbD+cWZHK46J+B/AA4H2qOewQD8JmA Hxyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject:cc :to:from; bh=Uj+v4mW3RB+Fon+iv/jee+oW7U/EdhF+FBAXdFiGWdo=; b=qzW1t3caRDSYfV613CQhSh+c130QvrE/91OFYAHXBldlL3eJHPkQgKHQfocPhChGqE rCcRs2eQKrYElwBZM5Xi42euqCWBtOHJRIYf5zoyKHSuaRQrk7Z0hduqnkFjKUZGNkcn CqTKYCYmoOCam2dyMRwv7Q4ywYo9trnJpOACOW/EjiVnKo4L0UBR+LLWVaySfBz3JRx9 zOl4Ujft7TNk/4AnH2O5imB6a6Q3VKbVfjD/TlIv9OBIhkvi1pcDh8QvzlcsQMzX6JZE xXf4xX7+yB6RXcEVwzb03fY/tKRbGml3wvjMz4FiMfHoTk9XpDvr7b1N59VEh0l9YSuf pYgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si786510eja.468.2020.06.29.18.26.47; Mon, 29 Jun 2020 18:27:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbgF3BY1 (ORCPT + 99 others); Mon, 29 Jun 2020 21:24:27 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6785 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726481AbgF3BY1 (ORCPT ); Mon, 29 Jun 2020 21:24:27 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6F1F59EDBB19400A6D26; Mon, 29 Jun 2020 17:39:11 +0800 (CST) Received: from [10.174.185.226] (10.174.185.226) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Mon, 29 Jun 2020 17:39:00 +0800 From: Zenghui Yu To: Marc Zyngier , Thomas Gleixner , "Jason Cooper" CC: Linux Kernel Mailing List , , , Subject: [BUG] irqchip/gic-v4.1: sleeping function called from invalid context Message-ID: <1d673e99-0dd2-d287-aedf-65686eed5194@huawei.com> Date: Mon, 29 Jun 2020 17:39:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.185.226] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, Booting the latest kernel with DEBUG_ATOMIC_SLEEP=y on a GICv4.1 enabled box, I get the following kernel splat: [ 0.053766] BUG: sleeping function called from invalid context at mm/slab.h:567 [ 0.053767] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 0, name: swapper/1 [ 0.053769] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.8.0-rc3+ #23 [ 0.053770] Call trace: [ 0.053774] dump_backtrace+0x0/0x218 [ 0.053775] show_stack+0x2c/0x38 [ 0.053777] dump_stack+0xc4/0x10c [ 0.053779] ___might_sleep+0xfc/0x140 [ 0.053780] __might_sleep+0x58/0x90 [ 0.053782] slab_pre_alloc_hook+0x7c/0x90 [ 0.053783] kmem_cache_alloc_trace+0x60/0x2f0 [ 0.053785] its_cpu_init+0x6f4/0xe40 [ 0.053786] gic_starting_cpu+0x24/0x38 [ 0.053788] cpuhp_invoke_callback+0xa0/0x710 [ 0.053789] notify_cpu_starting+0xcc/0xd8 [ 0.053790] secondary_start_kernel+0x148/0x200 # ./scripts/faddr2line vmlinux its_cpu_init+0x6f4/0xe40 its_cpu_init+0x6f4/0xe40: allocate_vpe_l1_table at drivers/irqchip/irq-gic-v3-its.c:2818 (inlined by) its_cpu_init_lpis at drivers/irqchip/irq-gic-v3-its.c:3138 (inlined by) its_cpu_init at drivers/irqchip/irq-gic-v3-its.c:5166 I've tried to replace GFP_KERNEL flag with GFP_ATOMIC to allocate memory in this atomic context, and the splat disappears. But after a quick look at [*], it seems not a good idea to allocate memory within the CPU hotplug notifier. I really don't know much about it, please have a look. [*] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=11e37d357f6ba7a9af850a872396082cc0a0001f Thanks, Zenghui