From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3657BEB64D7 for ; Wed, 28 Jun 2023 07:34:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B36C78D0002; Wed, 28 Jun 2023 03:34:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE7038D0001; Wed, 28 Jun 2023 03:34:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D70B8D0002; Wed, 28 Jun 2023 03:34:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8A9C18D0001 for ; Wed, 28 Jun 2023 03:34:11 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5A014B0600 for ; Wed, 28 Jun 2023 07:34:11 +0000 (UTC) X-FDA: 80951343102.23.E4CAF50 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id 98C524001B for ; Wed, 28 Jun 2023 07:34:09 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NxJpNPK4; spf=pass (imf07.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687937649; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/uEtqU0BshXA+GWcK4ks0xhnQV1HfvZm7oqFFSxh5OQ=; b=Hjl6LDWtCiUW6GQY/t7/AUWMyorFoGOxYHux8APoDf0wKZ1d9hVgQBx4y53pnEp+mb4zTC 9GyQlZTrraSsVCNoA4t0+UcBr89pIJvUgTSvGnVcZx2LhuG9GPFV4wJKkqcsfxyhd6o80L z4P8ipEQJ15O9UBjrNzgfnV/ehDpRU0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687937649; a=rsa-sha256; cv=none; b=aHK6rXVw6C5VktZhNqDN48lSwgOG8rMUG+jKt/sf9ZLgBKiRPMzvROzr3v7yZgho+W9QgU F/XLMG8yYUEB/WFbrOKMdwZA4GNgf2KNpgFAltroIRQhLwE8rGgugkaGq7Lk8IpX7JHpPO tG4RT9So8mdk2PheIA+FHBkwhrra55E= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NxJpNPK4; spf=pass (imf07.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A803612E4; Wed, 28 Jun 2023 07:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C47DC433CA; Wed, 28 Jun 2023 07:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687937648; bh=wMjh2mW4JXYa3sX6Q+SyiFJ+70tkbGtKkJXlOrezZnQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NxJpNPK4Awt3qiDCFtIjjIyLKcrvXKrb4g+qeaQjkGbbphdluOdGtfcmR5h1FXxRq TbccwUiiBusOwwG87ua1KKhM9iw54JzgBYbTrkpBFYrIPbN88HH5H4BJV4NgbJ1x6f cJzz6WBhAFTAIpXcNtLLi1aQpxnJv32DkX6OSqtqy8ILBq1IoWVgriMdVrKFsv9LvC ugM+RBXvjoCUBZZjxxjejjpUxieXewm3oJTOtskXnbLadIEXWvrC3/7rlrEvQRocf3 pBB6qbWuNDCvOaHzApMXzg0ra+Ld02PxQ5TzZec5qH2VqDbUb+tPIUGc/XfD8ILZTs lLAd/kIEL6tSQ== Date: Wed, 28 Jun 2023 10:33:17 +0300 From: Mike Rapoport To: Song Shuai Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memblock: report failures when memblock_can_resize is not set Message-ID: <20230628073317.GO52412@kernel.org> References: <20230624032607.921173-1-songshuaishuai@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230624032607.921173-1-songshuaishuai@tinylab.org> X-Stat-Signature: w5ot7och17qunhgu7j8gpt38mycu49i7 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 98C524001B X-Rspam-User: X-HE-Tag: 1687937649-580070 X-HE-Meta: U2FsdGVkX18xdqdVtI7A/K0vO2GUwJCwRDMMq3Q+qKD9mufioUKFPql0z0w0nHOOe6GDHdVsTjhrPn1YUaYX4Wetar5vCRBOY+ecEUfReIRAvCmNEUwwGTT/DTkN8RYlEcCZC68Y7907sVbnthHxrTU/eCddrP8Q63CfebOxbT/7vf+T5OnGZaxgMnFi+KvyjpgmE8ZuY4ObZH2P1Ilo+McEspl6mNsCIIMIZS7zfTcEJQJVg3CMqOgdKY3l4seeYcApsS/wBwKD9jS7nrhWS8sTpo88N1CfeYnfUQ2XhHRl+E7iqWZE/xiadkyBVuser2JvV7visJ7QTxcSb99/GrX3HyKFqXvJSEJ1F7sBQslXWrhEoelGINbs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bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Jun 24, 2023 at 11:26:07AM +0800, Song Shuai wrote: > The callers of memblock_reserve() do not check the return value > presuming that memblock_reserve() always succeeds, but there are > cases where it may fail. > > Having numerous memblock reservations at early boot where > memblock_can_resize is unset may exhaust the INIT_MEMBLOCK_REGIONS sized > memblock.reserved regions array and an attempt to double this array via > memblock_double_array() will fail and will return -1 to the caller. > > When this happens the system crashes anyway, but it's hard to identify > the reason for the crash. > > Add a panic message to memblock_double_array() to aid debugging of the > cases when too many regions are reserved before memblock can resize > memblock.reserved array. > > Link: https://lore.kernel.org/linux-kernel/20230614131746.3670303-1-songshuaishuai@tinylab.org/ > Signed-off-by: Song Shuai This is queued now, it will appear in memblock/for-next after the merge window closes. Thanks! > --- > mm/memblock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memblock.c b/mm/memblock.c > index 3feafea06ab2..1b8e902490e5 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -419,7 +419,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, > * of memory that aren't suitable for allocation > */ > if (!memblock_can_resize) > - return -1; > + panic("memblock: cannot resize %s array\n", type->name); > > /* Calculate new doubled size */ > old_size = type->max * sizeof(struct memblock_region); > -- > 2.20.1 > > -- Sincerely yours, Mike.