linux/drivers/base
Mike Travis 23ca4bba3e x86: cleanup early per cpu variables/accesses v4
* Introduce a new PER_CPU macro called "EARLY_PER_CPU".  This is
    used by some per_cpu variables that are initialized and accessed
    before there are per_cpu areas allocated.

    ["Early" in respect to per_cpu variables is "earlier than the per_cpu
    areas have been setup".]

    This patchset adds these new macros:

	DEFINE_EARLY_PER_CPU(_type, _name, _initvalue)
	EXPORT_EARLY_PER_CPU_SYMBOL(_name)
	DECLARE_EARLY_PER_CPU(_type, _name)

	early_per_cpu_ptr(_name)
	early_per_cpu_map(_name, _idx)
	early_per_cpu(_name, _cpu)

    The DEFINE macro defines the per_cpu variable as well as the early
    map and pointer.  It also initializes the per_cpu variable and map
    elements to "_initvalue".  The early_* macros provide access to
    the initial map (usually setup during system init) and the early
    pointer.  This pointer is initialized to point to the early map
    but is then NULL'ed when the actual per_cpu areas are setup.  After
    that the per_cpu variable is the correct access to the variable.

    The early_per_cpu() macro is not very efficient but does show how to
    access the variable if you have a function that can be called both
    "early" and "late".  It tests the early ptr to be NULL, and if not
    then it's still valid.  Otherwise, the per_cpu variable is used
    instead:

	#define early_per_cpu(_name, _cpu) 			\
		(early_per_cpu_ptr(_name) ?			\
			early_per_cpu_ptr(_name)[_cpu] :	\
			per_cpu(_name, _cpu))

    A better method is to actually check the pointer manually.  In the
    case below, numa_set_node can be called both "early" and "late":

	void __cpuinit numa_set_node(int cpu, int node)
	{
	    int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);

	    if (cpu_to_node_map)
		    cpu_to_node_map[cpu] = node;
	    else
		    per_cpu(x86_cpu_to_node_map, cpu) = node;
	}

  * Add a flag "arch_provides_topology_pointers" that indicates pointers
    to topology cpumask_t maps are available.  Otherwise, use the function
    returning the cpumask_t value.  This is useful if cpumask_t set size
    is very large to avoid copying data on to/off of the stack.

  * The coverage of CONFIG_DEBUG_PER_CPU_MAPS has been increased while
    the non-debug case has been optimized a bit.

  * Remove an unreferenced compiler warning in drivers/base/topology.c

  * Clean up #ifdef in setup.c

For inclusion into sched-devel/latest tree.

Based on:
	git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
    +   sched-devel/latest  .../mingo/linux-2.6-sched-devel.git

Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-07-08 11:31:20 +02:00
..
power Clean up 'print_fn_descriptor_symbol()' types 2008-05-15 17:50:37 -07:00
attribute_container.c SCSI: convert struct class_device to struct device 2008-04-19 19:10:33 -07:00
base.h driver core: remove no longer used "struct class_device" 2008-04-30 16:52:49 -07:00
bus.c bus_remove_device: be more careful about incomplete initialization 2008-04-22 17:40:36 -07:00
class.c Driver core: struct class remove children list 2008-05-14 10:37:58 -07:00
core.c dev_set_name: fix missing kernel-doc 2008-06-11 16:50:40 -07:00
cpu.c cpu: change cpu_sys_devices from array to per_cpu variable 2008-05-01 08:04:02 -07:00
dd.c driver core: replace remaining __FUNCTION__ occurrences 2008-04-19 19:10:29 -07:00
devres.c Driver core: fix devres_release_all() return value 2007-07-11 16:09:02 -07:00
dma-mapping.c devres: device resource management 2007-02-09 17:39:36 -05:00
driver.c driver core: warn about duplicate driver names on the same bus 2008-04-30 16:52:47 -07:00
firmware_class.c firmware loader: printk when requesting firmware 2008-04-29 08:06:05 -07:00
firmware.c firmware: change firmware_kset to firmware_kobj 2008-01-24 20:40:23 -08:00
hypervisor.c kobject: convert /sys/hypervisor to use kobject_create 2008-01-24 20:40:15 -08:00
init.c Driver core: coding style fixes 2008-01-24 22:50:12 -08:00
isa.c [PATCH] Driver model: add ISA bus 2006-06-21 12:40:49 -07:00
Kconfig Driver core: add CONFIG_UEVENT_HELPER_PATH 2007-10-12 14:51:01 -07:00
Makefile Merge branch 'dmapool' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-05 19:05:48 -08:00
map.c [PATCH] kobj_map semaphore to mutex conversion 2006-03-20 13:42:58 -08:00
memory.c memory: Introduce exports for memory notifiers 2008-05-13 01:31:38 -04:00
module.c Driver core: move the static kobject out of struct driver 2008-01-24 20:40:35 -08:00
node.c mm: switch node meminfo Active & Inactive pages to Kbytes 2008-07-04 10:40:09 -07:00
platform.c drivers: fix dma_get_required_mask 2008-03-10 16:33:33 -07:00
sys.c Fix bogus warning in sysdev_driver_register() 2008-05-06 13:22:42 -07:00
topology.c x86: cleanup early per cpu variables/accesses v4 2008-07-08 11:31:20 +02:00
transport_class.c SCSI: convert struct class_device to struct device 2008-04-19 19:10:33 -07:00