Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3515261pxf; Mon, 15 Mar 2021 11:15:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0X7pN/yQiQI15IteLX7T2tFsjG13W0CqKe8/j9UZfYb3xgY1j15cAQHXJSgToaWTXqfvT X-Received: by 2002:a05:6402:46:: with SMTP id f6mr31502275edu.252.1615832107672; Mon, 15 Mar 2021 11:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832107; cv=none; d=google.com; s=arc-20160816; b=TxjNMJXmkqggnF0Odn/E78LkYuvcRT9Z2A6XXSCzFCIyFsZtMgP1YwP69kWFWQ7/vb ZdLr4R8RD84e4izSFG/BtYkjrmECb4iPeQg8ZUbyO1IgKH/QwHjiK/uvBS1jJjJmwjtJ d5B+MlEiVzCmZ215WxedPSyfiozNHWc/vScwmqMD+4qzYJyQBVZNyJiOGYjIir29lnxZ awyH5xoLcgvfcviH//mESRcVU2sgwLzPDvmAR1KIPPzLUgMhkqEu170QTwCch8VnD1+A k6E6zQ7GN+iI3xyCDdldkagALunvXPF4HJqJmo7OZTFu/kx6pWwMd7nA9Icj/GQN1QcL Vyrw== 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=sNbrFHWslW6jKpBhCuJjKLGy9FCcGQplGZ51G62hwfU=; b=UeRUkH92qwBLFLB/h1gqilxcNV+zcY8oprbDhFvjQCo4tcI2khOww6jgr2KZ1/NNy4 l6+ShqqZ3mMmNfKuhCFY3/TdDGzAd6OcqTHEGfOV/UWEZuAsT+yFF5wDlDpxCEoCH0dW xmnbCY5VKW2w1GJlvu4hCKJeUSepCoACjv7hc+s/mtAAR8l6Bfs0HX3A+MnwD1I4J8k8 +VR9U5Th12Uy0uy/X1QRjsSfknUY/qzrpBI6npYHW+BzKnWJreCJ6oivR1cTQrFEyfC1 l5qVn/qa347t3ng7YI3JBq/HEmdvklRIven3hpj5wKQHDUWrDx7ojhOFqaEx4kLEArki Bv2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cHujX+El; 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 s18si12435800ejj.88.2021.03.15.11.14.44; Mon, 15 Mar 2021 11:15:07 -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=cHujX+El; 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 S229803AbhCOONV (ORCPT + 99 others); Mon, 15 Mar 2021 10:13:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:36764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbhCON7E (ORCPT ); Mon, 15 Mar 2021 09:59:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5367064F58; Mon, 15 Mar 2021 13:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816734; bh=HvHHH5Zj0fb3ehs4nPp0IyMb5jy/2HIN72EjIA9uBqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cHujX+ElqTXgQMwu+21ihB5+/abKF1Rs8/KTNNP7RrTJFTZQ+W8zDmqtaop+xzQma 3hm/lr6fZyqaQ07m1ZGksX7aX13oBO070DuL2iiStSQx6uZ0K8uaccTFFtVzj2v7k0 8SwiZTJaD6QxrV96D55PpkZu09b+cRiiLbWapcwM= 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.4 075/168] sparc32: Limit memblock allocation to low memory Date: Mon, 15 Mar 2021 14:55:07 +0100 Message-Id: <20210315135552.854662541@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 906eda1158b4..40dd6cb4a413 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