Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6753321imu; Wed, 30 Jan 2019 22:17:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN7J/hsTmay8bv+9JiA2jKacU1zuNQh/1fY65ZGrOj8aB8RHqzIHhLrYVcUIv6DjmJDDNrHW X-Received: by 2002:a63:5d55:: with SMTP id o21mr29680527pgm.92.1548915451810; Wed, 30 Jan 2019 22:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548915451; cv=none; d=google.com; s=arc-20160816; b=WlpbQfReArtkjWEgHhSslsUTE37qDRmtdIX+bOc3UcdavQtElW9nEmorcU7ln0LlxH MwsnM09tIsni2AuvHJQ1ZR0vZ/BcbWi0P1H2fqws5rQP+QssrOYCeQ855AED9Jgt6WeA eQ9vjSO60NJ5Ql9xNe6Wc+UuRouc+BB04bAre8KPtdRfzegiT+KY2E90OnA3ZHHo6sRy 2AtIGJwD7MlrpmEELDcHi/EpGIqpNil6VCiSe8ZhmjwszosdPOnVpV7PkDPJ0cXiZDnB 5ukio3XToJl3csBqQJwsdO9EFWYMvDcclW8YXlIhwOBdUKZg3IgP/kOHU0Kfqp0gw8ZC m5IA== 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:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+LZp8TSLqcSjHz52Ph+hKRgUaSnwMVC4auzg2+GR1XM=; b=iDSJduVV7L1ZhfkGNQ71JOGQYASEtZcdBRxYaFfQe//OBB6aGwezO666P5/PscLBw1 w6iqJTAS4brgkdNS1iXxgZ7lGyY4twwL2/5A5PaOzSXWohFTfXrIcqkcYRXw6x/RXlEy Dr4d7C1IAj/S0FjUoPwluzrVGJHms0tpw/FUU0xedH29LgxlHaacfA0vDv2gNL4XkMw2 VsFxFQ8H89gArW9ER1dEFV6Zr/XHdUjNmLG1hLpKVMsFKJON7W+WlUhOPwPwAvmI9z1U 2zVnQss2+pa1UPEunJE8c77gaDBUwhG108kvVQJFoRUruLg3a/h+znyX3VsbbqS5Eump xrWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=pW5BpTql; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si2651369pfh.96.2019.01.30.22.17.16; Wed, 30 Jan 2019 22:17:31 -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=@c-s.fr header.s=mail header.b=pW5BpTql; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726488AbfAaGPa (ORCPT + 99 others); Thu, 31 Jan 2019 01:15:30 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:4049 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbfAaGPa (ORCPT ); Thu, 31 Jan 2019 01:15:30 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43qqjC1Kp4z9v0yF; Thu, 31 Jan 2019 07:15:27 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=pW5BpTql; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id MRg_k5zYARGE; Thu, 31 Jan 2019 07:15:27 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43qqjC0G9cz9v0yD; Thu, 31 Jan 2019 07:15:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1548915327; bh=+LZp8TSLqcSjHz52Ph+hKRgUaSnwMVC4auzg2+GR1XM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=pW5BpTqlpdKYshMzUZ5kuntZqMZ4so9JNnL0IAZlzdHUz4Z6yDx+AsS8e597MIohd S75y6g5Vo/FICVohJxmPr7/ozEvjzLDghtf8O91TVTnXlp+2GKplJfJkKWbJ1spAJk qPWvCLcJlOfNA12gGCuosoQEtwf10rI/ol7eFfOY= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D4C418B78D; Thu, 31 Jan 2019 07:15:27 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id dCpysGh5O7aI; Thu, 31 Jan 2019 07:15:27 +0100 (CET) Received: from PO15451 (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D3A458B74C; Thu, 31 Jan 2019 07:15:26 +0100 (CET) Subject: Re: linux-next: powerpc le qemu boot failure after merge of the akpm tree To: Stephen Rothwell , Andrew Morton , Mike Rapoport Cc: Linux Next Mailing List , Linux Kernel Mailing List , Michael Ellerman , Benjamin Herrenschmidt , PowerPC References: <20190131163854.307e17ab@canb.auug.org.au> <20190131170629.2cc20600@canb.auug.org.au> From: Christophe Leroy Message-ID: <962e7dd7-779b-2c32-59db-9ced6751dede@c-s.fr> Date: Thu, 31 Jan 2019 07:15:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190131170629.2cc20600@canb.auug.org.au> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 31/01/2019 ? 07:06, Stephen Rothwell a ?crit?: > Hi all, > > On Thu, 31 Jan 2019 16:38:54 +1100 Stephen Rothwell wrote: >> >> [I am guessing that is is something in Andrew's tree that has caused >> this.] >> >> My qemu boot of the powerpc pseries_le_defconfig config failed like this: >> >> htab_hash_mask = 0x1ffff >> ----------------------------------------------------- >> numa: NODE_DATA [mem 0x7ffe7000-0x7ffebfff] >> Kernel panic - not syncing: sparse_buffer_init: Failed to allocate 2147483648 bytes align=0x10000 nid=0 from=fffffffffffffff >> CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc4 #2 >> Call Trace: >> [c00000000105bbd0] [c000000000b1345c] dump_stack+0xb0/0xf4 (unreliable) >> [c00000000105bc10] [c000000000111120] panic+0x168/0x3b8 >> [c00000000105bcb0] [c000000000e701c8] sparse_init_nid+0x178/0x550 >> [c00000000105bd70] [c000000000e709b4] sparse_init+0x210/0x238 >> [c00000000105bdb0] [c000000000e468f4] initmem_init+0x1e0/0x260 >> [c00000000105be80] [c000000000e3b9b0] setup_arch+0x354/0x3d4 >> [c00000000105bef0] [c000000000e33afc] start_kernel+0x98/0x648 >> [c00000000105bf90] [c00000000000b270] start_here_common+0x1c/0x52c > > A quick bisect leads to this: > > 1c3c9328cde027eb875ba4692f0a5d66b0afe862 is the first bad commit > commit 1c3c9328cde027eb875ba4692f0a5d66b0afe862 > Author: Mike Rapoport > Date: Thu Jan 31 10:51:32 2019 +1100 > > treewide: add checks for the return value of memblock_alloc*() > > Add check for the return value of memblock_alloc*() functions and call > panic() in case of error. The panic message repeats the one used by > panicing memblock allocators with adjustment of parameters to include only > relevant ones. > > The replacement was mostly automated with semantic patches like the one > below with manual massaging of format strings. > > @@ > expression ptr, size, align; > @@ > ptr = memblock_alloc(size, align); > + if (!ptr) > + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, > size, align); > > Link: http://lkml.kernel.org/r/1548057848-15136-20-git-send-email-rppt@linux.ibm.com > Signed-off-by: Mike Rapoport > Reviewed-by: Guo Ren [c-sky] > Acked-by: Paul Burton [MIPS] > Acked-by: Heiko Carstens [s390] > Reviewed-by: Juergen Gross [Xen] > Reviewed-by: Geert Uytterhoeven [m68k] > Cc: Catalin Marinas > Cc: Christophe Leroy > Cc: Christoph Hellwig > Cc: "David S. Miller" > Cc: Dennis Zhou > Cc: Greentime Hu > Cc: Greg Kroah-Hartman > Cc: Guan Xuetao > Cc: Guo Ren > Cc: Mark Salter > Cc: Matt Turner > Cc: Max Filippov > Cc: Michael Ellerman > Cc: Michal Simek > Cc: Petr Mladek > Cc: Richard Weinberger > Cc: Rich Felker > Cc: Rob Herring > Cc: Rob Herring > Cc: Russell King > Cc: Stafford Horne > Cc: Tony Luck > Cc: Vineet Gupta > Cc: Yoshinori Sato > Signed-off-by: Andrew Morton > > Which is just adding the panic we hit. So, presumably, the bug is in a > preceding patch :-( > > I have left the kernel not booting for today. > No I think the error is really in that patch, see my other mail. See https://elixir.bootlin.com/linux/v5.0-rc4/source/mm/memblock.c#L1455, memblock_alloc_try_nid_raw() is not supposed to panic, so the last hunk of this patch should be reverted. Found in total three problematic hunks in that patch: @@ -48,6 +53,11 @@ static phys_addr_t __init kasan_alloc_raw_page(int node) void *p = memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE, __pa(MAX_DMA_ADDRESS), MEMBLOCK_ALLOC_KASAN, node); + if (!p) + panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n", + __func__, PAGE_SIZE, PAGE_SIZE, node, + __pa(MAX_DMA_ADDRESS)); + return __pa(p); } @@ -211,6 +211,9 @@ static int __init iob_init(struct device_node *dn) iob_l2_base = memblock_alloc_try_nid_raw(1UL << 21, 1UL << 21, MEMBLOCK_LOW_LIMIT, 0x80000000, NUMA_NO_NODE); + if (!iob_l2_base) + panic("%s: Failed to allocate %lu bytes align=0x%lx max_addr=%x\n", + __func__, 1UL << 21, 1UL << 21, 0x80000000); pr_info("IOBMAP L2 allocated at: %p\n", iob_l2_base); @@ -425,6 +436,10 @@ static void __init sparse_buffer_init(unsigned long size, int nid) memblock_alloc_try_nid_raw(size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS), MEMBLOCK_ALLOC_ACCESSIBLE, nid); + if (!sparsemap_buf) + panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%lx\n", + __func__, size, PAGE_SIZE, nid, __pa(MAX_DMA_ADDRESS)); + sparsemap_buf_end = sparsemap_buf + size; } Christophe