Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp173611imu; Thu, 8 Nov 2018 06:45:20 -0800 (PST) X-Google-Smtp-Source: AJdET5cCQuMJrugPEjuJMyZB8MYKj75KRS7xvdFBzRe3jplO6cHwlstT30WijT7vjSluq4LMw0Fb X-Received: by 2002:a17:902:b598:: with SMTP id a24-v6mr4800587pls.231.1541688320742; Thu, 08 Nov 2018 06:45:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541688320; cv=none; d=google.com; s=arc-20160816; b=VJZef0QIw4ETBEoZO3dekoEjs5e2sXmPXfJViaV0lcy2UufDe1BzjiSeER5xC2qH8I KmqNaPAJQsG7I7J99403nj2PECwmIH1nL/zwld0BGRbIIbtu2RxPN7E6rsS3h/U+VT0Y 7EgyPA51y3fxkLpULmDvUJz6xuYkC4cDaiAl7F3g0Q4xyQhTzSPh6mJS6vg7njF/bfKP CXR01FXdl9oIqEqXs7f7ophqNiabcV58OFsdCdaAm+mIb+GQTRQcNelM+IxaDmzFLWn8 uEVVdpmM1RlwpDGm/e2cm2sTHo+EN/kw/18p1nk5YcA8KbRQqreFAAUhaKqplWQF+gaQ hBRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=NFqoW0WmzboRcL/+lvrkY/kyOW5fLO6E8zNT8+WIGbA=; b=nvLpjKxxbu1CP+AaJD2g2hwv+xKCbOaxdOlp0C8DJiJscjD538KOZOVVzsruv09CQ+ q6Ctl/C/TK6Q39jaHI+9syHBgUW2Amu9sGIo+8drWfRo+8jlxTdSCfSkzS8/13VDnncd jhDT6ra+MrDw56XS5IwzEdM7FnFSSzW4VfODfbAAEqWysYwIQYI/Tq6oJMq3fYVZIji8 BAuDw9Cnqn/sf1gIBjTRYssEN+gtfPWHMwEKjUBd9or8lnWjtMiJHxVo7ipdp0wi5irZ otU73mNrqglH2W/i4538NJkNUqbMmO+RysPiWgE9dZXPzs2+NTSpKPFC6mFF3ugiJdzz gHKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4-v6si4368745pls.376.2018.11.08.06.45.04; Thu, 08 Nov 2018 06:45:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726975AbeKIAU0 (ORCPT + 99 others); Thu, 8 Nov 2018 19:20:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:52532 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726359AbeKIAUZ (ORCPT ); Thu, 8 Nov 2018 19:20:25 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C5844AEB2; Thu, 8 Nov 2018 14:44:35 +0000 (UTC) From: Thomas Bogendoerfer To: Ralf Baechle , Paul Burton , James Hogan , Huacai Chen , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Cc: rppt@linux.vnet.ibm.com Subject: [[PATCH]] mips: Fix switch to NO_BOOTMEM for SGI-IP27/loongons3 NUMA Date: Thu, 8 Nov 2018 15:44:28 +0100 Message-Id: <20181108144428.28149-1-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.13.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit bcec54bf3118 ("mips: switch to NO_BOOTMEM") broke SGI-IP27 and NUMA enabled loongson3 by doing memblock_set_current_limit() before max_low_pfn has been evaluated. Both platforms need to do the memblock_set_current_limit() in platform specific code. For consistency the call to memblock_set_current_limit() is moved to the common bootmem_init(), where max_low_pfn is calculated for non NUMA enabled platforms. Fixes: bcec54bf3118 ("mips: switch to NO_BOOTMEM") Signed-off-by: Thomas Bogendoerfer --- arch/mips/kernel/setup.c | 18 +++++++++--------- arch/mips/loongson64/loongson-3/numa.c | 1 + arch/mips/sgi-ip27/ip27-memory.c | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index ea09ed6a80a9..b5167b198231 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -576,6 +576,15 @@ static void __init bootmem_init(void) * Reserve initrd memory if needed. */ finalize_initrd(); + + /* + * Prevent memblock from allocating high memory. + * This cannot be done before max_low_pfn is detected, so up + * to this point is possible to only reserve physical memory + * with memblock_reserve; memblock_alloc* can be used + * only after this point + */ + memblock_set_current_limit(PFN_PHYS(max_low_pfn)); } #endif /* CONFIG_SGI_IP27 */ @@ -854,15 +863,6 @@ static void __init arch_mem_init(char **cmdline_p) bootmem_init(); - /* - * Prevent memblock from allocating high memory. - * This cannot be done before max_low_pfn is detected, so up - * to this point is possible to only reserve physical memory - * with memblock_reserve; memblock_alloc* can be used - * only after this point - */ - memblock_set_current_limit(PFN_PHYS(max_low_pfn)); - #ifdef CONFIG_PROC_VMCORE if (setup_elfcorehdr && setup_elfcorehdr_size) { printk(KERN_INFO "kdump reserved memory at %lx-%lx\n", diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c index 622761878cd1..5593a8e3cd88 100644 --- a/arch/mips/loongson64/loongson-3/numa.c +++ b/arch/mips/loongson64/loongson-3/numa.c @@ -265,6 +265,7 @@ void __init paging_init(void) zones_size[ZONE_DMA32] = MAX_DMA32_PFN; #endif zones_size[ZONE_NORMAL] = max_low_pfn; + memblock_set_current_limit(PFN_PHYS(max_low_pfn)); free_area_init_nodes(zones_size); } diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index d8b8444d6795..0d0deeae1f47 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c @@ -468,6 +468,7 @@ void __init paging_init(void) max_low_pfn = end_pfn; } zones_size[ZONE_NORMAL] = max_low_pfn; + memblock_set_current_limit(PFN_PHYS(max_low_pfn)); free_area_init_nodes(zones_size); } -- 2.13.7