Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3517924pxf; Mon, 15 Mar 2021 11:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpC3CEqsjZLIk69G7DKK4+t0zWnnqoTF+2LXGhXlSkuDacSwCkL3Y6MKPMjtsp/4L8GIMv X-Received: by 2002:a17:906:5e55:: with SMTP id b21mr9154970eju.289.1615832338243; Mon, 15 Mar 2021 11:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832338; cv=none; d=google.com; s=arc-20160816; b=IyZAXDeP+kVpGqufOLWZuXpSu170RZTdYtAmWhW1KJh8wwmQt6gtFSREzj3ADRGC/A AMCLBh+TGDoRTA8scdMB9g9BlVduIxe7GjBkumfSG62q7ij5kPM2NzXqfeXDSkweeBMo NpehU+SQVwD8yfpiSEcmqmr/wliE2zraxxNt3txPwjkxCEoeO13ce1U9EUTL4+Gix/f2 x7K/2IUomVE9lcgVxrIfN3sJHY2UaLMWZ4fckAEpX5lASJd+7yaxrZFAT/KOVkR95BM5 3Lp4vU4rOfK7b951Boy0NrbD8HS6Paze2z4oBHtwfI2m4Ka4Xw25zSiQSzNTLI7ELGW0 YuJg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0yO4Q+ugKLf30NKQDzYpHRH/wu8LE7Whct2GEgwUq/I=; b=yNV1/c76+xZ+dOlQCIn8U6NB9amDTooyAIloNZH7aNKZ6gXWL0KBdSxsWmo85asboC k38JIWWTD0/14ooKxhbKMPv5fAzxjADZEjWcI5ZqINxA0f55jAudD6EH0xGzzkwMp4xd M2DfQf/bFNxkDuHfcdYadr1jFuy4WrJczRRJc/bJl1Qnb/hCc2IsD3AuuD9Zx/x7XoEu RbU5dqKP0bwTxV+XU9ceGLwVNSR9Bm6gCL+Fp0P4k5jAhJIK8TO6hKRpjOsH6CMruOgH tPoYendbsTXvYl5DUUIpCSgljLr06focaFYisbpJxvECeRvwd7+M03ZYO71YPjDmO/Fa wS5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I50eQtcv; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si11699214edr.318.2021.03.15.11.18.36; Mon, 15 Mar 2021 11:18:58 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=I50eQtcv; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237245AbhCOORb (ORCPT + 99 others); Mon, 15 Mar 2021 10:17:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232730AbhCON7h (ORCPT ); Mon, 15 Mar 2021 09:59:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF25164EED; Mon, 15 Mar 2021 13:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816758; bh=0tFYE3MtH4RazdZlGrhlquZE9L0mDp7osAYvpz8Ww1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I50eQtcvIWo81rdeqao5QIBWENdgsoEJA1AKU8SiJBktjyQTvUFnQOKZh8W3hSQ8U BPqhbnCOlozkK6tOQ3i90WjcRwtBW0rGyPUFtjEKNG9iQfB7vmyeWsrO7pPpi1t5V0 3HkiCpv0g53/GdAPZOEV4nncAYnH4ugvjqxDt7ZQ= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Larsson , Mike Rapoport , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 049/120] sparc32: Limit memblock allocation to low memory Date: Mon, 15 Mar 2021 14:56:40 +0100 Message-Id: <20210315135721.590718391@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman 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 92634d4e440c..89a9244f2cf0 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -199,6 +199,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) size = memblock_phys_mem_size() - memblock_reserved_size(); *pages_avail = (size >> PAGE_SHIFT) - high_pages; + /* 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