Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3523062pxf; Mon, 15 Mar 2021 11:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXk5uuW4Y3PPKGYR8Qg1mDR5rqIreNTXPK+GJpZTf/9mHIl8hHKogwbkle6r1ZuAj+fDQI X-Received: by 2002:a05:6402:170f:: with SMTP id y15mr31589644edu.127.1615832820908; Mon, 15 Mar 2021 11:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832820; cv=none; d=google.com; s=arc-20160816; b=fqW9hVoK/TQofoZnMH8QeuWIUEJ3HSDwpuzsvknl3N8aVvTHMbs5f+umNBLrkNYhp+ u3b9KyxuvFWn8oWAROEyqG4sFi2Gngk5Rbu43RdP14yH5zhqZaSxt3sXV0gi2gxX5QOT QQeo2kd+mP0iip6YcwKSlIv9V059TSuB0h5yDNwOYF9eWaiREUDh7P6Pf6rtP+Qmbgjc a+eDMKlL7VfXUn43sUjfyDbExECJeq5ZkKf3/RTIM2sk4AGwBoLGzbTIvBEdIYYw/gxF owp1G2rZ6nJ+qkS5aJMt6kOgYhd5h+Nf9ZyjMIa5nOiXMbry5jCBxjFI45psabltZDG6 Nj0g== 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=Gy1XA7XeKm2VwhFaaru5raCgFC9amVlKYraUanb4JVG1/fNqL0pUA9uCU79jeF0FqJ qEMMDimXgabXeHFLVzzk+bODoesdKrcsl/Ta9jUBNWN9Yw9wH8vXwLclF64oTO00RYs6 5kFCnz/P93SfNEWHhLyJ3NekhFZnHvnSFIJOePFATk9QTywXaJ0z5iwdMtAThz3AkCHs /2WwjU1BIAG5XtmhLXbCocjqlD4M0+xVD1H1fMOyxM2zOyeeljI8DGx/svF1MNnEoBC3 HyTGrUKgBN60Oi3FNdNa10CLk68t7k3G3LAfxxSp1PmdADvINoMDOVECzAjJHWTeqm6W d81w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EpEdy7BR; 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 n20si11457528ejx.104.2021.03.15.11.26.35; Mon, 15 Mar 2021 11:27:00 -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=EpEdy7BR; 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 S232725AbhCOO2m (ORCPT + 99 others); Mon, 15 Mar 2021 10:28:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:37522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233070AbhCOOAg (ORCPT ); Mon, 15 Mar 2021 10:00:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBAF464F64; Mon, 15 Mar 2021 14:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816820; bh=tKfLqY2RtHJ2cGJXWSiB9eV7t8BzdLjfNlrWg1O+C48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpEdy7BRENzyyJjG63jI8m3zKtZTeoTtDpyS0657MFmzZqVHG9OlFS+IBaNYbV7C3 Rwifnvh928bbXY0NkwxgXDpMYvlBJGjuDCw8s2yYF6AUkaTMRFZoubakn0WOuyoUzG Yu7cMx6KLegiZo0P7yY0S89tZ9wZ84EJSyAPMq+o= 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.11 144/306] sparc32: Limit memblock allocation to low memory Date: Mon, 15 Mar 2021 14:53:27 +0100 Message-Id: <20210315135512.510318025@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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