aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/mmu_context.h5
-rw-r--r--include/asm-alpha/topology.h4
-rw-r--r--include/asm-generic/bug.h4
-rw-r--r--include/asm-generic/percpu.h7
-rw-r--r--include/asm-i386/alternative.h129
-rw-r--r--include/asm-i386/arch_hooks.h3
-rw-r--r--include/asm-i386/atomic.h36
-rw-r--r--include/asm-i386/bitops.h7
-rw-r--r--include/asm-i386/cache.h2
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/mach-default/do_timer.h2
-rw-r--r--include/asm-i386/mach-es7000/mach_mpparse.h10
-rw-r--r--include/asm-i386/mach-visws/do_timer.h2
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h2
-rw-r--r--include/asm-i386/mpspec.h1
-rw-r--r--include/asm-i386/mtrr.h1
-rw-r--r--include/asm-i386/mutex.h6
-rw-r--r--include/asm-i386/pgtable-2level.h2
-rw-r--r--include/asm-i386/pgtable-3level.h2
-rw-r--r--include/asm-i386/rwlock.h56
-rw-r--r--include/asm-i386/semaphore.h8
-rw-r--r--include/asm-i386/spinlock.h34
-rw-r--r--include/asm-i386/system.h62
-rw-r--r--include/asm-i386/uaccess.h12
-rw-r--r--include/asm-i386/unistd.h36
-rw-r--r--include/asm-ia64/atomic.h8
-rw-r--r--include/asm-ia64/cache.h2
-rw-r--r--include/asm-m68k/atomic.h8
-rw-r--r--include/asm-parisc/cache.h2
-rw-r--r--include/asm-powerpc/percpu.h7
-rw-r--r--include/asm-s390/atomic.h18
-rw-r--r--include/asm-s390/percpu.h7
-rw-r--r--include/asm-sparc64/atomic.h10
-rw-r--r--include/asm-sparc64/cache.h2
-rw-r--r--include/asm-sparc64/percpu.h7
-rw-r--r--include/asm-um/alternative.h6
-rw-r--r--include/asm-x86_64/atomic.h8
-rw-r--r--include/asm-x86_64/cache.h2
-rw-r--r--include/asm-x86_64/percpu.h7
-rw-r--r--include/linux/cache.h4
-rw-r--r--include/linux/cdrom.h5
-rw-r--r--include/linux/eventpoll.h8
-rw-r--r--include/linux/ext3_fs.h9
-rw-r--r--include/linux/ext3_fs_i.h7
-rw-r--r--include/linux/file.h28
-rw-r--r--include/linux/fs.h22
-rw-r--r--include/linux/generic_serial.h4
-rw-r--r--include/linux/genhd.h14
-rw-r--r--include/linux/init_task.h10
-rw-r--r--include/linux/jbd.h7
-rw-r--r--include/linux/kernel.h3
-rw-r--r--include/linux/kprobes.h3
-rw-r--r--include/linux/loop.h3
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/nbd.h3
-rw-r--r--include/linux/ncp_fs_i.h2
-rw-r--r--include/linux/ncp_fs_sb.h5
-rw-r--r--include/linux/pm.h3
-rw-r--r--include/linux/profile.h2
-rw-r--r--include/linux/quota.h7
-rw-r--r--include/linux/raid/raid1.h2
-rw-r--r--include/linux/rcupdate.h2
-rw-r--r--include/linux/seq_file.h4
-rw-r--r--include/linux/swap.h5
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/tty_flip.h12
-rw-r--r--include/linux/udf_fs_sb.h4
-rw-r--r--include/linux/vt_kern.h5
68 files changed, 454 insertions, 268 deletions
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index 6f92482cc96c..0c017fc181c1 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -231,9 +231,8 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
231{ 231{
232 int i; 232 int i;
233 233
234 for (i = 0; i < NR_CPUS; i++) 234 for_each_online_cpu(i)
235 if (cpu_online(i)) 235 mm->context[i] = 0;
236 mm->context[i] = 0;
237 if (tsk != current) 236 if (tsk != current)
238 task_thread_info(tsk)->pcb.ptbr 237 task_thread_info(tsk)->pcb.ptbr
239 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; 238 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
diff --git a/include/asm-alpha/topology.h b/include/asm-alpha/topology.h
index eb740e280d9c..420ccde6b916 100644
--- a/include/asm-alpha/topology.h
+++ b/include/asm-alpha/topology.h
@@ -27,8 +27,8 @@ static inline cpumask_t node_to_cpumask(int node)
27 cpumask_t node_cpu_mask = CPU_MASK_NONE; 27 cpumask_t node_cpu_mask = CPU_MASK_NONE;
28 int cpu; 28 int cpu;
29 29
30 for(cpu = 0; cpu < NR_CPUS; cpu++) { 30 for_each_online_cpu(cpu) {
31 if (cpu_online(cpu) && (cpu_to_node(cpu) == node)) 31 if (cpu_to_node(cpu) == node)
32 cpu_set(cpu, node_cpu_mask); 32 cpu_set(cpu, node_cpu_mask);
33 } 33 }
34 34
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 400c2b41896e..1a565a9d2fa7 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -7,7 +7,7 @@
7#ifdef CONFIG_BUG 7#ifdef CONFIG_BUG
8#ifndef HAVE_ARCH_BUG 8#ifndef HAVE_ARCH_BUG
9#define BUG() do { \ 9#define BUG() do { \
10 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 10 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
11 panic("BUG!"); \ 11 panic("BUG!"); \
12} while (0) 12} while (0)
13#endif 13#endif
@@ -19,7 +19,7 @@
19#ifndef HAVE_ARCH_WARN_ON 19#ifndef HAVE_ARCH_WARN_ON
20#define WARN_ON(condition) do { \ 20#define WARN_ON(condition) do { \
21 if (unlikely((condition)!=0)) { \ 21 if (unlikely((condition)!=0)) { \
22 printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ 22 printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
23 dump_stack(); \ 23 dump_stack(); \
24 } \ 24 } \
25} while (0) 25} while (0)
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 9044aeb37828..78cf45547e31 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -19,10 +19,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
19#define percpu_modcopy(pcpudst, src, size) \ 19#define percpu_modcopy(pcpudst, src, size) \
20do { \ 20do { \
21 unsigned int __i; \ 21 unsigned int __i; \
22 for (__i = 0; __i < NR_CPUS; __i++) \ 22 for_each_cpu(__i) \
23 if (cpu_possible(__i)) \ 23 memcpy((pcpudst)+__per_cpu_offset[__i], \
24 memcpy((pcpudst)+__per_cpu_offset[__i], \ 24 (src), (size)); \
25 (src), (size)); \
26} while (0) 25} while (0)
27#else /* ! SMP */ 26#else /* ! SMP */
28 27
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
new file mode 100644
index 000000000000..e201decea0c9
--- /dev/null
+++ b/include/asm-i386/alternative.h
@@ -0,0 +1,129 @@
1#ifndef _I386_ALTERNATIVE_H
2#define _I386_ALTERNATIVE_H
3
4#ifdef __KERNEL__
5
6struct alt_instr {
7 u8 *instr; /* original instruction */
8 u8 *replacement;
9 u8 cpuid; /* cpuid bit set for replacement */
10 u8 instrlen; /* length of original instruction */
11 u8 replacementlen; /* length of new instruction, <= instrlen */
12 u8 pad;
13};
14
15extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
16
17struct module;
18extern void alternatives_smp_module_add(struct module *mod, char *name,
19 void *locks, void *locks_end,
20 void *text, void *text_end);
21extern void alternatives_smp_module_del(struct module *mod);
22extern void alternatives_smp_switch(int smp);
23
24#endif
25
26/*
27 * Alternative instructions for different CPU types or capabilities.
28 *
29 * This allows to use optimized instructions even on generic binary
30 * kernels.
31 *
32 * length of oldinstr must be longer or equal the length of newinstr
33 * It can be padded with nops as needed.
34 *
35 * For non barrier like inlines please define new variants
36 * without volatile and memory clobber.
37 */
38#define alternative(oldinstr, newinstr, feature) \
39 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
40 ".section .altinstructions,\"a\"\n" \
41 " .align 4\n" \
42 " .long 661b\n" /* label */ \
43 " .long 663f\n" /* new instruction */ \
44 " .byte %c0\n" /* feature bit */ \
45 " .byte 662b-661b\n" /* sourcelen */ \
46 " .byte 664f-663f\n" /* replacementlen */ \
47 ".previous\n" \
48 ".section .altinstr_replacement,\"ax\"\n" \
49 "663:\n\t" newinstr "\n664:\n" /* replacement */\
50 ".previous" :: "i" (feature) : "memory")
51
52/*
53 * Alternative inline assembly with input.
54 *
55 * Pecularities:
56 * No memory clobber here.
57 * Argument numbers start with 1.
58 * Best is to use constraints that are fixed size (like (%1) ... "r")
59 * If you use variable sized constraints like "m" or "g" in the
60 * replacement maake sure to pad to the worst case length.
61 */
62#define alternative_input(oldinstr, newinstr, feature, input...) \
63 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
64 ".section .altinstructions,\"a\"\n" \
65 " .align 4\n" \
66 " .long 661b\n" /* label */ \
67 " .long 663f\n" /* new instruction */ \
68 " .byte %c0\n" /* feature bit */ \
69 " .byte 662b-661b\n" /* sourcelen */ \
70 " .byte 664f-663f\n" /* replacementlen */ \
71 ".previous\n" \
72 ".section .altinstr_replacement,\"ax\"\n" \
73 "663:\n\t" newinstr "\n664:\n" /* replacement */\
74 ".previous" :: "i" (feature), ##input)
75
76/*
77 * Alternative inline assembly for SMP.
78 *
79 * alternative_smp() takes two versions (SMP first, UP second) and is
80 * for more complex stuff such as spinlocks.
81 *
82 * The LOCK_PREFIX macro defined here replaces the LOCK and
83 * LOCK_PREFIX macros used everywhere in the source tree.
84 *
85 * SMP alternatives use the same data structures as the other
86 * alternatives and the X86_FEATURE_UP flag to indicate the case of a
87 * UP system running a SMP kernel. The existing apply_alternatives()
88 * works fine for patching a SMP kernel for UP.
89 *
90 * The SMP alternative tables can be kept after boot and contain both
91 * UP and SMP versions of the instructions to allow switching back to
92 * SMP at runtime, when hotplugging in a new CPU, which is especially
93 * useful in virtualized environments.
94 *
95 * The very common lock prefix is handled as special case in a
96 * separate table which is a pure address list without replacement ptr
97 * and size information. That keeps the table sizes small.
98 */
99
100#ifdef CONFIG_SMP
101#define alternative_smp(smpinstr, upinstr, args...) \
102 asm volatile ("661:\n\t" smpinstr "\n662:\n" \
103 ".section .smp_altinstructions,\"a\"\n" \
104 " .align 4\n" \
105 " .long 661b\n" /* label */ \
106 " .long 663f\n" /* new instruction */ \
107 " .byte 0x68\n" /* X86_FEATURE_UP */ \
108 " .byte 662b-661b\n" /* sourcelen */ \
109 " .byte 664f-663f\n" /* replacementlen */ \
110 ".previous\n" \
111 ".section .smp_altinstr_replacement,\"awx\"\n" \
112 "663:\n\t" upinstr "\n" /* replacement */ \
113 "664:\n\t.fill 662b-661b,1,0x42\n" /* space for original */ \
114 ".previous" : args)
115
116#define LOCK_PREFIX \
117 ".section .smp_locks,\"a\"\n" \
118 " .align 4\n" \
119 " .long 661f\n" /* address */ \
120 ".previous\n" \
121 "661:\n\tlock; "
122
123#else /* ! CONFIG_SMP */
124#define alternative_smp(smpinstr, upinstr, args...) \
125 asm volatile (upinstr : args)
126#define LOCK_PREFIX ""
127#endif
128
129#endif /* _I386_ALTERNATIVE_H */
diff --git a/include/asm-i386/arch_hooks.h b/include/asm-i386/arch_hooks.h
index 28b96a6fb9fa..238cf4275b96 100644
--- a/include/asm-i386/arch_hooks.h
+++ b/include/asm-i386/arch_hooks.h
@@ -24,4 +24,7 @@ extern void trap_init_hook(void);
24extern void time_init_hook(void); 24extern void time_init_hook(void);
25extern void mca_nmi_hook(void); 25extern void mca_nmi_hook(void);
26 26
27extern int setup_early_printk(char *);
28extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
29
27#endif 30#endif
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index de649d3aa2d4..22d80ece95cb 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -10,12 +10,6 @@
10 * resource counting etc.. 10 * resource counting etc..
11 */ 11 */
12 12
13#ifdef CONFIG_SMP
14#define LOCK "lock ; "
15#else
16#define LOCK ""
17#endif
18
19/* 13/*
20 * Make sure gcc doesn't try to be clever and move things around 14 * Make sure gcc doesn't try to be clever and move things around
21 * on us. We need to use _exactly_ the address the user gave us, 15 * on us. We need to use _exactly_ the address the user gave us,
@@ -52,7 +46,7 @@ typedef struct { volatile int counter; } atomic_t;
52static __inline__ void atomic_add(int i, atomic_t *v) 46static __inline__ void atomic_add(int i, atomic_t *v)
53{ 47{
54 __asm__ __volatile__( 48 __asm__ __volatile__(
55 LOCK "addl %1,%0" 49 LOCK_PREFIX "addl %1,%0"
56 :"=m" (v->counter) 50 :"=m" (v->counter)
57 :"ir" (i), "m" (v->counter)); 51 :"ir" (i), "m" (v->counter));
58} 52}
@@ -67,7 +61,7 @@ static __inline__ void atomic_add(int i, atomic_t *v)
67static __inline__ void atomic_sub(int i, atomic_t *v) 61static __inline__ void atomic_sub(int i, atomic_t *v)
68{ 62{
69 __asm__ __volatile__( 63 __asm__ __volatile__(
70 LOCK "subl %1,%0" 64 LOCK_PREFIX "subl %1,%0"
71 :"=m" (v->counter) 65 :"=m" (v->counter)
72 :"ir" (i), "m" (v->counter)); 66 :"ir" (i), "m" (v->counter));
73} 67}
@@ -86,7 +80,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
86 unsigned char c; 80 unsigned char c;
87 81
88 __asm__ __volatile__( 82 __asm__ __volatile__(
89 LOCK "subl %2,%0; sete %1" 83 LOCK_PREFIX "subl %2,%0; sete %1"
90 :"=m" (v->counter), "=qm" (c) 84 :"=m" (v->counter), "=qm" (c)
91 :"ir" (i), "m" (v->counter) : "memory"); 85 :"ir" (i), "m" (v->counter) : "memory");
92 return c; 86 return c;
@@ -101,7 +95,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
101static __inline__ void atomic_inc(atomic_t *v) 95static __inline__ void atomic_inc(atomic_t *v)
102{ 96{
103 __asm__ __volatile__( 97 __asm__ __volatile__(
104 LOCK "incl %0" 98 LOCK_PREFIX "incl %0"
105 :"=m" (v->counter) 99 :"=m" (v->counter)
106 :"m" (v->counter)); 100 :"m" (v->counter));
107} 101}
@@ -115,7 +109,7 @@ static __inline__ void atomic_inc(atomic_t *v)
115static __inline__ void atomic_dec(atomic_t *v) 109static __inline__ void atomic_dec(atomic_t *v)
116{ 110{
117 __asm__ __volatile__( 111 __asm__ __volatile__(
118 LOCK "decl %0" 112 LOCK_PREFIX "decl %0"
119 :"=m" (v->counter) 113 :"=m" (v->counter)
120 :"m" (v->counter)); 114 :"m" (v->counter));
121} 115}
@@ -133,7 +127,7 @@ static __inline__ int atomic_dec_and_test(atomic_t *v)
133 unsigned char c; 127 unsigned char c;
134 128
135 __asm__ __volatile__( 129 __asm__ __volatile__(
136 LOCK "decl %0; sete %1" 130 LOCK_PREFIX "decl %0; sete %1"
137 :"=m" (v->counter), "=qm" (c) 131 :"=m" (v->counter), "=qm" (c)
138 :"m" (v->counter) : "memory"); 132 :"m" (v->counter) : "memory");
139 return c != 0; 133 return c != 0;
@@ -152,7 +146,7 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)
152 unsigned char c; 146 unsigned char c;
153 147
154 __asm__ __volatile__( 148 __asm__ __volatile__(
155 LOCK "incl %0; sete %1" 149 LOCK_PREFIX "incl %0; sete %1"
156 :"=m" (v->counter), "=qm" (c) 150 :"=m" (v->counter), "=qm" (c)
157 :"m" (v->counter) : "memory"); 151 :"m" (v->counter) : "memory");
158 return c != 0; 152 return c != 0;
@@ -172,7 +166,7 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)
172 unsigned char c; 166 unsigned char c;
173 167
174 __asm__ __volatile__( 168 __asm__ __volatile__(
175 LOCK "addl %2,%0; sets %1" 169 LOCK_PREFIX "addl %2,%0; sets %1"
176 :"=m" (v->counter), "=qm" (c) 170 :"=m" (v->counter), "=qm" (c)
177 :"ir" (i), "m" (v->counter) : "memory"); 171 :"ir" (i), "m" (v->counter) : "memory");
178 return c; 172 return c;
@@ -195,7 +189,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
195 /* Modern 486+ processor */ 189 /* Modern 486+ processor */
196 __i = i; 190 __i = i;
197 __asm__ __volatile__( 191 __asm__ __volatile__(
198 LOCK "xaddl %0, %1;" 192 LOCK_PREFIX "xaddl %0, %1;"
199 :"=r"(i) 193 :"=r"(i)
200 :"m"(v->counter), "0"(i)); 194 :"m"(v->counter), "0"(i));
201 return i + __i; 195 return i + __i;
@@ -231,8 +225,14 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
231({ \ 225({ \
232 int c, old; \ 226 int c, old; \
233 c = atomic_read(v); \ 227 c = atomic_read(v); \
234 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 228 for (;;) { \
229 if (unlikely(c == (u))) \
230 break; \
231 old = atomic_cmpxchg((v), c, c + (a)); \
232 if (likely(old == c)) \
233 break; \
235 c = old; \ 234 c = old; \
235 } \
236 c != (u); \ 236 c != (u); \
237}) 237})
238#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 238#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
@@ -242,11 +242,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
242 242
243/* These are x86-specific, used by some header files */ 243/* These are x86-specific, used by some header files */
244#define atomic_clear_mask(mask, addr) \ 244#define atomic_clear_mask(mask, addr) \
245__asm__ __volatile__(LOCK "andl %0,%1" \ 245__asm__ __volatile__(LOCK_PREFIX "andl %0,%1" \
246: : "r" (~(mask)),"m" (*addr) : "memory") 246: : "r" (~(mask)),"m" (*addr) : "memory")
247 247
248#define atomic_set_mask(mask, addr) \ 248#define atomic_set_mask(mask, addr) \
249__asm__ __volatile__(LOCK "orl %0,%1" \ 249__asm__ __volatile__(LOCK_PREFIX "orl %0,%1" \
250: : "r" (mask),"m" (*(addr)) : "memory") 250: : "r" (mask),"m" (*(addr)) : "memory")
251 251
252/* Atomic operations are already serializing on x86 */ 252/* Atomic operations are already serializing on x86 */
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 88e6ca248cd7..7d20b95edb3b 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/config.h> 8#include <linux/config.h>
9#include <linux/compiler.h> 9#include <linux/compiler.h>
10#include <asm/alternative.h>
10 11
11/* 12/*
12 * These have to be done with inline assembly: that way the bit-setting 13 * These have to be done with inline assembly: that way the bit-setting
@@ -16,12 +17,6 @@
16 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). 17 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
17 */ 18 */
18 19
19#ifdef CONFIG_SMP
20#define LOCK_PREFIX "lock ; "
21#else
22#define LOCK_PREFIX ""
23#endif
24
25#define ADDR (*(volatile long *) addr) 20#define ADDR (*(volatile long *) addr)
26 21
27/** 22/**
diff --git a/include/asm-i386/cache.h b/include/asm-i386/cache.h
index 615911e5bd24..ca15c9c665cf 100644
--- a/include/asm-i386/cache.h
+++ b/include/asm-i386/cache.h
@@ -10,4 +10,6 @@
10#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) 10#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
11#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 11#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
12 12
13#define __read_mostly __attribute__((__section__(".data.read_mostly")))
14
13#endif 15#endif
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index c4ec2a4d8fdf..5c0b5876b931 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -70,6 +70,7 @@
70#define X86_FEATURE_P3 (3*32+ 6) /* P3 */ 70#define X86_FEATURE_P3 (3*32+ 6) /* P3 */
71#define X86_FEATURE_P4 (3*32+ 7) /* P4 */ 71#define X86_FEATURE_P4 (3*32+ 7) /* P4 */
72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ 72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
73 74
74/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 75/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
75#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 76#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 56211414fc95..6312c3e79814 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -18,7 +18,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
18{ 18{
19 do_timer(regs); 19 do_timer(regs);
20#ifndef CONFIG_SMP 20#ifndef CONFIG_SMP
21 update_process_times(user_mode(regs)); 21 update_process_times(user_mode_vm(regs));
22#endif 22#endif
23/* 23/*
24 * In the SMP case we use the local APIC timer interrupt to do the 24 * In the SMP case we use the local APIC timer interrupt to do the
diff --git a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
index 4a0637a3e208..99f66be240be 100644
--- a/include/asm-i386/mach-es7000/mach_mpparse.h
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h
@@ -30,7 +30,8 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
30 return 0; 30 return 0;
31} 31}
32 32
33static inline int es7000_check_dsdt() 33#ifdef CONFIG_ACPI
34static inline int es7000_check_dsdt(void)
34{ 35{
35 struct acpi_table_header *header = NULL; 36 struct acpi_table_header *header = NULL;
36 if(!acpi_get_table_header_early(ACPI_DSDT, &header)) 37 if(!acpi_get_table_header_early(ACPI_DSDT, &header))
@@ -54,6 +55,11 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
54 } 55 }
55 return 0; 56 return 0;
56} 57}
57 58#else
59static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
60{
61 return 0;
62}
63#endif
58 64
59#endif /* __ASM_MACH_MPPARSE_H */ 65#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 92d638fc8b11..95568e6ca91c 100644
--- a/include/asm-i386/mach-visws/do_timer.h
+++ b/include/asm-i386/mach-visws/do_timer.h
@@ -11,7 +11,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
11 11
12 do_timer(regs); 12 do_timer(regs);
13#ifndef CONFIG_SMP 13#ifndef CONFIG_SMP
14 update_process_times(user_mode(regs)); 14 update_process_times(user_mode_vm(regs));
15#endif 15#endif
16/* 16/*
17 * In the SMP case we use the local APIC timer interrupt to do the 17 * In the SMP case we use the local APIC timer interrupt to do the
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index ae510e5d0d78..eaf518098981 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -5,7 +5,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
5{ 5{
6 do_timer(regs); 6 do_timer(regs);
7#ifndef CONFIG_SMP 7#ifndef CONFIG_SMP
8 update_process_times(user_mode(regs)); 8 update_process_times(user_mode_vm(regs));
9#endif 9#endif
10 10
11 voyager_timer_interrupt(regs); 11 voyager_timer_interrupt(regs);
diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
index 64a0b8e6afeb..62113d3bfdc2 100644
--- a/include/asm-i386/mpspec.h
+++ b/include/asm-i386/mpspec.h
@@ -22,7 +22,6 @@ extern int mp_bus_id_to_type [MAX_MP_BUSSES];
22extern int mp_irq_entries; 22extern int mp_irq_entries;
23extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; 23extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
24extern int mpc_default_type; 24extern int mpc_default_type;
25extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
26extern unsigned long mp_lapic_addr; 25extern unsigned long mp_lapic_addr;
27extern int pic_mode; 26extern int pic_mode;
28extern int using_apic_timer; 27extern int using_apic_timer;
diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h
index 5b6ceda68c5f..64cf937c7e33 100644
--- a/include/asm-i386/mtrr.h
+++ b/include/asm-i386/mtrr.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/config.h> 26#include <linux/config.h>
27#include <linux/ioctl.h> 27#include <linux/ioctl.h>
28#include <linux/errno.h>
28 29
29#define MTRR_IOCTL_BASE 'M' 30#define MTRR_IOCTL_BASE 'M'
30 31
diff --git a/include/asm-i386/mutex.h b/include/asm-i386/mutex.h
index 9b2199e829f3..05a538531229 100644
--- a/include/asm-i386/mutex.h
+++ b/include/asm-i386/mutex.h
@@ -9,6 +9,8 @@
9#ifndef _ASM_MUTEX_H 9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H 10#define _ASM_MUTEX_H
11 11
12#include "asm/alternative.h"
13
12/** 14/**
13 * __mutex_fastpath_lock - try to take the lock by moving the count 15 * __mutex_fastpath_lock - try to take the lock by moving the count
14 * from 1 to a 0 value 16 * from 1 to a 0 value
@@ -27,7 +29,7 @@ do { \
27 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 29 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
28 \ 30 \
29 __asm__ __volatile__( \ 31 __asm__ __volatile__( \
30 LOCK " decl (%%eax) \n" \ 32 LOCK_PREFIX " decl (%%eax) \n" \
31 " js 2f \n" \ 33 " js 2f \n" \
32 "1: \n" \ 34 "1: \n" \
33 \ 35 \
@@ -83,7 +85,7 @@ do { \
83 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 85 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
84 \ 86 \
85 __asm__ __volatile__( \ 87 __asm__ __volatile__( \
86 LOCK " incl (%%eax) \n" \ 88 LOCK_PREFIX " incl (%%eax) \n" \
87 " jle 2f \n" \ 89 " jle 2f \n" \
88 "1: \n" \ 90 "1: \n" \
89 \ 91 \
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index 74ef721b534d..27bde973abc7 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -61,4 +61,6 @@ static inline int pte_exec_kernel(pte_t pte)
61#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low }) 61#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
62#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 62#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
63 63
64void vmalloc_sync_all(void);
65
64#endif /* _I386_PGTABLE_2LEVEL_H */ 66#endif /* _I386_PGTABLE_2LEVEL_H */
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index f1a8b454920a..36a5aa63cbbf 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -152,4 +152,6 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
152 152
153#define __pmd_free_tlb(tlb, x) do { } while (0) 153#define __pmd_free_tlb(tlb, x) do { } while (0)
154 154
155#define vmalloc_sync_all() ((void)0)
156
155#endif /* _I386_PGTABLE_3LEVEL_H */ 157#endif /* _I386_PGTABLE_3LEVEL_H */
diff --git a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h
index b57cc7afdf7e..94f00195d543 100644
--- a/include/asm-i386/rwlock.h
+++ b/include/asm-i386/rwlock.h
@@ -21,21 +21,23 @@
21#define RW_LOCK_BIAS_STR "0x01000000" 21#define RW_LOCK_BIAS_STR "0x01000000"
22 22
23#define __build_read_lock_ptr(rw, helper) \ 23#define __build_read_lock_ptr(rw, helper) \
24 asm volatile(LOCK "subl $1,(%0)\n\t" \ 24 alternative_smp("lock; subl $1,(%0)\n\t" \
25 "jns 1f\n" \ 25 "jns 1f\n" \
26 "call " helper "\n\t" \ 26 "call " helper "\n\t" \
27 "1:\n" \ 27 "1:\n", \
28 ::"a" (rw) : "memory") 28 "subl $1,(%0)\n\t", \
29 :"a" (rw) : "memory")
29 30
30#define __build_read_lock_const(rw, helper) \ 31#define __build_read_lock_const(rw, helper) \
31 asm volatile(LOCK "subl $1,%0\n\t" \ 32 alternative_smp("lock; subl $1,%0\n\t" \
32 "jns 1f\n" \ 33 "jns 1f\n" \
33 "pushl %%eax\n\t" \ 34 "pushl %%eax\n\t" \
34 "leal %0,%%eax\n\t" \ 35 "leal %0,%%eax\n\t" \
35 "call " helper "\n\t" \ 36 "call " helper "\n\t" \
36 "popl %%eax\n\t" \ 37 "popl %%eax\n\t" \
37 "1:\n" \ 38 "1:\n", \
38 :"=m" (*(volatile int *)rw) : : "memory") 39 "subl $1,%0\n\t", \
40 "=m" (*(volatile int *)rw) : : "memory")
39 41
40#define __build_read_lock(rw, helper) do { \ 42#define __build_read_lock(rw, helper) do { \
41 if (__builtin_constant_p(rw)) \ 43 if (__builtin_constant_p(rw)) \
@@ -45,21 +47,23 @@
45 } while (0) 47 } while (0)
46 48
47#define __build_write_lock_ptr(rw, helper) \ 49#define __build_write_lock_ptr(rw, helper) \
48 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ 50 alternative_smp("lock; subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
49 "jz 1f\n" \ 51 "jz 1f\n" \
50 "call " helper "\n\t" \ 52 "call " helper "\n\t" \
51 "1:\n" \ 53 "1:\n", \
52 ::"a" (rw) : "memory") 54 "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t", \
55 :"a" (rw) : "memory")
53 56
54#define __build_write_lock_const(rw, helper) \ 57#define __build_write_lock_const(rw, helper) \
55 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ 58 alternative_smp("lock; subl $" RW_LOCK_BIAS_STR ",%0\n\t" \
56 "jz 1f\n" \ 59 "jz 1f\n" \
57 "pushl %%eax\n\t" \ 60 "pushl %%eax\n\t" \
58 "leal %0,%%eax\n\t" \ 61 "leal %0,%%eax\n\t" \
59 "call " helper "\n\t" \ 62 "call " helper "\n\t" \
60 "popl %%eax\n\t" \ 63 "popl %%eax\n\t" \
61 "1:\n" \ 64 "1:\n", \
62 :"=m" (*(volatile int *)rw) : : "memory") 65 "subl $" RW_LOCK_BIAS_STR ",%0\n\t", \
66 "=m" (*(volatile int *)rw) : : "memory")
63 67
64#define __build_write_lock(rw, helper) do { \ 68#define __build_write_lock(rw, helper) do { \
65 if (__builtin_constant_p(rw)) \ 69 if (__builtin_constant_p(rw)) \
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h
index 6a42b2142fd6..f7a0f310c524 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -99,7 +99,7 @@ static inline void down(struct semaphore * sem)
99 might_sleep(); 99 might_sleep();
100 __asm__ __volatile__( 100 __asm__ __volatile__(
101 "# atomic down operation\n\t" 101 "# atomic down operation\n\t"
102 LOCK "decl %0\n\t" /* --sem->count */ 102 LOCK_PREFIX "decl %0\n\t" /* --sem->count */
103 "js 2f\n" 103 "js 2f\n"
104 "1:\n" 104 "1:\n"
105 LOCK_SECTION_START("") 105 LOCK_SECTION_START("")
@@ -123,7 +123,7 @@ static inline int down_interruptible(struct semaphore * sem)
123 might_sleep(); 123 might_sleep();
124 __asm__ __volatile__( 124 __asm__ __volatile__(
125 "# atomic interruptible down operation\n\t" 125 "# atomic interruptible down operation\n\t"
126 LOCK "decl %1\n\t" /* --sem->count */ 126 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
127 "js 2f\n\t" 127 "js 2f\n\t"
128 "xorl %0,%0\n" 128 "xorl %0,%0\n"
129 "1:\n" 129 "1:\n"
@@ -148,7 +148,7 @@ static inline int down_trylock(struct semaphore * sem)
148 148
149 __asm__ __volatile__( 149 __asm__ __volatile__(
150 "# atomic interruptible down operation\n\t" 150 "# atomic interruptible down operation\n\t"
151 LOCK "decl %1\n\t" /* --sem->count */ 151 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
152 "js 2f\n\t" 152 "js 2f\n\t"
153 "xorl %0,%0\n" 153 "xorl %0,%0\n"
154 "1:\n" 154 "1:\n"
@@ -173,7 +173,7 @@ static inline void up(struct semaphore * sem)
173{ 173{
174 __asm__ __volatile__( 174 __asm__ __volatile__(
175 "# atomic up operation\n\t" 175 "# atomic up operation\n\t"
176 LOCK "incl %0\n\t" /* ++sem->count */ 176 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
177 "jle 2f\n" 177 "jle 2f\n"
178 "1:\n" 178 "1:\n"
179 LOCK_SECTION_START("") 179 LOCK_SECTION_START("")
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index 23604350cdf4..d76b7693cf1d 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -35,31 +35,41 @@
35#define __raw_spin_lock_string_flags \ 35#define __raw_spin_lock_string_flags \
36 "\n1:\t" \ 36 "\n1:\t" \
37 "lock ; decb %0\n\t" \ 37 "lock ; decb %0\n\t" \
38 "jns 4f\n\t" \ 38 "jns 5f\n" \
39 "2:\t" \ 39 "2:\t" \
40 "testl $0x200, %1\n\t" \ 40 "testl $0x200, %1\n\t" \
41 "jz 3f\n\t" \ 41 "jz 4f\n\t" \
42 "sti\n\t" \ 42 "sti\n" \
43 "3:\t" \ 43 "3:\t" \
44 "rep;nop\n\t" \ 44 "rep;nop\n\t" \
45 "cmpb $0, %0\n\t" \ 45 "cmpb $0, %0\n\t" \
46 "jle 3b\n\t" \ 46 "jle 3b\n\t" \
47 "cli\n\t" \ 47 "cli\n\t" \
48 "jmp 1b\n" \ 48 "jmp 1b\n" \
49 "4:\n\t" 49 "4:\t" \
50 "rep;nop\n\t" \
51 "cmpb $0, %0\n\t" \
52 "jg 1b\n\t" \
53 "jmp 4b\n" \
54 "5:\n\t"
55
56#define __raw_spin_lock_string_up \
57 "\n\tdecb %0"
50 58
51static inline void __raw_spin_lock(raw_spinlock_t *lock) 59static inline void __raw_spin_lock(raw_spinlock_t *lock)
52{ 60{
53 __asm__ __volatile__( 61 alternative_smp(
54 __raw_spin_lock_string 62 __raw_spin_lock_string,
55 :"=m" (lock->slock) : : "memory"); 63 __raw_spin_lock_string_up,
64 "=m" (lock->slock) : : "memory");
56} 65}
57 66
58static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) 67static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
59{ 68{
60 __asm__ __volatile__( 69 alternative_smp(
61 __raw_spin_lock_string_flags 70 __raw_spin_lock_string_flags,
62 :"=m" (lock->slock) : "r" (flags) : "memory"); 71 __raw_spin_lock_string_up,
72 "=m" (lock->slock) : "r" (flags) : "memory");
63} 73}
64 74
65static inline int __raw_spin_trylock(raw_spinlock_t *lock) 75static inline int __raw_spin_trylock(raw_spinlock_t *lock)
@@ -178,12 +188,12 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
178 188
179static inline void __raw_read_unlock(raw_rwlock_t *rw) 189static inline void __raw_read_unlock(raw_rwlock_t *rw)
180{ 190{
181 asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); 191 asm volatile(LOCK_PREFIX "incl %0" :"=m" (rw->lock) : : "memory");
182} 192}
183 193
184static inline void __raw_write_unlock(raw_rwlock_t *rw) 194static inline void __raw_write_unlock(raw_rwlock_t *rw)
185{ 195{
186 asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0" 196 asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0"
187 : "=m" (rw->lock) : : "memory"); 197 : "=m" (rw->lock) : : "memory");
188} 198}
189 199
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 399145a247f2..d0d8d7448d88 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -352,67 +352,6 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long l
352 352
353#endif 353#endif
354 354
355#ifdef __KERNEL__
356struct alt_instr {
357 __u8 *instr; /* original instruction */
358 __u8 *replacement;
359 __u8 cpuid; /* cpuid bit set for replacement */
360 __u8 instrlen; /* length of original instruction */
361 __u8 replacementlen; /* length of new instruction, <= instrlen */
362 __u8 pad;
363};
364#endif
365
366/*
367 * Alternative instructions for different CPU types or capabilities.
368 *
369 * This allows to use optimized instructions even on generic binary
370 * kernels.
371 *
372 * length of oldinstr must be longer or equal the length of newinstr
373 * It can be padded with nops as needed.
374 *
375 * For non barrier like inlines please define new variants
376 * without volatile and memory clobber.
377 */
378#define alternative(oldinstr, newinstr, feature) \
379 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
380 ".section .altinstructions,\"a\"\n" \
381 " .align 4\n" \
382 " .long 661b\n" /* label */ \
383 " .long 663f\n" /* new instruction */ \
384 " .byte %c0\n" /* feature bit */ \
385 " .byte 662b-661b\n" /* sourcelen */ \
386 " .byte 664f-663f\n" /* replacementlen */ \
387 ".previous\n" \
388 ".section .altinstr_replacement,\"ax\"\n" \
389 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
390 ".previous" :: "i" (feature) : "memory")
391
392/*
393 * Alternative inline assembly with input.
394 *
395 * Pecularities:
396 * No memory clobber here.
397 * Argument numbers start with 1.
398 * Best is to use constraints that are fixed size (like (%1) ... "r")
399 * If you use variable sized constraints like "m" or "g" in the
400 * replacement maake sure to pad to the worst case length.
401 */
402#define alternative_input(oldinstr, newinstr, feature, input...) \
403 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
404 ".section .altinstructions,\"a\"\n" \
405 " .align 4\n" \
406 " .long 661b\n" /* label */ \
407 " .long 663f\n" /* new instruction */ \
408 " .byte %c0\n" /* feature bit */ \
409 " .byte 662b-661b\n" /* sourcelen */ \
410 " .byte 664f-663f\n" /* replacementlen */ \
411 ".previous\n" \
412 ".section .altinstr_replacement,\"ax\"\n" \
413 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
414 ".previous" :: "i" (feature), ##input)
415
416/* 355/*
417 * Force strict CPU ordering. 356 * Force strict CPU ordering.
418 * And yes, this is required on UP too when we're talking 357 * And yes, this is required on UP too when we're talking
@@ -558,5 +497,6 @@ static inline void sched_cacheflush(void)
558} 497}
559 498
560extern unsigned long arch_align_stack(unsigned long sp); 499extern unsigned long arch_align_stack(unsigned long sp);
500extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
561 501
562#endif 502#endif
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 3f1337c34208..371457b1ceb6 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -197,13 +197,15 @@ extern void __put_user_8(void);
197 197
198#define put_user(x,ptr) \ 198#define put_user(x,ptr) \
199({ int __ret_pu; \ 199({ int __ret_pu; \
200 __typeof__(*(ptr)) __pu_val; \
200 __chk_user_ptr(ptr); \ 201 __chk_user_ptr(ptr); \
202 __pu_val = x; \
201 switch(sizeof(*(ptr))) { \ 203 switch(sizeof(*(ptr))) { \
202 case 1: __put_user_1(x, ptr); break; \ 204 case 1: __put_user_1(__pu_val, ptr); break; \
203 case 2: __put_user_2(x, ptr); break; \ 205 case 2: __put_user_2(__pu_val, ptr); break; \
204 case 4: __put_user_4(x, ptr); break; \ 206 case 4: __put_user_4(__pu_val, ptr); break; \
205 case 8: __put_user_8(x, ptr); break; \ 207 case 8: __put_user_8(__pu_val, ptr); break; \
206 default:__put_user_X(x, ptr); break; \ 208 default:__put_user_X(__pu_val, ptr); break; \
207 } \ 209 } \
208 __ret_pu; \ 210 __ret_pu; \
209}) 211})
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index dc81a55dd94d..d8afd0e3b81a 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -347,9 +347,9 @@ __syscall_return(type,__res); \
347type name(type1 arg1) \ 347type name(type1 arg1) \
348{ \ 348{ \
349long __res; \ 349long __res; \
350__asm__ volatile ("int $0x80" \ 350__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
351 : "=a" (__res) \ 351 : "=a" (__res) \
352 : "0" (__NR_##name),"b" ((long)(arg1)) : "memory"); \ 352 : "0" (__NR_##name),"ri" ((long)(arg1)) : "memory"); \
353__syscall_return(type,__res); \ 353__syscall_return(type,__res); \
354} 354}
355 355
@@ -357,9 +357,10 @@ __syscall_return(type,__res); \
357type name(type1 arg1,type2 arg2) \ 357type name(type1 arg1,type2 arg2) \
358{ \ 358{ \
359long __res; \ 359long __res; \
360__asm__ volatile ("int $0x80" \ 360__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
361 : "=a" (__res) \ 361 : "=a" (__res) \
362 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)) : "memory"); \ 362 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \
363 : "memory"); \
363__syscall_return(type,__res); \ 364__syscall_return(type,__res); \
364} 365}
365 366
@@ -367,9 +368,9 @@ __syscall_return(type,__res); \
367type name(type1 arg1,type2 arg2,type3 arg3) \ 368type name(type1 arg1,type2 arg2,type3 arg3) \
368{ \ 369{ \
369long __res; \ 370long __res; \
370__asm__ volatile ("int $0x80" \ 371__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
371 : "=a" (__res) \ 372 : "=a" (__res) \
372 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 373 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
373 "d" ((long)(arg3)) : "memory"); \ 374 "d" ((long)(arg3)) : "memory"); \
374__syscall_return(type,__res); \ 375__syscall_return(type,__res); \
375} 376}
@@ -378,9 +379,9 @@ __syscall_return(type,__res); \
378type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ 379type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
379{ \ 380{ \
380long __res; \ 381long __res; \
381__asm__ volatile ("int $0x80" \ 382__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
382 : "=a" (__res) \ 383 : "=a" (__res) \
383 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 384 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
384 "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \ 385 "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \
385__syscall_return(type,__res); \ 386__syscall_return(type,__res); \
386} 387}
@@ -390,10 +391,12 @@ __syscall_return(type,__res); \
390type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ 391type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
391{ \ 392{ \
392long __res; \ 393long __res; \
393__asm__ volatile ("int $0x80" \ 394__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; movl %1,%%eax ; " \
395 "int $0x80 ; pop %%ebx" \
394 : "=a" (__res) \ 396 : "=a" (__res) \
395 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 397 : "i" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
396 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) : "memory"); \ 398 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \
399 : "memory"); \
397__syscall_return(type,__res); \ 400__syscall_return(type,__res); \
398} 401}
399 402
@@ -402,11 +405,14 @@ __syscall_return(type,__res); \
402type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ 405type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
403{ \ 406{ \
404long __res; \ 407long __res; \
405__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \ 408 struct { long __a1; long __a6; } __s = { (long)arg1, (long)arg6 }; \
409__asm__ volatile ("push %%ebp ; push %%ebx ; movl 4(%2),%%ebp ; " \
410 "movl 0(%2),%%ebx ; movl %1,%%eax ; int $0x80 ; " \
411 "pop %%ebx ; pop %%ebp" \
406 : "=a" (__res) \ 412 : "=a" (__res) \
407 : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 413 : "i" (__NR_##name),"0" ((long)(&__s)),"c" ((long)(arg2)), \
408 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ 414 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \
409 "0" ((long)(arg6)) : "memory"); \ 415 : "memory"); \
410__syscall_return(type,__res); \ 416__syscall_return(type,__res); \
411} 417}
412 418
diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
index d3e0dfa99e1f..569ec7574baf 100644
--- a/include/asm-ia64/atomic.h
+++ b/include/asm-ia64/atomic.h
@@ -95,8 +95,14 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
95({ \ 95({ \
96 int c, old; \ 96 int c, old; \
97 c = atomic_read(v); \ 97 c = atomic_read(v); \
98 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 98 for (;;) { \
99 if (unlikely(c == (u))) \
100 break; \
101 old = atomic_cmpxchg((v), c, c + (a)); \
102 if (likely(old == c)) \
103 break; \
99 c = old; \ 104 c = old; \
105 } \
100 c != (u); \ 106 c != (u); \
101}) 107})
102#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 108#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-ia64/cache.h b/include/asm-ia64/cache.h
index 40dd25195d65..f0a104db8f20 100644
--- a/include/asm-ia64/cache.h
+++ b/include/asm-ia64/cache.h
@@ -25,4 +25,6 @@
25# define SMP_CACHE_BYTES (1 << 3) 25# define SMP_CACHE_BYTES (1 << 3)
26#endif 26#endif
27 27
28#define __read_mostly __attribute__((__section__(".data.read_mostly")))
29
28#endif /* _ASM_IA64_CACHE_H */ 30#endif /* _ASM_IA64_CACHE_H */
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h
index 862e497c2645..732d696d31a6 100644
--- a/include/asm-m68k/atomic.h
+++ b/include/asm-m68k/atomic.h
@@ -175,8 +175,14 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *v)
175({ \ 175({ \
176 int c, old; \ 176 int c, old; \
177 c = atomic_read(v); \ 177 c = atomic_read(v); \
178 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 178 for (;;) { \
179 if (unlikely(c == (u))) \
180 break; \
181 old = atomic_cmpxchg((v), c, c + (a)); \
182 if (likely(old == c)) \
183 break; \
179 c = old; \ 184 c = old; \
185 } \
180 c != (u); \ 186 c != (u); \
181}) 187})
182#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 188#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
index 93f179f13ce8..ae50f8e12eed 100644
--- a/include/asm-parisc/cache.h
+++ b/include/asm-parisc/cache.h
@@ -29,6 +29,8 @@
29 29
30#define SMP_CACHE_BYTES L1_CACHE_BYTES 30#define SMP_CACHE_BYTES L1_CACHE_BYTES
31 31
32#define __read_mostly __attribute__((__section__(".data.read_mostly")))
33
32extern void flush_data_cache_local(void *); /* flushes local data-cache only */ 34extern void flush_data_cache_local(void *); /* flushes local data-cache only */
33extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */ 35extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */
34#ifdef CONFIG_SMP 36#ifdef CONFIG_SMP
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index e31922c50e53..464301cd0d03 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -27,10 +27,9 @@
27#define percpu_modcopy(pcpudst, src, size) \ 27#define percpu_modcopy(pcpudst, src, size) \
28do { \ 28do { \
29 unsigned int __i; \ 29 unsigned int __i; \
30 for (__i = 0; __i < NR_CPUS; __i++) \ 30 for_each_cpu(__i) \
31 if (cpu_possible(__i)) \ 31 memcpy((pcpudst)+__per_cpu_offset(__i), \
32 memcpy((pcpudst)+__per_cpu_offset(__i), \ 32 (src), (size)); \
33 (src), (size)); \
34} while (0) 33} while (0)
35 34
36extern void setup_per_cpu_areas(void); 35extern void setup_per_cpu_areas(void);
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index be6fefe223d6..de1d9926aa60 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -89,10 +89,15 @@ static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
89static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 89static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
90{ 90{
91 int c, old; 91 int c, old;
92
93 c = atomic_read(v); 92 c = atomic_read(v);
94 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c) 93 for (;;) {
94 if (unlikely(c == u))
95 break;
96 old = atomic_cmpxchg(v, c, c + a);
97 if (likely(old == c))
98 break;
95 c = old; 99 c = old;
100 }
96 return c != u; 101 return c != u;
97} 102}
98 103
@@ -167,10 +172,15 @@ static __inline__ int atomic64_add_unless(atomic64_t *v,
167 long long a, long long u) 172 long long a, long long u)
168{ 173{
169 long long c, old; 174 long long c, old;
170
171 c = atomic64_read(v); 175 c = atomic64_read(v);
172 while (c != u && (old = atomic64_cmpxchg(v, c, c + a)) != c) 176 for (;;) {
177 if (unlikely(c == u))
178 break;
179 old = atomic64_cmpxchg(v, c, c + a);
180 if (likely(old == c))
181 break;
173 c = old; 182 c = old;
183 }
174 return c != u; 184 return c != u;
175} 185}
176 186
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 123fcaca295e..e10ed87094f0 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -46,10 +46,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
46#define percpu_modcopy(pcpudst, src, size) \ 46#define percpu_modcopy(pcpudst, src, size) \
47do { \ 47do { \
48 unsigned int __i; \ 48 unsigned int __i; \
49 for (__i = 0; __i < NR_CPUS; __i++) \ 49 for_each_cpu(__i) \
50 if (cpu_possible(__i)) \ 50 memcpy((pcpudst)+__per_cpu_offset[__i], \
51 memcpy((pcpudst)+__per_cpu_offset[__i], \ 51 (src), (size)); \
52 (src), (size)); \
53} while (0) 52} while (0)
54 53
55#else /* ! SMP */ 54#else /* ! SMP */
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 25256bdc8aae..468eb48d8142 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -78,9 +78,15 @@ extern int atomic64_sub_ret(int, atomic64_t *);
78({ \ 78({ \
79 int c, old; \ 79 int c, old; \
80 c = atomic_read(v); \ 80 c = atomic_read(v); \
81 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 81 for (;;) { \
82 if (unlikely(c == (u))) \
83 break; \
84 old = atomic_cmpxchg((v), c, c + (a)); \
85 if (likely(old == c)) \
86 break; \
82 c = old; \ 87 c = old; \
83 c != (u); \ 88 } \
89 likely(c != (u)); \
84}) 90})
85#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 91#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
86 92
diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h
index f7d35a2ae9b8..e9df17acedde 100644
--- a/include/asm-sparc64/cache.h
+++ b/include/asm-sparc64/cache.h
@@ -13,4 +13,6 @@
13#define SMP_CACHE_BYTES_SHIFT 6 13#define SMP_CACHE_BYTES_SHIFT 6
14#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) /* L2 cache line size. */ 14#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) /* L2 cache line size. */
15 15
16#define __read_mostly __attribute__((__section__(".data.read_mostly")))
17
16#endif 18#endif
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index aea4e51e7cd1..82032e159a76 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -26,10 +26,9 @@ register unsigned long __local_per_cpu_offset asm("g5");
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for (__i = 0; __i < NR_CPUS; __i++) \ 29 for_each_cpu(__i) \
30 if (cpu_possible(__i)) \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 memcpy((pcpudst)+__per_cpu_offset(__i), \ 31 (src), (size)); \
32 (src), (size)); \
33} while (0) 32} while (0)
34#else /* ! SMP */ 33#else /* ! SMP */
35 34
diff --git a/include/asm-um/alternative.h b/include/asm-um/alternative.h
new file mode 100644
index 000000000000..b6434396bd42
--- /dev/null
+++ b/include/asm-um/alternative.h
@@ -0,0 +1,6 @@
1#ifndef __UM_ALTERNATIVE_H
2#define __UM_ALTERNATIVE_H
3
4#include "asm/arch/alternative.h"
5
6#endif
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 4b5cd553e772..cecbf7baa6aa 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -405,8 +405,14 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t *v)
405({ \ 405({ \
406 int c, old; \ 406 int c, old; \
407 c = atomic_read(v); \ 407 c = atomic_read(v); \
408 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 408 for (;;) { \
409 if (unlikely(c == (u))) \
410 break; \
411 old = atomic_cmpxchg((v), c, c + (a)); \
412 if (likely(old == c)) \
413 break; \
409 c = old; \ 414 c = old; \
415 } \
410 c != (u); \ 416 c != (u); \
411}) 417})
412#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 418#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h
index 263f0a211ed7..c8043a16152e 100644
--- a/include/asm-x86_64/cache.h
+++ b/include/asm-x86_64/cache.h
@@ -20,6 +20,8 @@
20 __attribute__((__section__(".data.page_aligned"))) 20 __attribute__((__section__(".data.page_aligned")))
21#endif 21#endif
22 22
23#define __read_mostly __attribute__((__section__(".data.read_mostly")))
24
23#endif 25#endif
24 26
25#endif 27#endif
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 29a6b0408f75..4405b4adeaba 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -26,10 +26,9 @@
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for (__i = 0; __i < NR_CPUS; __i++) \ 29 for_each_cpu(__i) \
30 if (cpu_possible(__i)) \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 memcpy((pcpudst)+__per_cpu_offset(__i), \ 31 (src), (size)); \
32 (src), (size)); \
33} while (0) 32} while (0)
34 33
35extern void setup_per_cpu_areas(void); 34extern void setup_per_cpu_areas(void);
diff --git a/include/linux/cache.h b/include/linux/cache.h
index d22e632f41fb..cc4b3aafad9a 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,9 +13,7 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC) 16#ifndef __read_mostly
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else
19#define __read_mostly 17#define __read_mostly
20#endif 18#endif
21 19
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index b68fdf1f3156..3c9b0bc05123 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -378,7 +378,6 @@ struct cdrom_generic_command
378#define CDC_MEDIA_CHANGED 0x80 /* media changed */ 378#define CDC_MEDIA_CHANGED 0x80 /* media changed */
379#define CDC_PLAY_AUDIO 0x100 /* audio functions */ 379#define CDC_PLAY_AUDIO 0x100 /* audio functions */
380#define CDC_RESET 0x200 /* hard reset device */ 380#define CDC_RESET 0x200 /* hard reset device */
381#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */
382#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ 381#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */
383#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ 382#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */
384#define CDC_CD_R 0x2000 /* drive is a CD-R */ 383#define CDC_CD_R 0x2000 /* drive is a CD-R */
@@ -974,9 +973,7 @@ struct cdrom_device_ops {
974 int (*reset) (struct cdrom_device_info *); 973 int (*reset) (struct cdrom_device_info *);
975 /* play stuff */ 974 /* play stuff */
976 int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *); 975 int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *);
977 /* dev-specific */ 976
978 int (*dev_ioctl) (struct cdrom_device_info *,
979 unsigned int, unsigned long);
980/* driver specifications */ 977/* driver specifications */
981 const int capability; /* capability flags */ 978 const int capability; /* capability flags */
982 int n_minors; /* number of active minor devices */ 979 int n_minors; /* number of active minor devices */
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 1289f0ec4c00..1e4bdfcf83a2 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -52,7 +52,12 @@ struct file;
52#ifdef CONFIG_EPOLL 52#ifdef CONFIG_EPOLL
53 53
54/* Used to initialize the epoll bits inside the "struct file" */ 54/* Used to initialize the epoll bits inside the "struct file" */
55void eventpoll_init_file(struct file *file); 55static inline void eventpoll_init_file(struct file *file)
56{
57 INIT_LIST_HEAD(&file->f_ep_links);
58 spin_lock_init(&file->f_ep_lock);
59}
60
56 61
57/* Used to release the epoll bits inside the "struct file" */ 62/* Used to release the epoll bits inside the "struct file" */
58void eventpoll_release_file(struct file *file); 63void eventpoll_release_file(struct file *file);
@@ -85,7 +90,6 @@ static inline void eventpoll_release(struct file *file)
85 eventpoll_release_file(file); 90 eventpoll_release_file(file);
86} 91}
87 92
88
89#else 93#else
90 94
91static inline void eventpoll_init_file(struct file *file) {} 95static inline void eventpoll_init_file(struct file *file) {}
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index c0272d73ab20..e7239f2f97a1 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -772,9 +772,12 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
772 772
773 773
774/* inode.c */ 774/* inode.c */
775extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); 775int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
776extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); 776struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
777extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 777struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
778int ext3_get_block_handle(handle_t *handle, struct inode *inode,
779 sector_t iblock, struct buffer_head *bh_result, int create,
780 int extend_disksize);
778 781
779extern void ext3_read_inode (struct inode *); 782extern void ext3_read_inode (struct inode *);
780extern int ext3_write_inode (struct inode *, int); 783extern int ext3_write_inode (struct inode *, int);
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index e71dd98dbcae..7abf90147180 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -19,6 +19,7 @@
19#include <linux/rwsem.h> 19#include <linux/rwsem.h>
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/seqlock.h> 21#include <linux/seqlock.h>
22#include <linux/mutex.h>
22 23
23struct ext3_reserve_window { 24struct ext3_reserve_window {
24 __u32 _rsv_start; /* First byte reserved */ 25 __u32 _rsv_start; /* First byte reserved */
@@ -122,16 +123,16 @@ struct ext3_inode_info {
122 __u16 i_extra_isize; 123 __u16 i_extra_isize;
123 124
124 /* 125 /*
125 * truncate_sem is for serialising ext3_truncate() against 126 * truncate_mutex is for serialising ext3_truncate() against
126 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's 127 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's
127 * data tree are chopped off during truncate. We can't do that in 128 * data tree are chopped off during truncate. We can't do that in
128 * ext3 because whenever we perform intermediate commits during 129 * ext3 because whenever we perform intermediate commits during
129 * truncate, the inode and all the metadata blocks *must* be in a 130 * truncate, the inode and all the metadata blocks *must* be in a
130 * consistent state which allows truncation of the orphans to restart 131 * consistent state which allows truncation of the orphans to restart
131 * during recovery. Hence we must fix the get_block-vs-truncate race 132 * during recovery. Hence we must fix the get_block-vs-truncate race
132 * by other means, so we have truncate_sem. 133 * by other means, so we have truncate_mutex.
133 */ 134 */
134 struct semaphore truncate_sem; 135 struct mutex truncate_mutex;
135 struct inode vfs_inode; 136 struct inode vfs_inode;
136}; 137};
137 138
diff --git a/include/linux/file.h b/include/linux/file.h
index 9901b850f2e4..9f7c2513866f 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -10,6 +10,7 @@
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/types.h>
13 14
14/* 15/*
15 * The default fd array needs to be at least BITS_PER_LONG, 16 * The default fd array needs to be at least BITS_PER_LONG,
@@ -17,10 +18,22 @@
17 */ 18 */
18#define NR_OPEN_DEFAULT BITS_PER_LONG 19#define NR_OPEN_DEFAULT BITS_PER_LONG
19 20
21/*
22 * The embedded_fd_set is a small fd_set,
23 * suitable for most tasks (which open <= BITS_PER_LONG files)
24 */
25struct embedded_fd_set {
26 unsigned long fds_bits[1];
27};
28
29/*
30 * More than this number of fds: we use a separately allocated fd_set
31 */
32#define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set))
33
20struct fdtable { 34struct fdtable {
21 unsigned int max_fds; 35 unsigned int max_fds;
22 int max_fdset; 36 int max_fdset;
23 int next_fd;
24 struct file ** fd; /* current fd array */ 37 struct file ** fd; /* current fd array */
25 fd_set *close_on_exec; 38 fd_set *close_on_exec;
26 fd_set *open_fds; 39 fd_set *open_fds;
@@ -33,13 +46,20 @@ struct fdtable {
33 * Open file table structure 46 * Open file table structure
34 */ 47 */
35struct files_struct { 48struct files_struct {
49 /*
50 * read mostly part
51 */
36 atomic_t count; 52 atomic_t count;
37 struct fdtable *fdt; 53 struct fdtable *fdt;
38 struct fdtable fdtab; 54 struct fdtable fdtab;
39 fd_set close_on_exec_init; 55 /*
40 fd_set open_fds_init; 56 * written part on a separate cache line in SMP
57 */
58 spinlock_t file_lock ____cacheline_aligned_in_smp;
59 int next_fd;
60 struct embedded_fd_set close_on_exec_init;
61 struct embedded_fd_set open_fds_init;
41 struct file * fd_array[NR_OPEN_DEFAULT]; 62 struct file * fd_array[NR_OPEN_DEFAULT];
42 spinlock_t file_lock; /* Protects concurrent writers. Nests inside tsk->alloc_lock */
43}; 63};
44 64
45#define files_fdtable(files) (rcu_dereference((files)->fdt)) 65#define files_fdtable(files) (rcu_dereference((files)->fdt))
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 128d0082522c..f9c9dea636d0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -397,8 +397,8 @@ struct block_device {
397 dev_t bd_dev; /* not a kdev_t - it's a search key */ 397 dev_t bd_dev; /* not a kdev_t - it's a search key */
398 struct inode * bd_inode; /* will die */ 398 struct inode * bd_inode; /* will die */
399 int bd_openers; 399 int bd_openers;
400 struct semaphore bd_sem; /* open/close mutex */ 400 struct mutex bd_mutex; /* open/close mutex */
401 struct semaphore bd_mount_sem; /* mount mutex */ 401 struct mutex bd_mount_mutex; /* mount mutex */
402 struct list_head bd_inodes; 402 struct list_head bd_inodes;
403 void * bd_holder; 403 void * bd_holder;
404 int bd_holders; 404 int bd_holders;
@@ -509,7 +509,7 @@ struct inode {
509 509
510#ifdef CONFIG_INOTIFY 510#ifdef CONFIG_INOTIFY
511 struct list_head inotify_watches; /* watches on this inode */ 511 struct list_head inotify_watches; /* watches on this inode */
512 struct semaphore inotify_sem; /* protects the watches list */ 512 struct mutex inotify_mutex; /* protects the watches list */
513#endif 513#endif
514 514
515 unsigned long i_state; 515 unsigned long i_state;
@@ -847,7 +847,7 @@ struct super_block {
847 * The next field is for VFS *only*. No filesystems have any business 847 * The next field is for VFS *only*. No filesystems have any business
848 * even looking at it. You had been warned. 848 * even looking at it. You had been warned.
849 */ 849 */
850 struct semaphore s_vfs_rename_sem; /* Kludge */ 850 struct mutex s_vfs_rename_mutex; /* Kludge */
851 851
852 /* Granuality of c/m/atime in ns. 852 /* Granuality of c/m/atime in ns.
853 Cannot be worse than a second */ 853 Cannot be worse than a second */
@@ -1115,6 +1115,18 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1115 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1115 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1116} 1116}
1117 1117
1118static inline void inode_inc_link_count(struct inode *inode)
1119{
1120 inode->i_nlink++;
1121 mark_inode_dirty(inode);
1122}
1123
1124static inline void inode_dec_link_count(struct inode *inode)
1125{
1126 inode->i_nlink--;
1127 mark_inode_dirty(inode);
1128}
1129
1118extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1130extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1119static inline void file_accessed(struct file *file) 1131static inline void file_accessed(struct file *file)
1120{ 1132{
@@ -1534,7 +1546,7 @@ extern void destroy_inode(struct inode *);
1534extern struct inode *new_inode(struct super_block *); 1546extern struct inode *new_inode(struct super_block *);
1535extern int remove_suid(struct dentry *); 1547extern int remove_suid(struct dentry *);
1536extern void remove_dquot_ref(struct super_block *, int, struct list_head *); 1548extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1537extern struct semaphore iprune_sem; 1549extern struct mutex iprune_mutex;
1538 1550
1539extern void __insert_inode_hash(struct inode *, unsigned long hashval); 1551extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1540extern void remove_inode_hash(struct inode *); 1552extern void remove_inode_hash(struct inode *);
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 0abe9d9a0069..652611a4bdcd 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -12,6 +12,8 @@
12#ifndef GENERIC_SERIAL_H 12#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 13#define GENERIC_SERIAL_H
14 14
15#include <linux/mutex.h>
16
15struct real_driver { 17struct real_driver {
16 void (*disable_tx_interrupts) (void *); 18 void (*disable_tx_interrupts) (void *);
17 void (*enable_tx_interrupts) (void *); 19 void (*enable_tx_interrupts) (void *);
@@ -34,7 +36,7 @@ struct gs_port {
34 int xmit_head; 36 int xmit_head;
35 int xmit_tail; 37 int xmit_tail;
36 int xmit_cnt; 38 int xmit_cnt;
37 struct semaphore port_write_sem; 39 struct mutex port_write_mutex;
38 int flags; 40 int flags;
39 wait_queue_head_t open_wait; 41 wait_queue_head_t open_wait;
40 wait_queue_head_t close_wait; 42 wait_queue_head_t close_wait;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index eef5ccdcd731..fd647fde5ec1 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -149,22 +149,16 @@ struct disk_attribute {
149({ \ 149({ \
150 typeof(gendiskp->dkstats->field) res = 0; \ 150 typeof(gendiskp->dkstats->field) res = 0; \
151 int i; \ 151 int i; \
152 for (i=0; i < NR_CPUS; i++) { \ 152 for_each_cpu(i) \
153 if (!cpu_possible(i)) \
154 continue; \
155 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ 153 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
156 } \
157 res; \ 154 res; \
158}) 155})
159 156
160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 157static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
161 int i; 158 int i;
162 for (i=0; i < NR_CPUS; i++) { 159 for_each_cpu(i)
163 if (cpu_possible(i)) { 160 memset(per_cpu_ptr(gendiskp->dkstats, i), value,
164 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 161 sizeof (struct disk_stats));
165 sizeof (struct disk_stats));
166 }
167 }
168} 162}
169 163
170#else 164#else
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index dcfd2ecccb5d..92146f3b7423 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -7,11 +7,10 @@
7#define INIT_FDTABLE \ 7#define INIT_FDTABLE \
8{ \ 8{ \
9 .max_fds = NR_OPEN_DEFAULT, \ 9 .max_fds = NR_OPEN_DEFAULT, \
10 .max_fdset = __FD_SETSIZE, \ 10 .max_fdset = EMBEDDED_FD_SET_SIZE, \
11 .next_fd = 0, \
12 .fd = &init_files.fd_array[0], \ 11 .fd = &init_files.fd_array[0], \
13 .close_on_exec = &init_files.close_on_exec_init, \ 12 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
14 .open_fds = &init_files.open_fds_init, \ 13 .open_fds = (fd_set *)&init_files.open_fds_init, \
15 .rcu = RCU_HEAD_INIT, \ 14 .rcu = RCU_HEAD_INIT, \
16 .free_files = NULL, \ 15 .free_files = NULL, \
17 .next = NULL, \ 16 .next = NULL, \
@@ -20,9 +19,10 @@
20#define INIT_FILES \ 19#define INIT_FILES \
21{ \ 20{ \
22 .count = ATOMIC_INIT(1), \ 21 .count = ATOMIC_INIT(1), \
23 .file_lock = SPIN_LOCK_UNLOCKED, \
24 .fdt = &init_files.fdtab, \ 22 .fdt = &init_files.fdtab, \
25 .fdtab = INIT_FDTABLE, \ 23 .fdtab = INIT_FDTABLE, \
24 .file_lock = SPIN_LOCK_UNLOCKED, \
25 .next_fd = 0, \
26 .close_on_exec_init = { { 0, } }, \ 26 .close_on_exec_init = { { 0, } }, \
27 .open_fds_init = { { 0, } }, \ 27 .open_fds_init = { { 0, } }, \
28 .fd_array = { NULL, } \ 28 .fd_array = { NULL, } \
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 41ee79962bb2..2ccbfb6340ba 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -28,6 +28,7 @@
28#include <linux/journal-head.h> 28#include <linux/journal-head.h>
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h>
31#include <asm/semaphore.h> 32#include <asm/semaphore.h>
32#endif 33#endif
33 34
@@ -575,7 +576,7 @@ struct transaction_s
575 * @j_wait_checkpoint: Wait queue to trigger checkpointing 576 * @j_wait_checkpoint: Wait queue to trigger checkpointing
576 * @j_wait_commit: Wait queue to trigger commit 577 * @j_wait_commit: Wait queue to trigger commit
577 * @j_wait_updates: Wait queue to wait for updates to complete 578 * @j_wait_updates: Wait queue to wait for updates to complete
578 * @j_checkpoint_sem: Semaphore for locking against concurrent checkpoints 579 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
579 * @j_head: Journal head - identifies the first unused block in the journal 580 * @j_head: Journal head - identifies the first unused block in the journal
580 * @j_tail: Journal tail - identifies the oldest still-used block in the 581 * @j_tail: Journal tail - identifies the oldest still-used block in the
581 * journal. 582 * journal.
@@ -645,7 +646,7 @@ struct journal_s
645 int j_barrier_count; 646 int j_barrier_count;
646 647
647 /* The barrier lock itself */ 648 /* The barrier lock itself */
648 struct semaphore j_barrier; 649 struct mutex j_barrier;
649 650
650 /* 651 /*
651 * Transactions: The current running transaction... 652 * Transactions: The current running transaction...
@@ -687,7 +688,7 @@ struct journal_s
687 wait_queue_head_t j_wait_updates; 688 wait_queue_head_t j_wait_updates;
688 689
689 /* Semaphore for locking against concurrent checkpoints */ 690 /* Semaphore for locking against concurrent checkpoints */
690 struct semaphore j_checkpoint_sem; 691 struct mutex j_checkpoint_mutex;
691 692
692 /* 693 /*
693 * Journal head: identifies the first unused block in the journal. 694 * Journal head: identifies the first unused block in the journal.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3b507bf05d09..bb6e7ddee2fd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -91,6 +91,9 @@ extern struct notifier_block *panic_notifier_list;
91extern long (*panic_blink)(long time); 91extern long (*panic_blink)(long time);
92NORET_TYPE void panic(const char * fmt, ...) 92NORET_TYPE void panic(const char * fmt, ...)
93 __attribute__ ((NORET_AND format (printf, 1, 2))); 93 __attribute__ ((NORET_AND format (printf, 1, 2)));
94extern void oops_enter(void);
95extern void oops_exit(void);
96extern int oops_may_print(void);
94fastcall NORET_TYPE void do_exit(long error_code) 97fastcall NORET_TYPE void do_exit(long error_code)
95 ATTRIB_NORET; 98 ATTRIB_NORET;
96NORET_TYPE void complete_and_exit(struct completion *, long) 99NORET_TYPE void complete_and_exit(struct completion *, long)
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 669756bc20a2..778adc0fa640 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -36,6 +36,7 @@
36#include <linux/percpu.h> 36#include <linux/percpu.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/rcupdate.h> 38#include <linux/rcupdate.h>
39#include <linux/mutex.h>
39 40
40#ifdef CONFIG_KPROBES 41#ifdef CONFIG_KPROBES
41#include <asm/kprobes.h> 42#include <asm/kprobes.h>
@@ -152,7 +153,7 @@ struct kretprobe_instance {
152}; 153};
153 154
154extern spinlock_t kretprobe_lock; 155extern spinlock_t kretprobe_lock;
155extern struct semaphore kprobe_mutex; 156extern struct mutex kprobe_mutex;
156extern int arch_prepare_kprobe(struct kprobe *p); 157extern int arch_prepare_kprobe(struct kprobe *p);
157extern void arch_arm_kprobe(struct kprobe *p); 158extern void arch_arm_kprobe(struct kprobe *p);
158extern void arch_disarm_kprobe(struct kprobe *p); 159extern void arch_disarm_kprobe(struct kprobe *p);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index f96506782ebe..e76c7611d6cc 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -17,6 +17,7 @@
17#include <linux/bio.h> 17#include <linux/bio.h>
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mutex.h>
20 21
21/* Possible states of device */ 22/* Possible states of device */
22enum { 23enum {
@@ -60,7 +61,7 @@ struct loop_device {
60 int lo_state; 61 int lo_state;
61 struct completion lo_done; 62 struct completion lo_done;
62 struct completion lo_bh_done; 63 struct completion lo_bh_done;
63 struct semaphore lo_ctl_mutex; 64 struct mutex lo_ctl_mutex;
64 int lo_pending; 65 int lo_pending;
65 66
66 request_queue_t *lo_queue; 67 request_queue_t *lo_queue;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 8bcd9450d926..779e6a5744c7 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -184,6 +184,7 @@ struct fat_slot_info {
184#include <linux/string.h> 184#include <linux/string.h>
185#include <linux/nls.h> 185#include <linux/nls.h>
186#include <linux/fs.h> 186#include <linux/fs.h>
187#include <linux/mutex.h>
187 188
188struct fat_mount_options { 189struct fat_mount_options {
189 uid_t fs_uid; 190 uid_t fs_uid;
@@ -226,7 +227,7 @@ struct msdos_sb_info {
226 unsigned long max_cluster; /* maximum cluster number */ 227 unsigned long max_cluster; /* maximum cluster number */
227 unsigned long root_cluster; /* first cluster of the root directory */ 228 unsigned long root_cluster; /* first cluster of the root directory */
228 unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ 229 unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */
229 struct semaphore fat_lock; 230 struct mutex fat_lock;
230 unsigned int prev_free; /* previously allocated cluster number */ 231 unsigned int prev_free; /* previously allocated cluster number */
231 unsigned int free_clusters; /* -1 if undefined */ 232 unsigned int free_clusters; /* -1 if undefined */
232 struct fat_mount_options options; 233 struct fat_mount_options options;
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index f95d51fae733..a6ce409ec6fc 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -38,6 +38,7 @@ enum {
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/wait.h> 40#include <linux/wait.h>
41#include <linux/mutex.h>
41 42
42/* values for flags field */ 43/* values for flags field */
43#define NBD_READ_ONLY 0x0001 44#define NBD_READ_ONLY 0x0001
@@ -57,7 +58,7 @@ struct nbd_device {
57 struct request *active_req; 58 struct request *active_req;
58 wait_queue_head_t active_wq; 59 wait_queue_head_t active_wq;
59 60
60 struct semaphore tx_lock; 61 struct mutex tx_lock;
61 struct gendisk *disk; 62 struct gendisk *disk;
62 int blksize; 63 int blksize;
63 u64 bytesize; 64 u64 bytesize;
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h
index 415be1ec6f98..bdb4c8ae6924 100644
--- a/include/linux/ncp_fs_i.h
+++ b/include/linux/ncp_fs_i.h
@@ -19,7 +19,7 @@ struct ncp_inode_info {
19 __le32 DosDirNum; 19 __le32 DosDirNum;
20 __u8 volNumber; 20 __u8 volNumber;
21 __le32 nwattr; 21 __le32 nwattr;
22 struct semaphore open_sem; 22 struct mutex open_mutex;
23 atomic_t opened; 23 atomic_t opened;
24 int access; 24 int access;
25 int flags; 25 int flags;
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index cf858eb80f0b..b089d9506283 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ncp_mount.h> 12#include <linux/ncp_mount.h>
13#include <linux/net.h> 13#include <linux/net.h>
14#include <linux/mutex.h>
14 15
15#ifdef __KERNEL__ 16#ifdef __KERNEL__
16 17
@@ -51,7 +52,7 @@ struct ncp_server {
51 receive replies */ 52 receive replies */
52 53
53 int lock; /* To prevent mismatch in protocols. */ 54 int lock; /* To prevent mismatch in protocols. */
54 struct semaphore sem; 55 struct mutex mutex;
55 56
56 int current_size; /* for packet preparation */ 57 int current_size; /* for packet preparation */
57 int has_subfunction; 58 int has_subfunction;
@@ -96,7 +97,7 @@ struct ncp_server {
96 struct { 97 struct {
97 struct work_struct tq; /* STREAM/DGRAM: data/error ready */ 98 struct work_struct tq; /* STREAM/DGRAM: data/error ready */
98 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */ 99 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
99 struct semaphore creq_sem; /* DGRAM only: lock accesses to rcv.creq */ 100 struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */
100 101
101 unsigned int state; /* STREAM only: receiver state */ 102 unsigned int state; /* STREAM only: receiver state */
102 struct { 103 struct {
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5be87ba3b7ac..6df2585c0169 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -188,6 +188,8 @@ extern void device_power_up(void);
188extern void device_resume(void); 188extern void device_resume(void);
189 189
190#ifdef CONFIG_PM 190#ifdef CONFIG_PM
191extern suspend_disk_method_t pm_disk_mode;
192
191extern int device_suspend(pm_message_t state); 193extern int device_suspend(pm_message_t state);
192 194
193#define device_set_wakeup_enable(dev,val) \ 195#define device_set_wakeup_enable(dev,val) \
@@ -215,7 +217,6 @@ static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
215 217
216static inline void dpm_runtime_resume(struct device * dev) 218static inline void dpm_runtime_resume(struct device * dev)
217{ 219{
218
219} 220}
220 221
221#endif 222#endif
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 026969a5595c..1f2fea6640a4 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -14,6 +14,7 @@
14 14
15struct proc_dir_entry; 15struct proc_dir_entry;
16struct pt_regs; 16struct pt_regs;
17struct notifier_block;
17 18
18/* init basic kernel profiler */ 19/* init basic kernel profiler */
19void __init profile_init(void); 20void __init profile_init(void);
@@ -32,7 +33,6 @@ enum profile_type {
32 33
33#ifdef CONFIG_PROFILING 34#ifdef CONFIG_PROFILING
34 35
35struct notifier_block;
36struct task_struct; 36struct task_struct;
37struct mm_struct; 37struct mm_struct;
38 38
diff --git a/include/linux/quota.h b/include/linux/quota.h
index f33aeb22c26a..8dc2d04a103f 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -38,6 +38,7 @@
38#include <linux/errno.h> 38#include <linux/errno.h>
39#include <linux/types.h> 39#include <linux/types.h>
40#include <linux/spinlock.h> 40#include <linux/spinlock.h>
41#include <linux/mutex.h>
41 42
42#define __DQUOT_VERSION__ "dquot_6.5.1" 43#define __DQUOT_VERSION__ "dquot_6.5.1"
43#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 44#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
@@ -215,7 +216,7 @@ struct dquot {
215 struct list_head dq_inuse; /* List of all quotas */ 216 struct list_head dq_inuse; /* List of all quotas */
216 struct list_head dq_free; /* Free list element */ 217 struct list_head dq_free; /* Free list element */
217 struct list_head dq_dirty; /* List of dirty dquots */ 218 struct list_head dq_dirty; /* List of dirty dquots */
218 struct semaphore dq_lock; /* dquot IO lock */ 219 struct mutex dq_lock; /* dquot IO lock */
219 atomic_t dq_count; /* Use count */ 220 atomic_t dq_count; /* Use count */
220 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */ 221 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */
221 struct super_block *dq_sb; /* superblock this applies to */ 222 struct super_block *dq_sb; /* superblock this applies to */
@@ -285,8 +286,8 @@ struct quota_format_type {
285 286
286struct quota_info { 287struct quota_info {
287 unsigned int flags; /* Flags for diskquotas on this device */ 288 unsigned int flags; /* Flags for diskquotas on this device */
288 struct semaphore dqio_sem; /* lock device while I/O in progress */ 289 struct mutex dqio_mutex; /* lock device while I/O in progress */
289 struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ 290 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
290 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ 291 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
291 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 292 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
292 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 293 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 9d5494aaac0f..3009c813d83d 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -130,6 +130,6 @@ struct r1bio_s {
130 * with failure when last write completes (and all failed). 130 * with failure when last write completes (and all failed).
131 * Record that bi_end_io was called with this flag... 131 * Record that bi_end_io was called with this flag...
132 */ 132 */
133#define R1BIO_Returned 4 133#define R1BIO_Returned 6
134 134
135#endif 135#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c2ec6c77874e..5673008b61e1 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -113,8 +113,6 @@ struct rcu_data {
113 113
114DECLARE_PER_CPU(struct rcu_data, rcu_data); 114DECLARE_PER_CPU(struct rcu_data, rcu_data);
115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); 115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
116extern struct rcu_ctrlblk rcu_ctrlblk;
117extern struct rcu_ctrlblk rcu_bh_ctrlblk;
118 116
119/* 117/*
120 * Increment the quiescent state counter. 118 * Increment the quiescent state counter.
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 850a974ee505..b95f6eb7254c 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <asm/semaphore.h> 7#include <linux/mutex.h>
8 8
9struct seq_operations; 9struct seq_operations;
10struct file; 10struct file;
@@ -19,7 +19,7 @@ struct seq_file {
19 size_t count; 19 size_t count;
20 loff_t index; 20 loff_t index;
21 loff_t version; 21 loff_t version;
22 struct semaphore sem; 22 struct mutex lock;
23 struct seq_operations *op; 23 struct seq_operations *op;
24 void *private; 24 void *private;
25}; 25};
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 12415dd94451..54eac8a39a4c 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -234,14 +234,15 @@ extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *v
234/* linux/mm/swapfile.c */ 234/* linux/mm/swapfile.c */
235extern long total_swap_pages; 235extern long total_swap_pages;
236extern unsigned int nr_swapfiles; 236extern unsigned int nr_swapfiles;
237extern struct swap_info_struct swap_info[];
238extern void si_swapinfo(struct sysinfo *); 237extern void si_swapinfo(struct sysinfo *);
239extern swp_entry_t get_swap_page(void); 238extern swp_entry_t get_swap_page(void);
240extern swp_entry_t get_swap_page_of_type(int type); 239extern swp_entry_t get_swap_page_of_type(int);
241extern int swap_duplicate(swp_entry_t); 240extern int swap_duplicate(swp_entry_t);
242extern int valid_swaphandles(swp_entry_t, unsigned long *); 241extern int valid_swaphandles(swp_entry_t, unsigned long *);
243extern void swap_free(swp_entry_t); 242extern void swap_free(swp_entry_t);
244extern void free_swap_and_cache(swp_entry_t); 243extern void free_swap_and_cache(swp_entry_t);
244extern int swap_type_of(dev_t);
245extern unsigned int count_swap_pages(int, int);
245extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 246extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
246extern struct swap_info_struct *get_swap_info_struct(unsigned); 247extern struct swap_info_struct *get_swap_info_struct(unsigned);
247extern int can_share_swap_page(struct page *); 248extern int can_share_swap_page(struct page *);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f45cd74e6f24..f13f49afe198 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -24,6 +24,7 @@
24#include <linux/tty_driver.h> 24#include <linux/tty_driver.h>
25#include <linux/tty_ldisc.h> 25#include <linux/tty_ldisc.h>
26#include <linux/screen_info.h> 26#include <linux/screen_info.h>
27#include <linux/mutex.h>
27 28
28#include <asm/system.h> 29#include <asm/system.h>
29 30
@@ -231,8 +232,8 @@ struct tty_struct {
231 int canon_data; 232 int canon_data;
232 unsigned long canon_head; 233 unsigned long canon_head;
233 unsigned int canon_column; 234 unsigned int canon_column;
234 struct semaphore atomic_read; 235 struct mutex atomic_read_lock;
235 struct semaphore atomic_write; 236 struct mutex atomic_write_lock;
236 unsigned char *write_buf; 237 unsigned char *write_buf;
237 int write_cnt; 238 int write_cnt;
238 spinlock_t read_lock; 239 spinlock_t read_lock;
@@ -319,8 +320,7 @@ extern void tty_ldisc_put(int);
319extern void tty_wakeup(struct tty_struct *tty); 320extern void tty_wakeup(struct tty_struct *tty);
320extern void tty_ldisc_flush(struct tty_struct *tty); 321extern void tty_ldisc_flush(struct tty_struct *tty);
321 322
322struct semaphore; 323extern struct mutex tty_mutex;
323extern struct semaphore tty_sem;
324 324
325/* n_tty.c */ 325/* n_tty.c */
326extern struct tty_ldisc tty_ldisc_N_TTY; 326extern struct tty_ldisc tty_ldisc_N_TTY;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 222faf97d5f9..0c6169fff366 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -7,14 +7,8 @@ extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *c
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); 7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); 8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9 9
10#ifdef INCLUDE_INLINE_FUNCS 10static inline int tty_insert_flip_char(struct tty_struct *tty,
11#define _INLINE_ extern 11 unsigned char ch, char flag)
12#else
13#define _INLINE_ static __inline__
14#endif
15
16_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
17 unsigned char ch, char flag)
18{ 12{
19 struct tty_buffer *tb = tty->buf.tail; 13 struct tty_buffer *tb = tty->buf.tail;
20 if (tb && tb->active && tb->used < tb->size) { 14 if (tb && tb->active && tb->used < tb->size) {
@@ -25,7 +19,7 @@ _INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
25 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 19 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
26} 20}
27 21
28_INLINE_ void tty_schedule_flip(struct tty_struct *tty) 22static inline void tty_schedule_flip(struct tty_struct *tty)
29{ 23{
30 unsigned long flags; 24 unsigned long flags;
31 spin_lock_irqsave(&tty->buf.lock, flags); 25 spin_lock_irqsave(&tty->buf.lock, flags);
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index b15ff2e99c91..80ae9ef940dc 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -13,7 +13,7 @@
13#ifndef _UDF_FS_SB_H 13#ifndef _UDF_FS_SB_H
14#define _UDF_FS_SB_H 1 14#define _UDF_FS_SB_H 1
15 15
16#include <asm/semaphore.h> 16#include <linux/mutex.h>
17 17
18#pragma pack(1) 18#pragma pack(1)
19 19
@@ -111,7 +111,7 @@ struct udf_sb_info
111 /* VAT inode */ 111 /* VAT inode */
112 struct inode *s_vat; 112 struct inode *s_vat;
113 113
114 struct semaphore s_alloc_sem; 114 struct mutex s_alloc_mutex;
115}; 115};
116 116
117#endif /* _UDF_FS_SB_H */ 117#endif /* _UDF_FS_SB_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index fab5aed8ca31..530ae3f4248c 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -73,6 +73,11 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
73int vt_waitactive(int vt); 73int vt_waitactive(int vt);
74void change_console(struct vc_data *new_vc); 74void change_console(struct vc_data *new_vc);
75void reset_vc(struct vc_data *vc); 75void reset_vc(struct vc_data *vc);
76#ifdef CONFIG_VT
77int is_console_suspend_safe(void);
78#else
79static inline int is_console_suspend_safe(void) { return 1; }
80#endif
76 81
77/* 82/*
78 * vc_screen.c shares this temporary buffer with the console write code so that 83 * vc_screen.c shares this temporary buffer with the console write code so that