debuggers.hg

view xen/include/asm-ia64/linux-xen/asm/percpu.h @ 19964:3952eaeb70b0

Introduce and use a per-CPU read-mostly sub-section

Since mixing data that only gets setup once and then (perhaps
frequently) gets read by remote CPUs with data that the local CPU may
modify (again, perhaps frequently) still causes undesirable cache
protocol related bus traffic, separate the former class of objects
from the latter.

These objects converted here are just picked based on their write-once
(or write-very-rarely) properties; perhaps some more adjustments may
be desirable subsequently. The primary users of the new sub-section
will result from the next patch.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jul 13 11:32:41 2009 +0100 (2009-07-13)
parents 7affdebb7a1e
children
line source
1 #ifndef _ASM_IA64_PERCPU_H
2 #define _ASM_IA64_PERCPU_H
4 /*
5 * Copyright (C) 2002-2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
9 #define PERCPU_ENOUGH_ROOM PERCPU_PAGE_SIZE
11 #ifdef __ASSEMBLY__
12 # define THIS_CPU(var) (per_cpu__##var) /* use this to mark accesses to per-CPU variables... */
13 #else /* !__ASSEMBLY__ */
15 #include <linux/config.h>
17 #include <linux/threads.h>
19 #ifdef HAVE_MODEL_SMALL_ATTRIBUTE
20 # define __SMALL_ADDR_AREA __attribute__((__model__ (__small__)))
21 #else
22 # define __SMALL_ADDR_AREA
23 #endif
25 #define DECLARE_PER_CPU(type, name) \
26 extern __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name
28 /* Separate out the type, so (int[3], foo) works. */
29 #define __DEFINE_PER_CPU(type, name, suffix) \
30 __attribute__((__section__(".data.percpu" #suffix))) \
31 __SMALL_ADDR_AREA __typeof__(type) per_cpu_##name
33 /*
34 * Pretty much a literal copy of asm-generic/percpu.h, except that percpu_modcopy() is an
35 * external routine, to avoid include-hell.
36 */
37 #ifdef CONFIG_SMP
39 extern unsigned long __per_cpu_offset[NR_CPUS];
41 /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
42 DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
44 #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
45 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __ia64_per_cpu_var(local_per_cpu_offset)))
46 #ifdef XEN
47 #define per_cpu_addr(var, cpu) (RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
48 #endif
50 extern void percpu_modcopy(void *pcpudst, const void *src, unsigned long size);
51 extern void setup_per_cpu_areas (void);
52 extern void *per_cpu_init(void);
53 #ifdef XEN
54 extern void *per_cpu_allocate(void *xen_heap_start, unsigned long end_in_pa);
55 #endif
57 #else /* ! SMP */
59 #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
60 #define __get_cpu_var(var) per_cpu__##var
61 #define per_cpu_init() (__phys_per_cpu_start)
62 #ifdef XEN
63 static inline void *per_cpu_allocate(void *xen_heap_start,
64 unsigned long end_in_pa)
65 {
66 return xen_heap_start;
67 }
68 #endif
70 #endif /* SMP */
72 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
73 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
75 /*
76 * Be extremely careful when taking the address of this variable! Due to virtual
77 * remapping, it is different from the canonical address returned by __get_cpu_var(var)!
78 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
79 * more efficient.
80 */
81 #define __ia64_per_cpu_var(var) (per_cpu__##var)
83 DECLARE_PER_CPU(struct vcpu *, fp_owner);
85 #endif /* !__ASSEMBLY__ */
87 #endif /* _ASM_IA64_PERCPU_H */