From: Erich Focht <efocht@ess.nec.de>
To: David Mosberger <davidm@hpl.hp.com>
Cc: Matthew Dobson <colpatch@us.ibm.com>,
"linux-ia64" <linux-ia64@linuxia64.org>,
"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: [PATCH] topology for ia64
Date: Sat, 5 Oct 2002 19:04:22 +0200 [thread overview]
Message-ID: <200210051904.22480.efocht@ess.nec.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
Hi David,
please find attached a first attempt to implement the topology.h
macros/routines for IA64. We need this for the NUMA scheduler setup.
Thanks!
Best regards,
Erich
[-- Attachment #2: 2.5.39_topology-ia64.patch --]
[-- Type: text/x-diff, Size: 4212 bytes --]
diff -urNp linux-2.5.39-ia64/arch/ia64/kernel/acpi.c linux-2.5.39-ia64-top/arch/ia64/kernel/acpi.c
--- linux-2.5.39-ia64/arch/ia64/kernel/acpi.c Fri Sep 27 23:49:54 2002
+++ linux-2.5.39-ia64-top/arch/ia64/kernel/acpi.c Sat Oct 5 19:02:52 2002
@@ -631,6 +631,7 @@ acpi_boot_init (char *cmdline)
smp_boot_data.cpu_count = total_cpus;
smp_build_cpu_map();
+ build_cpu_to_node_map();
#endif
/* Make boot-up look pretty */
printk("%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
diff -urNp linux-2.5.39-ia64/arch/ia64/kernel/smpboot.c linux-2.5.39-ia64-top/arch/ia64/kernel/smpboot.c
--- linux-2.5.39-ia64/arch/ia64/kernel/smpboot.c Fri Sep 27 23:49:16 2002
+++ linux-2.5.39-ia64-top/arch/ia64/kernel/smpboot.c Sat Oct 5 19:02:52 2002
@@ -16,6 +16,7 @@
#include <linux/config.h>
+#include <linux/acpi.h>
#include <linux/bootmem.h>
#include <linux/delay.h>
#include <linux/init.h>
@@ -427,6 +428,32 @@ smp_build_cpu_map (void)
}
}
+char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
+/*
+ * Build cpu to node mapping.
+ */
+void __init
+build_cpu_to_node_map(void)
+{
+ int cpu, i;
+
+ for(cpu=0; cpu<NR_CPUS; cpu++) {
+ if (!(phys_cpu_present_map & (1UL << cpu))) {
+ cpu_to_node_map[cpu] = -1;
+ continue;
+ }
+#ifdef CONFIG_ACPI_NUMA
+ for(i=0; i<NR_CPUS; i++)
+ if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
+ cpu_to_node_map[cpu]=node_cpuid[i].nid;
+ break;
+ }
+#else
+ cpu_to_node_map[cpu] = 0;
+#endif
+ }
+}
+
/*
* Cycle through the APs sending Wakeup IPIs to boot each.
*/
diff -urNp linux-2.5.39-ia64/include/asm-ia64/smp.h linux-2.5.39-ia64-top/include/asm-ia64/smp.h
--- linux-2.5.39-ia64/include/asm-ia64/smp.h Fri Sep 27 23:49:54 2002
+++ linux-2.5.39-ia64-top/include/asm-ia64/smp.h Sat Oct 5 19:02:52 2002
@@ -13,6 +13,7 @@
#ifdef CONFIG_SMP
+#include <linux/cache.h>
#include <linux/init.h>
#include <linux/threads.h>
#include <linux/kernel.h>
@@ -44,6 +45,7 @@ extern unsigned char smp_int_redirect;
extern volatile int ia64_cpu_to_sapicid[];
#define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
+extern char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
extern unsigned long ap_wakeup_vector;
diff -urNp linux-2.5.39-ia64/include/asm-ia64/topology.h linux-2.5.39-ia64-top/include/asm-ia64/topology.h
--- linux-2.5.39-ia64/include/asm-ia64/topology.h Thu Jan 1 01:00:00 1970
+++ linux-2.5.39-ia64-top/include/asm-ia64/topology.h Sat Oct 5 19:22:33 2002
@@ -0,0 +1,66 @@
+/*
+ * linux/include/asm-ia64/topology.h
+ *
+ * Copyright (C) 2002, Erich Focht, NEC
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef _ASM_IA64_TOPOLOGY_H
+#define _ASM_IA64_TOPOLOGY_H
+
+#include <asm/acpi.h>
+#include <asm/numa.h>
+
+/* Returns the number of the node containing CPU 'cpu' */
+#define __cpu_to_node(cpu) cpu_to_node_map[cpu]
+
+/*
+ * Returns the number of the node containing MemBlk 'memblk'
+ */
+#ifdef CONFIG_ACPI_NUMA
+#define __memblk_to_node(memblk) (node_memblk[memblk].nid)
+#else
+#define __memblk_to_node(memblk) (memblk)
+#endif
+
+/*
+ * Returns the number of the node containing Node 'nid'.
+ * Not implemented here. Multi-level hierarchies detected with
+ * the help of node_distance().
+ */
+#define __parent_node(nid) (nid)
+
+/*
+ * Returns the number of the first CPU on Node 'node'.
+ * Temporarily implemented with the help of pool arrays, so
+ * don't use it too early.
+ * Who needs this?
+ */
+/* #define __node_to_first_cpu(node) pool_cpus[pool_ptr[node]] */
+
+/*
+ * Returns a bitmask of CPUs on Node 'node'.
+ */
+static inline unsigned long __node_to_cpu_mask(int node)
+{
+ int cpu;
+ unsigned long mask = 0UL;
+
+ for(cpu=0; cpu<NR_CPUS; cpu++)
+ if (__cpu_to_node(cpu) == node)
+ mask |= 1UL << cpu;
+ return mask;
+}
+
+/*
+ * Returns the number of the first MemBlk on Node 'node'
+ * Should be fixed when IA64 discontigmem goes in.
+ */
+#define __node_to_memblk(node) (node)
+
+#endif /* _ASM_IA64_TOPOLOGY_H */
next reply other threads:[~2002-10-05 22:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-05 17:04 Erich Focht [this message]
2002-10-22 0:07 ` [PATCH] topology for ia64 David Mosberger
2002-10-22 9:23 ` Erich Focht
2002-10-29 22:19 ` Matthew Dobson
2002-10-29 22:35 ` [Linux-ia64] " Michael Hohnbaum
2002-10-29 23:55 ` Matthew Dobson
2002-10-29 22:47 ` William Lee Irwin III
2002-10-30 0:01 ` Matthew Dobson
2002-10-29 23:43 ` Erich Focht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200210051904.22480.efocht@ess.nec.de \
--to=efocht@ess.nec.de \
--cc=colpatch@us.ibm.com \
--cc=davidm@hpl.hp.com \
--cc=linux-ia64@linuxia64.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.