Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6770392imu; Wed, 30 Jan 2019 22:41:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN7vASOgtKKK2iptUkQ9DxXmLwa/WZNTQdwg/Jy2VHEuAPED0dejYoZzvQmVHtNeOdHfw8oS X-Received: by 2002:a17:902:6a8c:: with SMTP id n12mr33786732plk.85.1548916916493; Wed, 30 Jan 2019 22:41:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548916916; cv=none; d=google.com; s=arc-20160816; b=v/2yi0Mo3pKCUychS4XTwnNY3s2l7GCskQ1DpPKba4bM57IJuvJZDGL4TQmpCcpFjo J3A3kx5c+qeTbXL55IpkeawCNE0uQ+t/SBae1saIkQRtSrDUM+xf29eGvlEmbx08G8n8 OkuEBk/6LjLTBmdHz9vW7DB/H4U+u6ZCAeiD7QAx3VqQPvQkq1Qfjgmo6FKuX77/txdm dIXnlVTCkPbQtaxRl1s7Pmqmp+k9vzN4JtHFQR+T4Iazm3gqi3E2Yb+Z8yZf4A4DtU/v kKVG3YDVJsFZ9WMI1xG0S8CFgi8Tde5i8w1NgG9+RC2NUG3SoEUCrntSXnQIM9af5X3B UGlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:subject:cc:to:from:date; bh=EL3ExjFgkdCWXsdx87fgF1KgoRnwAqnEALqUKRLoTHc=; b=tASLZ5nUKn3UPIvSZXvBeXajGngS9LiMVT3HkcS3nZSbW1o6mg0eNu17xTLnQuIiKr g+b9AeQVk5zz3AHViNMSYK2kCJO8MObTNiURR7Fu5wrfU3QM5Wsp4DgDyhA+fjygg13Y xHNbAT/s+HUapnrso0xFdCPD+W5pq207E+QQGfyoX+TFh+dDUTmsjd1IerrmxGDv83ie mkCKI8sH7UODJoT7ftLcFVvxxXZLlhfYYs+DSNRVBZjCB0IyjIoPGIodP/HbjVhzUba4 WHK7mF1tayGP1641xnbxceNVkuuE46yZpl/5d19nJhYBcNsIgdw8Yn28fU5Y9urLKlkQ QRFw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17si3393992pgi.578.2019.01.30.22.41.38; Wed, 30 Jan 2019 22:41:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727180AbfAaGjl (ORCPT + 99 others); Thu, 31 Jan 2019 01:39:41 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52708 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbfAaGjk (ORCPT ); Thu, 31 Jan 2019 01:39:40 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0V6cYGI056546 for ; Thu, 31 Jan 2019 01:39:39 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qbute8bey-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 31 Jan 2019 01:39:39 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 Jan 2019 06:39:37 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 31 Jan 2019 06:39:33 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0V6dXkp4325782 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 31 Jan 2019 06:39:33 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB5C642042; Thu, 31 Jan 2019 06:39:32 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4849342041; Thu, 31 Jan 2019 06:39:32 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.84]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 31 Jan 2019 06:39:32 +0000 (GMT) Date: Thu, 31 Jan 2019 08:39:30 +0200 From: Mike Rapoport To: Christophe Leroy Cc: Stephen Rothwell , Andrew Morton , Linux Next Mailing List , Linux Kernel Mailing List , Michael Ellerman , Benjamin Herrenschmidt , PowerPC Subject: Re: linux-next: powerpc le qemu boot failure after merge of the akpm tree References: <20190131163854.307e17ab@canb.auug.org.au> <20190131170629.2cc20600@canb.auug.org.au> <962e7dd7-779b-2c32-59db-9ced6751dede@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <962e7dd7-779b-2c32-59db-9ced6751dede@c-s.fr> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19013106-0028-0000-0000-00000341266F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19013106-0029-0000-0000-000023FF2773 Message-Id: <20190131063930.GA28876@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-31_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901310052 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 31, 2019 at 07:15:26AM +0100, Christophe Leroy wrote: > > > 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 This means that sparse_buffer_init tries to allocate 2G for the sparsemap_buf... Stephen, how many memory do you give to your VM? > >>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. It is not supposed to panic, but it can still fail, so simply ignoring it's return value seems a bit odd at least. > 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 > -- Sincerely yours, Mike.