Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3343280pxf; Mon, 15 Mar 2021 07:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeOuhvz5EHYt1dVNKH5s0ikiIXRCtfEdBiAwvv5n61HIeRkfz5dcX0B4Q38uX12sHOfJAl X-Received: by 2002:a17:906:5d05:: with SMTP id g5mr23544119ejt.489.1615818876627; Mon, 15 Mar 2021 07:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615818876; cv=none; d=google.com; s=arc-20160816; b=AGrgzH9vBnUx9ela4ohBo8XWqKmiiT2wivXrTThN075gzJUXkJ6NrLtaPITKiB4fLB QU5fT+Otcu5MQ2YMptCti1ybtOUAPKBREox+mT9LYQzfq0PACLAQf8bS2JMpA/3OBs1Q DZnWwf0oYfdy2Pq+jnJoEEpzBnko8GPk+4WF9SnG5fwWjN2AU60jkJ82jV+CzSLTfmDR D7CH2fFgLWWaD5hcn9GR0ZoXwQKrclZ12yybdYr2naGl72C4IQ4heX1HQjOmK1230X+/ 9eBmvZcoBUkSuTLEObtuKQHSJgo567Dznx2ogs4dJkqeociE9/alHsm0D7k9dpkM6rB2 e8mw== 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=6OwoP2TWFsla1z1XeLceo6aLC8BmOWMImuwpu547h7E=; b=wMd+wRTXV44LCb0LK0x+cRR4P1yFZx3UlNc/Ncat+ehTCxnXnqFKG1BIB+eRYTavdC Ec1PPqx18bn0ACH2GuUMpip4H7Qmm+vtjSqTlVScDB4AkveYudAeXLDmFq32jaGoaMMU NzXvWgM/JMRs5i+UgIyE5JecvWFQSqvpEBtQ/WYQPy1df3mkaTve/stjiAi8OmvnJcye jJwC3dKlMexJ+2KPYVarEm3KHGPYW6kFi4lKzQgmPUxrb5OTpsZ9na2pbFo1G87IxdP1 SEDo2r943faKWkcxWgHk/IcSnCfbfsrtWXMznqJ6yxw6F1288QUqVsnNhy9GzGfk4B3i hq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YL9EwobD; 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 a1si11172135ejg.521.2021.03.15.07.34.13; Mon, 15 Mar 2021 07:34:36 -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=YL9EwobD; 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 S239442AbhCOOc0 (ORCPT + 99 others); Mon, 15 Mar 2021 10:32:26 -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 S233228AbhCOOBM (ORCPT ); Mon, 15 Mar 2021 10:01:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EAEEE64F6D; Mon, 15 Mar 2021 14:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816846; bh=tKfLqY2RtHJ2cGJXWSiB9eV7t8BzdLjfNlrWg1O+C48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YL9EwobDUA3q0aqHTFtZUj4si2P27Vl7yA6oxbMqar1MDg9Ach9jmEFO9fHJVVSDS ki1qspmQfkceVssqsw8JyWGn2p7JT1lro+kfG4j6h3x4IgFYPx/9qWGVGdndw2AtcE Yb134VTpDzrHQhGfNI3Z3L3qT1cyCYlI65SF6jLk= 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 5.10 148/290] sparc32: Limit memblock allocation to low memory Date: Mon, 15 Mar 2021 14:54:01 +0100 Message-Id: <20210315135546.918508206@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 eb2946b1df8a..6139c5700ccc 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -197,6 +197,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