From patchwork Sat Mar 19 07:11:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feiyang Chen X-Patchwork-Id: 12786108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 287BDC433EF for ; Sat, 19 Mar 2022 07:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242343AbiCSHMi (ORCPT ); Sat, 19 Mar 2022 03:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234579AbiCSHMh (ORCPT ); Sat, 19 Mar 2022 03:12:37 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3465A267595 for ; Sat, 19 Mar 2022 00:11:17 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id s42so11435317pfg.0 for ; Sat, 19 Mar 2022 00:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DU0ZKTW+1Tm89cI6PB1G8H0LRBsnzvzcRpFTEbO1hn8=; b=QWUaY/34M4+Wqw3Rzz22e/ZPkb+MqydNoMoHXGpaMxesLvTMdmfn1FDgequpLGffAA UGfJjBI/o0Fiup2uKPd8qcN99pXiLAI/xjooDMLYGzZyx4G5Vpyzt6r01kG+e2mWWqvD cPphpMTL8FOvZ2NHrMmA7kmVAgxnkaSxm6iIaMHvKzfHreKpj7Bfw0rdeyZqj7+kIOFD hwRhYpkac+lLe09BxgPMKXuL1MSLLwrVaj30udJZh2YUYt+NUcyHkp+BvvOGTS2OhLWz Qa83vkNI1VpW9aEt7R1nhheQkzCbEuTBIPfyKMCKpkKbdIDx1/f1QfjotO6PLSC9Bjof EJbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DU0ZKTW+1Tm89cI6PB1G8H0LRBsnzvzcRpFTEbO1hn8=; b=XZYbAWRZ5jNQypIh3bbAxCzbKgNnjPIHuNZvkl1d2vs2akxQHJJBE58w4TkbB3saMP ul9lDjf/c677x2CG9iE1LGFOQeTh5M98gFotMMn5qowFxOlEWbwGzbBmByvFm9c8MCET VDLQGxG++lwrM6YkA/SiEmEDQshoqdOe91bNmsicQsE3W/JWbgJH12GM2Jsl87z68nt+ SLomDFlGSNkd3E37FoIWWkHz7moXoI9yvStMZc/VgTRr357xb3IhWQ6tZ5Uo43Kq/A+c +QUkbxoO+b5XySvc2utv70rfyzyxHpLV1P3zcKCGVnIO+8Ou0BxdO4RvbpFtS3BRsvB2 08EA== X-Gm-Message-State: AOAM53282+qRfNdWFZQCjVMaw4Zwy+qrlUh920dC57irohYgKncD0+wS 5kFsvx/EpZFQlK+SZlNSm6A= X-Google-Smtp-Source: ABdhPJy5jg0Amjfz3SCviFeSjI/8+WzJ7grYR+gqDR8LsFeYU//SXk1iDvskJboKHNnslZhHA5A/LQ== X-Received: by 2002:a63:1321:0:b0:376:333b:3ed with SMTP id i33-20020a631321000000b00376333b03edmr10516071pgl.283.1647673876757; Sat, 19 Mar 2022 00:11:16 -0700 (PDT) Received: from localhost.localdomain ([155.94.198.189]) by smtp.gmail.com with ESMTPSA id u25-20020a62ed19000000b004f140515d56sm11497103pfh.46.2022.03.19.00.11.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 19 Mar 2022 00:11:16 -0700 (PDT) From: Feiyang Chen X-Google-Original-From: Feiyang Chen To: tsbogend@alpha.franken.de Cc: Feiyang Chen , chenhuacai@kernel.org, jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org Subject: [PATCH 1/2] MIPS: loongson64: Fix build error when CONFIG_NUMA is set Date: Sat, 19 Mar 2022 15:11:03 +0800 Message-Id: <91781d982e1b89ab4fc7f1f378433eaa0e44b15a.1647671808.git.chenfeiyang@loongson.cn> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Modify __node_data to node_data to fix the build error when CONFIG_NUMA=y: mips64el-unknown-linux-gnu-ld: mm/page_alloc.o: in function `free_area_init': (.init.text+0x1714): undefined reference to `node_data' mips64el-unknown-linux-gnu-ld: (.init.text+0x1730): undefined reference to `node_data' BTW, modify __node_distances and __node_cpumask to follow the same style. Signed-off-by: Feiyang Chen --- .../mips/include/asm/mach-loongson64/mmzone.h | 4 ++-- .../include/asm/mach-loongson64/topology.h | 8 +++---- arch/mips/loongson64/numa.c | 22 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h index ebb1deaa77b9..14e2b860ad65 100644 --- a/arch/mips/include/asm/mach-loongson64/mmzone.h +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h @@ -14,9 +14,9 @@ #define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT) #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT) -extern struct pglist_data *__node_data[]; +extern struct pglist_data *node_data[]; -#define NODE_DATA(n) (__node_data[n]) +#define NODE_DATA(n) (node_data[n]) extern void setup_zero_pages(void); extern void __init prom_init_numa_memory(void); diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h index 3414a1fd1783..dc71eaf9c819 100644 --- a/arch/mips/include/asm/mach-loongson64/topology.h +++ b/arch/mips/include/asm/mach-loongson64/topology.h @@ -6,17 +6,17 @@ #define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2) -extern cpumask_t __node_cpumask[]; -#define cpumask_of_node(node) (&__node_cpumask[node]) +extern cpumask_t node_cpumask[]; +#define cpumask_of_node(node) (&node_cpumask[node]) struct pci_bus; extern int pcibus_to_node(struct pci_bus *); #define cpumask_of_pcibus(bus) (cpu_online_mask) -extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; +extern unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; -#define node_distance(from, to) (__node_distances[(from)][(to)]) +#define node_distance(from, to) (node_distances[(from)][(to)]) #endif diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c index e8e3e48c5333..9c1bf29c1aae 100644 --- a/arch/mips/loongson64/numa.c +++ b/arch/mips/loongson64/numa.c @@ -27,13 +27,13 @@ #include #include -unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; -EXPORT_SYMBOL(__node_distances); -struct pglist_data *__node_data[MAX_NUMNODES]; -EXPORT_SYMBOL(__node_data); +unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; +EXPORT_SYMBOL(node_distances); +struct pglist_data *node_data[MAX_NUMNODES]; +EXPORT_SYMBOL(node_data); -cpumask_t __node_cpumask[MAX_NUMNODES]; -EXPORT_SYMBOL(__node_cpumask); +cpumask_t node_cpumask[MAX_NUMNODES]; +EXPORT_SYMBOL(node_cpumask); static void cpu_node_probe(void) { @@ -71,11 +71,11 @@ static void __init init_topology_matrix(void) for (row = 0; row < MAX_NUMNODES; row++) for (col = 0; col < MAX_NUMNODES; col++) - __node_distances[row][col] = -1; + node_distances[row][col] = -1; for_each_online_node(row) { for_each_online_node(col) { - __node_distances[row][col] = + node_distances[row][col] = compute_node_distance(row, col); } } @@ -107,7 +107,7 @@ static void __init node_mem_init(unsigned int node) tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); if (tnid != node) pr_info("NODE_DATA(%d) on node %d\n", node, tnid); - __node_data[node] = nd; + node_data[node] = nd; NODE_DATA(node)->node_start_pfn = start_pfn; NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; @@ -146,7 +146,7 @@ static __init void prom_meminit(void) if (node_online(node)) { szmem(node); node_mem_init(node); - cpumask_clear(&__node_cpumask[node]); + cpumask_clear(&node_cpumask[node]); } } max_low_pfn = PHYS_PFN(memblock_end_of_DRAM()); @@ -159,7 +159,7 @@ static __init void prom_meminit(void) if (loongson_sysconf.reserved_cpus_mask & (1< X-Patchwork-Id: 12786109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33F99C433EF for ; Sat, 19 Mar 2022 07:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242344AbiCSHMk (ORCPT ); Sat, 19 Mar 2022 03:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234579AbiCSHMk (ORCPT ); Sat, 19 Mar 2022 03:12:40 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B05A2689B7 for ; Sat, 19 Mar 2022 00:11:19 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id c2so6585218pga.10 for ; Sat, 19 Mar 2022 00:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BfGRnf/z7W5ArUlF62xSoPtZ6L15hObjWG1DHqomhrA=; b=nMpz+AAFX9c4HxUAxMrJX9zfN12HcpTFOE6syrfVzF1VFHOSzC4CTuB4TR1UnU0a+i VWapFDhHw3Xo+017WIA/i5aXYYSh/8Ql8lukfl5rrklpC79CA2UyyKXauU3vxmP92eQQ nsTX1R8TbcR49Hz1ZkU4phEwDy4Q4EADTJw1B+4JvSDpVIpNPvTs8CfTMCEgvAizD+IE uXNLi5KvrTCT92CPJ5iMrRBgDVWKW/FV+3OfaGIqcbB0sr4TDBTE72lIlLoiJp1ulfBi SsvUPtB0Vy6t1BscfOul4wWRLWYu7kIyGMtPRmxbdg8Qi+KQ8LDJoUYmlC3nmSp4i5yv fTHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BfGRnf/z7W5ArUlF62xSoPtZ6L15hObjWG1DHqomhrA=; b=T6J5wiFRNv8BzKrTPpI+7T0eJ9xiu9Ta6D1mOS49AaSJvctH0bZgs1PWJVkZFR8Wc2 b+Y54Dfy7RqIGOj64xQ/70/CROrURWZFQmugTZybNKGWldjDLsZYkQa7SJkfAg5cY0MJ RfmewWFocR6Pp4Ic27Bo5Bto14IzwJ7ufGYBKWZZJB6EBO7gglMUMWUV+kPg0gbJekuK N9c3vuRM9oPMP4A3BbNmcM4texuWffAJovLiYgKdbItR7qW3yOaijuviF2VcOCwAqRu3 /kjQ9ZxQr/7lhNBWYyml1WJQTKxSx6IYmuTCXD4lXySsRuEwqpT1HX0LForDNLbxdrK9 1fxg== X-Gm-Message-State: AOAM533avVqva4claqLPE9ieBdIoJM/k5TGKK/sVPyVkf+QXB0WLilZx wcXl0e/qEWZD2q9Od/JdqGw= X-Google-Smtp-Source: ABdhPJwJ20ooARuExH+Ikwtors6q+luM9RqiClU80SEaxw1FRKBfFF9IbjByWDfXkpBtiF/djg3Iaw== X-Received: by 2002:a63:501d:0:b0:382:56b1:9a01 with SMTP id e29-20020a63501d000000b0038256b19a01mr94756pgb.393.1647673879199; Sat, 19 Mar 2022 00:11:19 -0700 (PDT) Received: from localhost.localdomain ([155.94.198.189]) by smtp.gmail.com with ESMTPSA id u25-20020a62ed19000000b004f140515d56sm11497103pfh.46.2022.03.19.00.11.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 19 Mar 2022 00:11:18 -0700 (PDT) From: Feiyang Chen X-Google-Original-From: Feiyang Chen To: tsbogend@alpha.franken.de Cc: Feiyang Chen , chenhuacai@kernel.org, jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org Subject: [PATCH 2/2] MIPS: sgi-ip27: Fix build error Date: Sat, 19 Mar 2022 15:11:04 +0800 Message-Id: <70de3680b4c9d0eabaca03dc0140a1ca3a246a5e.1647671808.git.chenfeiyang@loongson.cn> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Select HAVE_ARCH_NODEDATA_EXTENSION for sgi-ip27 to fix build error: mips64el-unknown-linux-gnu-ld: mm/page_alloc.o: in function `free_area_init': page_alloc.c:(.init.text+0x1ba8): undefined reference to `node_data' mips64el-unknown-linux-gnu-ld: page_alloc.c:(.init.text+0x1bcc): undefined reference to `node_data' mips64el-unknown-linux-gnu-ld: page_alloc.c:(.init.text+0x1be4): undefined reference to `node_data' mips64el-unknown-linux-gnu-ld: page_alloc.c:(.init.text+0x1bf4): undefined reference to `node_data' Signed-off-by: Feiyang Chen --- arch/mips/Kconfig | 4 ++++ arch/mips/sgi-ip27/ip27-memory.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0dae5f1e61cc..beaa2aa08c59 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -709,6 +709,7 @@ config SGI_IP27 select WAR_R10000_LLSC select MIPS_L1_CACHE_SHIFT_7 select NUMA + select HAVE_ARCH_NODEDATA_EXTENSION help This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics workstations. To compile a Linux kernel that runs on these, say Y @@ -2708,6 +2709,9 @@ config NUMA config SYS_SUPPORTS_NUMA bool +config HAVE_ARCH_NODEDATA_EXTENSION + bool + config RELOCATABLE bool "Relocatable kernel" depends on SYS_SUPPORTS_RELOCATABLE diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index adc2faeecf7c..f79c48393716 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c @@ -422,3 +422,13 @@ void __init mem_init(void) memblock_free_all(); setup_zero_pages(); /* This comes from node 0 */ } + +pg_data_t * __init arch_alloc_nodedata(int nid) +{ + return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); +} + +void arch_refresh_nodedata(int nid, pg_data_t *pgdat) +{ + __node_data[nid] = (struct node_data *)pgdat; +}