From patchwork Tue Feb 13 15:08:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 872899 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zgmXP2lXwz9t3F for ; Wed, 14 Feb 2018 02:23:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PVzhVMii"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zgmXP0nb9zF0sw for ; Wed, 14 Feb 2018 02:23:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PVzhVMii"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PVzhVMii"; dkim-atps=neutral Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zgmCF27cpzF1QS for ; Wed, 14 Feb 2018 02:08:57 +1100 (AEDT) Received: by mail-pg0-x244.google.com with SMTP id f6so32474pgs.10 for ; Tue, 13 Feb 2018 07:08:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+8ox8ErYK4DebMth3GT2nYsKXyAYqmo1PY2drwcQvnU=; b=PVzhVMiiqlKJb0dLySfbU1K2K5hFALuLkt8wsSGPS+7v705SPACAjN1SKgkeNO63Rr rJUn7uzi5nPGCuUDgE7YnEN39UO4qvhKCXKVHAst6UqIPFkZdKAoBvXRBKt2N1+aACbE CisE7eW+7DBBmLUy2heqTnYPvyqzqX0fXyYG/KyYM6Tp8mIaGSMAP+nyZySmjBA0WmTH d8l1Hs/B8UFAtn7mk1kH7kbJYdVixoDW8BLBqq55qcaVsYX0QzKvgah0l4UHJ21P+OfJ cTZ6AFHgMMxIHBIcBQIlfm0c9DDaRAVGU115lUMUq6K3FZU9MrMwWx4XM+HSWFQFJM6o laig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+8ox8ErYK4DebMth3GT2nYsKXyAYqmo1PY2drwcQvnU=; b=ayH5qOTPHN4IQ9bWmckJVSO5YLFxmd8EEqvrLNs8LRY+5qLTv8py47lQCuqmWkUQJW 6v5yUs4x8Ipdh02qmd7NrrdrUN4sbnsbn0Qgtj6qqXsOv2lzVYYoDjwUh+gwftQEqbTw mFooFO/d21w+m2CUKyQbQzL13a/DBpXQIJVUHUgTMYVTXMh14DNoGPYgVtU8dHRVsXcq cdgx8BmGl5rN9d3Rp2XT9uvcbSDMDOPcGg/fmuDi+gvAxEb0sQBnlgco70fth8ZElEHx I/wAv6Z8tkz4bh5Mowcu93Rt3IciIqd/E560m8ah+2eExTJNMeYzyt995eAFtJTqiPrz GqnQ== X-Gm-Message-State: APf1xPCNBfl7N0JBclZApOu7EHM1yFwiKQFClrEvhqQdmuP5S6nbmaso GhcDGCfW1MghzRePJojzorO/2A== X-Google-Smtp-Source: AH8x225uj0btTCVqjouHyoE1oiqFMG67F8nso2IFPkUw+8PyaUahmWR1IAJK3oUhWiEMQr9c8msUTQ== X-Received: by 10.98.42.87 with SMTP id q84mr1538653pfq.121.1518534534812; Tue, 13 Feb 2018 07:08:54 -0800 (PST) Received: from roar.local0.net ([202.7.219.42]) by smtp.gmail.com with ESMTPSA id f123sm24720533pgc.55.2018.02.13.07.08.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 07:08:53 -0800 (PST) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 06/14] powerpc/mm/numa: move numa topology discovery earlier Date: Wed, 14 Feb 2018 01:08:16 +1000 Message-Id: <20180213150824.27689-7-npiggin@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180213150824.27689-1-npiggin@gmail.com> References: <20180213150824.27689-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Split sparsemem initialisation from basic numa topology discovery. Move the parsing earlier in boot, before pacas are allocated. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/setup-common.c | 3 +++ arch/powerpc/mm/mem.c | 5 ++++- arch/powerpc/mm/numa.c | 32 +++++++++++++++++++------------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h index 469b7fdc9be4..d2bf233aebd5 100644 --- a/arch/powerpc/include/asm/setup.h +++ b/arch/powerpc/include/asm/setup.h @@ -23,6 +23,7 @@ extern void reloc_got2(unsigned long); #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) void check_for_initrd(void); +void mem_topology_setup(void); void initmem_init(void); void setup_panic(void); #define ARCH_PANIC_TIMEOUT 180 diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index d73ec518ef80..9eaf26318d20 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -888,6 +888,9 @@ void __init setup_arch(char **cmdline_p) /* Check the SMT related command line arguments (ppc64). */ check_smt_enabled(); + /* Parse memory topology */ + mem_topology_setup(); + /* On BookE, setup per-core TLB data structures. */ setup_tlb_core_data(); diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index fe8c61149fb8..4eee46ea4d96 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -212,7 +212,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, EXPORT_SYMBOL_GPL(walk_system_ram_range); #ifndef CONFIG_NEED_MULTIPLE_NODES -void __init initmem_init(void) +void __init mem_topology_setup(void) { max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; min_low_pfn = MEMORY_START >> PAGE_SHIFT; @@ -224,7 +224,10 @@ void __init initmem_init(void) * memblock_regions */ memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0); +} +void __init initmem_init(void) +{ /* XXX need to clip this if using highmem? */ sparse_memory_present_with_active_regions(0); sparse_init(); diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 9c3eb62bced5..57a5029b4521 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -831,18 +831,13 @@ static void __init find_possible_nodes(void) of_node_put(rtas); } -void __init initmem_init(void) +void __init mem_topology_setup(void) { - int nid, cpu; - - max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; - max_pfn = max_low_pfn; + int cpu; if (parse_numa_properties()) setup_nonnuma(); - memblock_dump_all(); - /* * Modify the set of possible NUMA nodes to reflect information * available about the set of online nodes, and the set of nodes @@ -853,6 +848,23 @@ void __init initmem_init(void) find_possible_nodes(); + setup_node_to_cpumask_map(); + + reset_numa_cpu_lookup_table(); + + for_each_present_cpu(cpu) + numa_setup_cpu(cpu); +} + +void __init initmem_init(void) +{ + int nid; + + max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; + max_pfn = max_low_pfn; + + memblock_dump_all(); + for_each_online_node(nid) { unsigned long start_pfn, end_pfn; @@ -863,10 +875,6 @@ void __init initmem_init(void) sparse_init(); - setup_node_to_cpumask_map(); - - reset_numa_cpu_lookup_table(); - /* * We need the numa_cpu_lookup_table to be accurate for all CPUs, * even before we online them, so that we can use cpu_to_{node,mem} @@ -876,8 +884,6 @@ void __init initmem_init(void) */ cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "powerpc/numa:prepare", ppc_numa_cpu_prepare, ppc_numa_cpu_dead); - for_each_present_cpu(cpu) - numa_setup_cpu(cpu); } static int __init early_numa(char *p)