Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp280719img; Wed, 27 Mar 2019 22:58:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpcyXZT2QOSdN9rJc0af+xB98YIhDRd/BVQsyk+JAFG7P+R00QSQGqlAa2mfViPsZMudc5 X-Received: by 2002:a17:902:2ba7:: with SMTP id l36mr41581723plb.237.1553752723537; Wed, 27 Mar 2019 22:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553752723; cv=none; d=google.com; s=arc-20160816; b=G/+dnYK2+hwCg5JIen9zUvV6RUhStD8enRmkHyDTOGFP209YWlFFsuu3G9JRzKxK0r jenyyfrawmkQ4gvBofnlpE7ZnC4mgsbNQUhu4s4bzb3jkcEiiu5G9ZI3hftAEqpBLLrv WWTr1bRJImuwhRfRYw7i88wiPMIyhcZTpeliClF+NlEuStK6yEnOWGHEPmh2TlCOv8JB XmLF6Bb62/Gai5igi0VyFtoY0fzDIN9Jy7evCW3CMDY85GjmWyWQNa1IXzb+SXsW7qAi F4Tx1kj7YAqZUn1zYMSJuRIs2izaCKVNkJycwY4IAF0WIAcmzRwjVqcVWa5hsEF2j+dq CzWQ== 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-disposition:mime-version:references:subject:cc:to:from:date; bh=t6t4lcMObyXRQ+SE7rAT68YzcAHuSiVHg6LDOnYL700=; b=YSHh0FKf48i1kqqC8j5Op6+E/r7wKOwlLlRIw3lGOxsvfah+y01ENQEX3Kx94j7PSl qbigWCc4hc/SnvgIB7tUismcjShIF0g2K+BK+e4jcOUHedfJ97kNWNTwcIvp4TFVv1wi bMMWrX9+AhE45O+vMoytXyY5X8BOkYXHdOHzbyTZv0RZJf1nyXk/onZvadaVUAFl4iE2 pECiOsLUdPdA5lACdiwk42TpZPTAJwk5zfUt/FwZYrqCObT+0OOlvfIOVCoYprWnkf19 yVAEqLm1LpUaYl4Eu7ni+LmoOBYfJF7KBATPxJGFnIacyGbvHt8s6BrWjP7HV3C8sqZ0 9liw== 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 v35si23006905plg.382.2019.03.27.22.58.28; Wed, 27 Mar 2019 22:58:43 -0700 (PDT) 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 S1726227AbfC1F5i (ORCPT + 99 others); Thu, 28 Mar 2019 01:57:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37750 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725765AbfC1F5i (ORCPT ); Thu, 28 Mar 2019 01:57:38 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2S5niHR096572 for ; Thu, 28 Mar 2019 01:57:37 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rgkxyt219-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Mar 2019 01:57:36 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Mar 2019 05:57:34 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 28 Mar 2019 05:57:26 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2S5vPYa44761316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2019 05:57:25 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28854A4051; Thu, 28 Mar 2019 05:57:25 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9B51A405D; Thu, 28 Mar 2019 05:57:22 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.112]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 28 Mar 2019 05:57:22 +0000 (GMT) Date: Thu, 28 Mar 2019 07:57:21 +0200 From: Mike Rapoport To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Catalin Marinas , Christophe Leroy , Christoph Hellwig , "David S. Miller" , Dennis Zhou , Geert Uytterhoeven , Greentime Hu , Greg Kroah-Hartman , Guan Xuetao , Guo Ren , Guo Ren , Heiko Carstens , Juergen Gross , Mark Salter , Matt Turner , Max Filippov , Michal Simek , Paul Burton , Petr Mladek , Richard Weinberger , Rich Felker , Rob Herring , Rob Herring , Russell King , Stafford Horne , Tony Luck , Vineet Gupta , Yoshinori Sato , Andrew Morton , Linus Torvalds , linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Subject: Re: [PATCH AUTOSEL 5.0 015/262] memblock: memblock_phys_alloc_try_nid(): don't panic References: <20190327180158.10245-1-sashal@kernel.org> <20190327180158.10245-15-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190327180158.10245-15-sashal@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19032805-0020-0000-0000-00000328A172 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19032805-0021-0000-0000-0000217AE66F Message-Id: <20190328055720.GB14864@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-28_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=21 phishscore=0 bulkscore=0 spamscore=0 clxscore=1031 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-1903280044 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Mar 27, 2019 at 01:57:50PM -0400, Sasha Levin wrote: > From: Mike Rapoport > > [ Upstream commit 337555744e6e39dd1d87698c6084dd88a606d60a ] > > The memblock_phys_alloc_try_nid() function tries to allocate memory from > the requested node and then falls back to allocation from any node in > the system. The memblock_alloc_base() fallback used by this function > panics if the allocation fails. > > Replace the memblock_alloc_base() fallback with the direct call to > memblock_alloc_range_nid() and update the memblock_phys_alloc_try_nid() > callers to check the returned value and panic in case of error. This is a part of memblock refactoring, I don't think it should be applied to -stable. > Link: http://lkml.kernel.org/r/1548057848-15136-7-git-send-email-rppt@linux.ibm.com > Signed-off-by: Mike Rapoport > Acked-by: Michael Ellerman [powerpc] > Cc: Catalin Marinas > Cc: Christophe Leroy > Cc: Christoph Hellwig > Cc: "David S. Miller" > Cc: Dennis Zhou > Cc: Geert Uytterhoeven > Cc: Greentime Hu > Cc: Greg Kroah-Hartman > Cc: Guan Xuetao > Cc: Guo Ren > Cc: Guo Ren [c-sky] > Cc: Heiko Carstens > Cc: Juergen Gross [Xen] > Cc: Mark Salter > Cc: Matt Turner > Cc: Max Filippov > Cc: Michal Simek > Cc: Paul Burton > 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 > Signed-off-by: Linus Torvalds > Signed-off-by: Sasha Levin > --- > arch/arm64/mm/numa.c | 4 ++++ > arch/powerpc/mm/numa.c | 4 ++++ > mm/memblock.c | 4 +++- > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > index ae34e3a1cef1..2c61ea4e290b 100644 > --- a/arch/arm64/mm/numa.c > +++ b/arch/arm64/mm/numa.c > @@ -237,6 +237,10 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) > pr_info("Initmem setup node %d []\n", nid); > > nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); > + if (!nd_pa) > + panic("Cannot allocate %zu bytes for node %d data\n", > + nd_size, nid); > + > nd = __va(nd_pa); > > /* report and initialize */ > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c > index 87f0dd004295..8ec2ed30d44c 100644 > --- a/arch/powerpc/mm/numa.c > +++ b/arch/powerpc/mm/numa.c > @@ -788,6 +788,10 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) > int tnid; > > nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); > + if (!nd_pa) > + panic("Cannot allocate %zu bytes for node %d data\n", > + nd_size, nid); > + > nd = __va(nd_pa); > > /* report and initialize */ > diff --git a/mm/memblock.c b/mm/memblock.c > index ea31045ba704..d5923df56acc 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1342,7 +1342,9 @@ phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t ali > > if (res) > return res; > - return memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); > + return memblock_alloc_range_nid(size, align, 0, > + MEMBLOCK_ALLOC_ACCESSIBLE, > + NUMA_NO_NODE, MEMBLOCK_NONE); > } > > /** > -- > 2.19.1 > -- Sincerely yours, Mike.