Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp958516pxb; Wed, 3 Mar 2021 22:31:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJytbF8uE0IYRsdRuv/rp58Q3o2bEdOnoWFumIde7fs7vYpf1FbnK12dxv7+P4ooynwe3+Vy X-Received: by 2002:a05:6402:1855:: with SMTP id v21mr2684900edy.310.1614839519718; Wed, 03 Mar 2021 22:31:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614839519; cv=none; d=google.com; s=arc-20160816; b=liihnOKn3eaFdkMgMse9Y2k8XKYy9+PgWF91HCTaUXEi6YY9mWOva2OT0nm0de6qHu L2mgRPsHlXNShm2Blol9EdaIT1w5QFli3NYZb4IpJOAuSjLU4kl7ukuOlRYkKGUqVBnf 2A04yZ0VJ3Vxrf0A/j3HgZ4FvY+is6YZ+/rCX0ndP32gSkbVPjJhLFqkR6bZwqg8znXC ae0aOHo4rDsZl0/UTrFAa612qKgwMhw/OyKODcXpdP7B9r5pTKza5twzjhJ6EcyDuIzT G7+YILQ/eB9QO5TAz8WK545HiD4Xlzu4cED+kV528ZCikfdZRuuCNC0gNrikQJRY2rhT Dpsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4AAzVKj9nKxIwpmuYEvaieH+/iCLAnq9Q+LTieaVqiI=; b=zVg7ookFNsWXSbbh6lj7NIv+EyMFRX8MX/2s0xM1NUoGfLsppAV5ybu7jeYbr+iiKI 27B5IZcJPtEkJ3uGLkg8ntoKqhgS1fiq9u+ESXqA1j4YN95PZgh9On117J/sPkE5ANgG BQHtBj9NyNwywEA6VgsUPeO0CCFSbhLoVZ4bXrms51a7wTbXjYFA5yoluYMbQWM7K9PF 5ZA8vJybj5YHAZQ3IiDvmjG8nL1nUgzBMCpnkf5m957Uis1UQFqKyhlpEBmNPzjdmQ5/ 48qcGaF+JiwyelCx+ltZX2vCq6XSzJXbnn1IzJK/Aqcdy8+5OHJd3m6Oj0BX+x/HBgQL fNfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kIWdcC5r; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si6072272edx.438.2021.03.03.22.31.36; Wed, 03 Mar 2021 22:31:59 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kIWdcC5r; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1579557AbhCBQ6z (ORCPT + 99 others); Tue, 2 Mar 2021 11:58:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:47764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377909AbhCBO1F (ORCPT ); Tue, 2 Mar 2021 09:27:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 505A264FC9; Tue, 2 Mar 2021 11:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614686382; bh=EN+8mv8T3yg6CH9bMuNhDmN22IweqqPq3XDER+/w9Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIWdcC5rj5XUrh6pNlf2YIxwmvfgGkFX7q8t+Rm41+o3H5PnuykW/22oZNlgSR0z6 YpQCDk7bQi2cKikeD9V+gMcBkREcqMxfluJrQ44BwTc6p7/7Z7dW3+iKlTWxfcmrJb ZJGv+pcX1xUR84OrxHSPfvvzn+a6zjRQrgSk5HKuUpeA2nX/lcE2xXhLkJWcfIF7Ug 98prNrkIToNdAjGGEOaqfDkHptnSVz5n6mzFCVmabr3Z01ecHQZZOUwgyb7pt+t8n5 WxIaz5m9h4muvlwrstambC0z8b9yavPgtFOl+0JfGFGRy7rqZbYi9t/Dl797JuQOSA Hex65Ki+X8Ydw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andreas Larsson , Mike Rapoport , "David S . Miller" , Sasha Levin , sparclinux@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 4/8] sparc32: Limit memblock allocation to low memory Date: Tue, 2 Mar 2021 06:59:31 -0500 Message-Id: <20210302115935.63777-4-sashal@kernel.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210302115935.63777-1-sashal@kernel.org> References: <20210302115935.63777-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Larsson [ Upstream commit bda166930c37604ffa93f2425426af6921ec575a ] Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 changed sparc32 to use memblocks instead of bootmem, but also made high memory available via memblock allocation which does not work together with e.g. phys_to_virt and can lead to kernel panic. This changes back to only low memory being allocatable in the early stages, now using memblock allocation. Signed-off-by: Andreas Larsson Acked-by: Mike Rapoport Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- arch/sparc/mm/init_32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 3b7092d9ea8f..4abe4bf08377 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -240,6 +240,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT); *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT; + /* Only allow low memory to be allocated via memblock allocation */ + memblock_set_current_limit(max_low_pfn << PAGE_SHIFT); + return max_pfn; } -- 2.30.1