Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp623709pxv; Thu, 15 Jul 2021 11:49:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1mFrFnLYcMmqfj3mlFjsvnIPc1JzJczXoiqkxgFpEwQ+Bh3sXDsa4Y+idVTqpfJrm9A+R X-Received: by 2002:a05:6638:248d:: with SMTP id x13mr5293809jat.78.1626374943437; Thu, 15 Jul 2021 11:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626374943; cv=none; d=google.com; s=arc-20160816; b=QjX+hhv5Y0tVxh3Ro4Q7+3FvajPJZO2cMKxe3gdhKuzwMVdCOoT0v4g5KzFq1xJOki vkyiFaQ1y9piakSTDyqx4Edr7+3TPuo0WtkSgdZqSuJ71BRK+vm6SiGwNOogFfrGjLB3 O/d4hjiXcDXw0N2p42vi8rUUOoAhT5g/GXAkgVOYCq4OxbaQ2L0rAgcre2DbXfeUbtgr sIM96gzvFZcFPTz6QbeCRh0w1vnsczkbT+WYbRZezdsMuszbtEoQLa+24ZQ3KY62vOxJ 9kFdDxoeOr+w2SlJKQRB0O7M/GZCyOTeXZ3rabsfMm2nmGiigHsraO/dUlhRLpe9Bnc9 VNpg== 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=gfxRfaEOG/3hIW1OA6XLw0tUIQaScMK35kvF8TcmdJM=; b=k/6xiy+XtQ2WPTjnksc0LJUJMJ2VRk6lO/gykPJWVIVgPgPpXnsmK7jfEY34i+bCXc 7ut0Hfw3nHlsjyS2dM71J8c/4VJZ96jspQfScFCMzFfDbWihGEJvCZUOvuFobmI8x35+ ONB5heFlwOlDdyjdQLdPQEHK1vzKUxY02rs76K7MtF0Fy3KtDZH3Io5+puqo5iUDVS60 EjJSVIFkq+CKVXY57W8KLYMwHyrMjpdVzdVVOYy/ah8WYfW9LKyIiWi04wb8OpNk2p78 54Fnmz0bCBzGn+tRx6dNNt2cDQMMTkk7ERo644UXcBAGZBdPxRbJb48mMew1hn6z0n8O Hsvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="bQ1yTpu/"; 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 g3si7265180ile.55.2021.07.15.11.48.50; Thu, 15 Jul 2021 11:49:03 -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="bQ1yTpu/"; 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 S240106AbhGOSvE (ORCPT + 99 others); Thu, 15 Jul 2021 14:51:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:50284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238374AbhGOSsW (ORCPT ); Thu, 15 Jul 2021 14:48:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 54DF1613D2; Thu, 15 Jul 2021 18:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374728; bh=Mjf4HxiQbo/+SU70ssid65t4QSYTJdd0JJdJXbHjkRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQ1yTpu/tKulEJmI2g4bE3iIcj0PSZHkmpRv+5qhm2lKXk5k9gc1jf2UhjXw5vWwD 00dzlrhmnCnpofJiyvLIuOK3P5uT9fQW+bqaEYyzB1WJgIci/uyykEGe3ncq8x70o1 s0pGaax3ppBIn9tQ7ncrWL30kgZUAtI5DKO4w4QY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, zhanglianjie , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 070/122] MIPS: loongsoon64: Reserve memory below starting pfn to prevent Oops Date: Thu, 15 Jul 2021 20:38:37 +0200 Message-Id: <20210715182508.148278788@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182448.393443551@linuxfoundation.org> References: <20210715182448.393443551@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: zhanglianjie [ Upstream commit 6817c944430d00f71ccaa9c99ff5b0096aeb7873 ] The cause of the problem is as follows: 1. when cat /sys/devices/system/memory/memory0/valid_zones, test_pages_in_a_zone() will be called. 2. test_pages_in_a_zone() finds the zone according to stat_pfn = 0. The smallest pfn of the numa node in the mips architecture is 128, and the page corresponding to the previous 0~127 pfn is not initialized (page->flags is 0xFFFFFFFF) 3. The nid and zonenum obtained using page_zone(pfn_to_page(0)) are out of bounds in the corresponding array, &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)], access to the out-of-bounds zone member variables appear abnormal, resulting in Oops. Therefore, it is necessary to keep the page between 0 and the minimum pfn to prevent Oops from appearing. Signed-off-by: zhanglianjie Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/loongson64/loongson-3/numa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c index 8f20d2cb3767..7e7376cc94b1 100644 --- a/arch/mips/loongson64/loongson-3/numa.c +++ b/arch/mips/loongson64/loongson-3/numa.c @@ -200,6 +200,9 @@ static void __init node_mem_init(unsigned int node) if (node_end_pfn(0) >= (0xffffffff >> PAGE_SHIFT)) memblock_reserve((node_addrspace_offset | 0xfe000000), 32 << 20); + + /* Reserve pfn range 0~node[0]->node_start_pfn */ + memblock_reserve(0, PAGE_SIZE * start_pfn); } } -- 2.30.2