From: jbarnes@sgi.com (Jesse Barnes)
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH] fix topology initialization
Date: Fri, 17 Oct 2003 17:50:45 +0000 [thread overview]
Message-ID: <marc-linux-ia64-106641334630073@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-106641334730082@msgid-missing>
Please ignore this bogus patch. I'll resend in a minute w/o all the
unnecessary crap.
Thanks,
Jesse
On Fri, Oct 17, 2003 at 10:48:34AM -0700, jbarnes wrote:
> Now that NUMA kernels are working we can properly initialze the topology
> information so that /sys/devices/system/node* & friends aren't empty.
>
> In doing this I found some circular dependencies, so I removed
> nodedata.h and did some forward declarations because I figured cleaning
> them up properly is something that can wait until after 2.6.
>
> Jesse
>
>
> diff -Nru a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
> --- a/arch/ia64/mm/numa.c Fri Oct 17 10:45:09 2003
> +++ b/arch/ia64/mm/numa.c Fri Oct 17 10:45:09 2003
> @@ -11,12 +11,20 @@
> */
>
> #include <linux/config.h>
> +#include <linux/cpu.h>
> #include <linux/kernel.h>
> #include <linux/mm.h>
> +#include <linux/memblk.h>
> +#include <linux/node.h>
> #include <linux/init.h>
> #include <linux/bootmem.h>
> +#include <linux/topology.h>
> #include <asm/numa.h>
>
> +struct memblk *sysfs_memblks;;
> +struct node *sysfs_nodes;
> +struct cpu *sysfs_cpus;
> +
> /*
> * The following structures are usually initialized by ACPI or
> * similar mechanisms and describe the NUMA characteristics of the machine.
> @@ -43,3 +51,42 @@
>
> return (i < num_memblks) ? node_memblk[i].nid : (num_memblks ? -1 : 0);
> }
> +
> +int __init topology_init(void)
> +{
> + int i, err = 0;
> +
> + sysfs_nodes = kmalloc(sizeof(struct node) * numnodes, GFP_KERNEL);
> + if (!sysfs_nodes)
> + return -ENOMEM;
> +
> + sysfs_memblks = kmalloc(sizeof(struct memblk) * num_memblks,
> + GFP_KERNEL);
> + if (!sysfs_memblks) {
> + kfree(sysfs_nodes);
> + return -ENOMEM;
> + }
> +
> + sysfs_cpus = kmalloc(sizeof(struct cpu) * NR_CPUS, GFP_KERNEL);
> + if (!sysfs_cpus) {
> + kfree(sysfs_memblks);
> + kfree(sysfs_nodes);
> + return -ENOMEM;
> + }
> +
> + for (i = 0; i < numnodes; i++)
> + err = register_node(&sysfs_nodes[i], i, 0);
> +
> + for (i = 0; i < num_memblks; i++)
> + err = register_memblk(&sysfs_memblks[i], i,
> + &sysfs_nodes[memblk_to_node(i)]);
> +
> + for (i = 0; i < NR_CPUS; i++)
> + if (cpu_online(i))
> + err = register_cpu(&sysfs_cpus[i], i,
> + &sysfs_nodes[cpu_to_node(i)]);
> +
> + return err;
> +}
> +
> +__initcall(topology_init);
> diff -Nru a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
> --- a/arch/ia64/sn/kernel/bte.c Fri Oct 17 10:45:09 2003
> +++ b/arch/ia64/sn/kernel/bte.c Fri Oct 17 10:45:09 2003
> @@ -39,7 +39,7 @@
> #include <asm/sn/sn_cpuid.h>
> #include <asm/sn/pda.h>
> #include <asm/sn/sn2/shubio.h>
> -#include <asm/nodedata.h>
> +#include <asm/mmzone.h>
>
> #include <linux/bootmem.h>
> #include <linux/string.h>
> diff -Nru a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h
> --- a/include/asm-ia64/mmzone.h Fri Oct 17 10:45:09 2003
> +++ b/include/asm-ia64/mmzone.h Fri Oct 17 10:45:09 2003
> @@ -12,8 +12,9 @@
> #define _ASM_IA64_MMZONE_H
>
> #include <linux/config.h>
> -#include <asm/page.h>
> #include <asm/meminit.h>
> +#include <asm/page.h>
> +#include <asm/percpu.h>
>
> #ifdef CONFIG_DISCONTIGMEM
>
> @@ -32,6 +33,15 @@
> #define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
> #define page_to_pfn(page) ((unsigned long) (page - vmem_map))
> #define pfn_to_page(pfn) (vmem_map + (pfn))
> +
> +struct ia64_node_data {
> + short active_cpu_count;
> + short node;
> + struct pglist_data *pg_data_ptrs[NR_NODES];
> +};
> +
> +#define local_node_data (local_cpu_data->node_data)
> +#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
>
> #endif /* CONFIG_DISCONTIGMEM */
> #endif /* _ASM_IA64_MMZONE_H */
> diff -Nru a/include/asm-ia64/nodedata.h b/include/asm-ia64/nodedata.h
> --- a/include/asm-ia64/nodedata.h Fri Oct 17 10:45:09 2003
> +++ /dev/null Wed Dec 31 16:00:00 1969
> @@ -1,52 +0,0 @@
> -/*
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Copyright (c) 2000 Silicon Graphics, Inc. All rights reserved.
> - * Copyright (c) 2002 NEC Corp.
> - * Copyright (c) 2002 Erich Focht <efocht@ess.nec.de>
> - * Copyright (c) 2002 Kimio Suganuma <k-suganuma@da.jp.nec.com>
> - */
> -#ifndef _ASM_IA64_NODEDATA_H
> -#define _ASM_IA64_NODEDATA_H
> -
> -#include <linux/config.h>
> -#include <linux/numa.h>
> -
> -#include <asm/percpu.h>
> -#include <asm/mmzone.h>
> -
> -#ifdef CONFIG_DISCONTIGMEM
> -
> -/*
> - * Node Data. One of these structures is located on each node of a NUMA system.
> - */
> -
> -struct pglist_data;
> -struct ia64_node_data {
> - short active_cpu_count;
> - short node;
> - struct pglist_data *pg_data_ptrs[NR_NODES];
> -};
> -
> -
> -/*
> - * Return a pointer to the node_data structure for the executing cpu.
> - */
> -#define local_node_data (local_cpu_data->node_data)
> -
> -/*
> - * Given a node id, return a pointer to the pg_data_t for the node.
> - *
> - * NODE_DATA - should be used in all code not related to system
> - * initialization. It uses pernode data structures to minimize
> - * offnode memory references. However, these structure are not
> - * present during boot. This macro can be used once cpu_init
> - * completes.
> - */
> -#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
> -
> -#endif /* CONFIG_DISCONTIGMEM */
> -
> -#endif /* _ASM_IA64_NODEDATA_H */
> diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
> --- a/include/asm-ia64/processor.h Fri Oct 17 10:45:09 2003
> +++ b/include/asm-ia64/processor.h Fri Oct 17 10:45:09 2003
> @@ -95,9 +95,6 @@
> #include <asm/rse.h>
> #include <asm/unwind.h>
> #include <asm/atomic.h>
> -#ifdef CONFIG_NUMA
> -#include <asm/nodedata.h>
> -#endif
>
> /* like above but expressed as bitfields for more efficient access: */
> struct ia64_psr {
> diff -Nru a/include/asm-ia64/sn/sn_cpuid.h b/include/asm-ia64/sn/sn_cpuid.h
> --- a/include/asm-ia64/sn/sn_cpuid.h Fri Oct 17 10:45:09 2003
> +++ b/include/asm-ia64/sn/sn_cpuid.h Fri Oct 17 10:45:09 2003
> @@ -17,7 +17,6 @@
> #include <linux/mmzone.h>
> #include <asm/sn/types.h>
> #include <asm/current.h>
> -#include <asm/nodedata.h>
> #include <asm/sn/pda.h>
>
>
> diff -Nru a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
> --- a/include/asm-ia64/topology.h Fri Oct 17 10:45:09 2003
> +++ b/include/asm-ia64/topology.h Fri Oct 17 10:45:09 2003
> @@ -13,6 +13,7 @@
> #ifndef _ASM_IA64_TOPOLOGY_H
> #define _ASM_IA64_TOPOLOGY_H
>
> +#include <linux/config.h>
> #include <asm/acpi.h>
> #include <asm/numa.h>
> #include <asm/smp.h>
> @@ -63,5 +64,12 @@
> #endif /* CONFIG_NUMA */
>
> #include <asm-generic/topology.h>
> +
> +struct memblk;
> +struct node;
> +struct cpu;
> +extern struct memblk *sysfs_memblks;
> +extern struct node *sysfs_nodes;
> +extern struct cpu *sysfs_cpus;
>
> #endif /* _ASM_IA64_TOPOLOGY_H */
next prev parent reply other threads:[~2003-10-17 17:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-17 17:48 [PATCH] fix topology initialization Jesse Barnes
2003-10-17 17:50 ` Jesse Barnes [this message]
2003-10-17 18:05 ` Christoph Hellwig
2003-10-17 18:27 ` Jesse Barnes
2003-10-17 18:34 ` Martin K. Petersen
2003-10-17 18:37 ` Christoph Hellwig
2003-10-17 18:51 ` Martin K. Petersen
2003-10-17 19:22 ` Chen, Kenneth W
2003-10-17 20:33 ` Jesse Barnes
2003-10-20 8:43 ` Jes Sorensen
2003-10-20 15:09 ` Martin K. Petersen
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=marc-linux-ia64-106641334630073@msgid-missing \
--to=jbarnes@sgi.com \
--cc=linux-ia64@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.