diff options
91 files changed, 812 insertions, 455 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 576ce463cf44..989f1130f4f3 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -105,12 +105,15 @@ setting up a platform_device using the GPIO, is mark its direction: | |||
105 | 105 | ||
106 | /* set as input or output, returning 0 or negative errno */ | 106 | /* set as input or output, returning 0 or negative errno */ |
107 | int gpio_direction_input(unsigned gpio); | 107 | int gpio_direction_input(unsigned gpio); |
108 | int gpio_direction_output(unsigned gpio); | 108 | int gpio_direction_output(unsigned gpio, int value); |
109 | 109 | ||
110 | The return value is zero for success, else a negative errno. It should | 110 | The return value is zero for success, else a negative errno. It should |
111 | be checked, since the get/set calls don't have error returns and since | 111 | be checked, since the get/set calls don't have error returns and since |
112 | misconfiguration is possible. (These calls could sleep.) | 112 | misconfiguration is possible. (These calls could sleep.) |
113 | 113 | ||
114 | For output GPIOs, the value provided becomes the initial output value. | ||
115 | This helps avoid signal glitching during system startup. | ||
116 | |||
114 | Setting the direction can fail if the GPIO number is invalid, or when | 117 | Setting the direction can fail if the GPIO number is invalid, or when |
115 | that particular GPIO can't be used in that mode. It's generally a bad | 118 | that particular GPIO can't be used in that mode. It's generally a bad |
116 | idea to rely on boot firmware to have set the direction correctly, since | 119 | idea to rely on boot firmware to have set the direction correctly, since |
diff --git a/MAINTAINERS b/MAINTAINERS index 17555bba20af..6d8d5b917d1f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3103,6 +3103,9 @@ TPM DEVICE DRIVER | |||
3103 | P: Kylene Hall | 3103 | P: Kylene Hall |
3104 | M: kjhall@us.ibm.com | 3104 | M: kjhall@us.ibm.com |
3105 | W: http://tpmdd.sourceforge.net | 3105 | W: http://tpmdd.sourceforge.net |
3106 | P: Marcel Selhorst | ||
3107 | M: tpm@selhorst.net | ||
3108 | W: http://www.prosec.rub.de/tpm/ | ||
3106 | L: tpmdd-devel@lists.sourceforge.net | 3109 | L: tpmdd-devel@lists.sourceforge.net |
3107 | S: Maintained | 3110 | S: Maintained |
3108 | 3111 | ||
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index 44211a0af19a..ba4a1bb3ee40 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c | |||
@@ -215,13 +215,14 @@ int gpio_direction_input(unsigned pin) | |||
215 | } | 215 | } |
216 | EXPORT_SYMBOL(gpio_direction_input); | 216 | EXPORT_SYMBOL(gpio_direction_input); |
217 | 217 | ||
218 | int gpio_direction_output(unsigned pin) | 218 | int gpio_direction_output(unsigned pin, int value) |
219 | { | 219 | { |
220 | void __iomem *pio = pin_to_controller(pin); | 220 | void __iomem *pio = pin_to_controller(pin); |
221 | unsigned mask = pin_to_mask(pin); | 221 | unsigned mask = pin_to_mask(pin); |
222 | 222 | ||
223 | if (!pio || !(__raw_readl(pio + PIO_PSR) & mask)) | 223 | if (!pio || !(__raw_readl(pio + PIO_PSR) & mask)) |
224 | return -EINVAL; | 224 | return -EINVAL; |
225 | __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR)); | ||
225 | __raw_writel(mask, pio + PIO_OER); | 226 | __raw_writel(mask, pio + PIO_OER); |
226 | return 0; | 227 | return 0; |
227 | } | 228 | } |
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 192a5a26cf2b..edc349e5fcf7 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -153,7 +153,7 @@ int gpio_direction_input(unsigned gpio) | |||
153 | 153 | ||
154 | EXPORT_SYMBOL(gpio_direction_input); | 154 | EXPORT_SYMBOL(gpio_direction_input); |
155 | 155 | ||
156 | int gpio_direction_output(unsigned gpio) | 156 | int gpio_direction_output(unsigned gpio, int value) |
157 | { | 157 | { |
158 | unsigned long flags; | 158 | unsigned long flags; |
159 | 159 | ||
@@ -161,6 +161,7 @@ int gpio_direction_output(unsigned gpio) | |||
161 | return -EINVAL; | 161 | return -EINVAL; |
162 | 162 | ||
163 | local_irq_save(flags); | 163 | local_irq_save(flags); |
164 | gpio_set_value(gpio, value); | ||
164 | GPDR |= GPIO_GPIO(gpio); | 165 | GPDR |= GPIO_GPIO(gpio); |
165 | local_irq_restore(flags); | 166 | local_irq_restore(flags); |
166 | return 0; | 167 | return 0; |
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c index 9ba5654cde11..1eb99b814f5b 100644 --- a/arch/avr32/mach-at32ap/pio.c +++ b/arch/avr32/mach-at32ap/pio.c | |||
@@ -214,7 +214,7 @@ int gpio_direction_input(unsigned int gpio) | |||
214 | } | 214 | } |
215 | EXPORT_SYMBOL(gpio_direction_input); | 215 | EXPORT_SYMBOL(gpio_direction_input); |
216 | 216 | ||
217 | int gpio_direction_output(unsigned int gpio) | 217 | int gpio_direction_output(unsigned int gpio, int value) |
218 | { | 218 | { |
219 | struct pio_device *pio; | 219 | struct pio_device *pio; |
220 | unsigned int pin; | 220 | unsigned int pin; |
@@ -223,6 +223,8 @@ int gpio_direction_output(unsigned int gpio) | |||
223 | if (!pio) | 223 | if (!pio) |
224 | return -ENODEV; | 224 | return -ENODEV; |
225 | 225 | ||
226 | gpio_set_value(gpio, value); | ||
227 | |||
226 | pin = gpio & 0x1f; | 228 | pin = gpio & 0x1f; |
227 | pio_writel(pio, OER, 1 << pin); | 229 | pio_writel(pio, OER, 1 << pin); |
228 | 230 | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 2b9c65c3b5d1..5f29018a6533 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -250,7 +250,7 @@ config LASAT | |||
250 | select R5000_CPU_SCACHE | 250 | select R5000_CPU_SCACHE |
251 | select SYS_HAS_CPU_R5000 | 251 | select SYS_HAS_CPU_R5000 |
252 | select SYS_SUPPORTS_32BIT_KERNEL | 252 | select SYS_SUPPORTS_32BIT_KERNEL |
253 | select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL | 253 | select SYS_SUPPORTS_64BIT_KERNEL if BROKEN |
254 | select SYS_SUPPORTS_LITTLE_ENDIAN | 254 | select SYS_SUPPORTS_LITTLE_ENDIAN |
255 | select GENERIC_HARDIRQS_NO__DO_IRQ | 255 | select GENERIC_HARDIRQS_NO__DO_IRQ |
256 | 256 | ||
@@ -1559,6 +1559,7 @@ config MIPS_MT_SMP | |||
1559 | select CPU_MIPSR2_IRQ_VI | 1559 | select CPU_MIPSR2_IRQ_VI |
1560 | select CPU_MIPSR2_SRS | 1560 | select CPU_MIPSR2_SRS |
1561 | select MIPS_MT | 1561 | select MIPS_MT |
1562 | select NR_CPUS_DEFAULT_2 | ||
1562 | select SMP | 1563 | select SMP |
1563 | select SYS_SUPPORTS_SMP | 1564 | select SYS_SUPPORTS_SMP |
1564 | help | 1565 | help |
@@ -1573,7 +1574,6 @@ config MIPS_MT_SMTC | |||
1573 | select CPU_MIPSR2_IRQ_VI | 1574 | select CPU_MIPSR2_IRQ_VI |
1574 | select CPU_MIPSR2_SRS | 1575 | select CPU_MIPSR2_SRS |
1575 | select MIPS_MT | 1576 | select MIPS_MT |
1576 | select NR_CPUS_DEFAULT_2 | ||
1577 | select NR_CPUS_DEFAULT_8 | 1577 | select NR_CPUS_DEFAULT_8 |
1578 | select SMP | 1578 | select SMP |
1579 | select SYS_SUPPORTS_SMP | 1579 | select SYS_SUPPORTS_SMP |
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c index 241ee7a2906e..29eadd404fa5 100644 --- a/arch/mips/kernel/kspd.c +++ b/arch/mips/kernel/kspd.c | |||
@@ -191,6 +191,8 @@ void sp_work_handle_request(void) | |||
191 | struct mtsp_syscall_generic generic; | 191 | struct mtsp_syscall_generic generic; |
192 | struct mtsp_syscall_ret ret; | 192 | struct mtsp_syscall_ret ret; |
193 | struct kspd_notifications *n; | 193 | struct kspd_notifications *n; |
194 | unsigned long written; | ||
195 | mm_segment_t old_fs; | ||
194 | struct timeval tv; | 196 | struct timeval tv; |
195 | struct timezone tz; | 197 | struct timezone tz; |
196 | int cmd; | 198 | int cmd; |
@@ -201,7 +203,11 @@ void sp_work_handle_request(void) | |||
201 | 203 | ||
202 | ret.retval = -1; | 204 | ret.retval = -1; |
203 | 205 | ||
204 | if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall), 0)) { | 206 | old_fs = get_fs(); |
207 | set_fs(KERNEL_DS); | ||
208 | |||
209 | if (!rtlx_read(RTLX_CHANNEL_SYSIO, &sc, sizeof(struct mtsp_syscall))) { | ||
210 | set_fs(old_fs); | ||
205 | printk(KERN_ERR "Expected request but nothing to read\n"); | 211 | printk(KERN_ERR "Expected request but nothing to read\n"); |
206 | return; | 212 | return; |
207 | } | 213 | } |
@@ -209,7 +215,8 @@ void sp_work_handle_request(void) | |||
209 | size = sc.size; | 215 | size = sc.size; |
210 | 216 | ||
211 | if (size) { | 217 | if (size) { |
212 | if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size, 0)) { | 218 | if (!rtlx_read(RTLX_CHANNEL_SYSIO, &generic, size)) { |
219 | set_fs(old_fs); | ||
213 | printk(KERN_ERR "Expected request but nothing to read\n"); | 220 | printk(KERN_ERR "Expected request but nothing to read\n"); |
214 | return; | 221 | return; |
215 | } | 222 | } |
@@ -282,8 +289,11 @@ void sp_work_handle_request(void) | |||
282 | if (vpe_getuid(SP_VPE)) | 289 | if (vpe_getuid(SP_VPE)) |
283 | sp_setfsuidgid( 0, 0); | 290 | sp_setfsuidgid( 0, 0); |
284 | 291 | ||
285 | if ((rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(struct mtsp_syscall_ret), 0)) | 292 | old_fs = get_fs(); |
286 | < sizeof(struct mtsp_syscall_ret)) | 293 | set_fs(KERNEL_DS); |
294 | written = rtlx_write(RTLX_CHANNEL_SYSIO, &ret, sizeof(ret)); | ||
295 | set_fs(old_fs); | ||
296 | if (written < sizeof(ret)) | ||
287 | printk("KSPD: sp_work_handle_request failed to send to SP\n"); | 297 | printk("KSPD: sp_work_handle_request failed to send to SP\n"); |
288 | } | 298 | } |
289 | 299 | ||
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 1df544c1f966..37849edd0645 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -311,6 +311,8 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, | |||
311 | return ret; | 311 | return ret; |
312 | } | 312 | } |
313 | 313 | ||
314 | #ifdef CONFIG_SYSVIPC | ||
315 | |||
314 | asmlinkage long | 316 | asmlinkage long |
315 | sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) | 317 | sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) |
316 | { | 318 | { |
@@ -368,6 +370,16 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) | |||
368 | return err; | 370 | return err; |
369 | } | 371 | } |
370 | 372 | ||
373 | #else | ||
374 | |||
375 | asmlinkage long | ||
376 | sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) | ||
377 | { | ||
378 | return -ENOSYS; | ||
379 | } | ||
380 | |||
381 | #endif /* CONFIG_SYSVIPC */ | ||
382 | |||
371 | #ifdef CONFIG_MIPS32_N32 | 383 | #ifdef CONFIG_MIPS32_N32 |
372 | asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) | 384 | asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) |
373 | { | 385 | { |
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S index 656bde2e11b1..28c2e2e6af73 100644 --- a/arch/mips/kernel/r2300_switch.S +++ b/arch/mips/kernel/r2300_switch.S | |||
@@ -49,8 +49,7 @@ LEAF(resume) | |||
49 | #ifndef CONFIG_CPU_HAS_LLSC | 49 | #ifndef CONFIG_CPU_HAS_LLSC |
50 | sw zero, ll_bit | 50 | sw zero, ll_bit |
51 | #endif | 51 | #endif |
52 | mfc0 t1, CP0_STATUS | 52 | mfc0 t2, CP0_STATUS |
53 | sw t1, THREAD_STATUS(a0) | ||
54 | cpu_save_nonscratch a0 | 53 | cpu_save_nonscratch a0 |
55 | sw ra, THREAD_REG31(a0) | 54 | sw ra, THREAD_REG31(a0) |
56 | 55 | ||
@@ -60,8 +59,8 @@ LEAF(resume) | |||
60 | lw t3, TASK_THREAD_INFO(a0) | 59 | lw t3, TASK_THREAD_INFO(a0) |
61 | lw t0, TI_FLAGS(t3) | 60 | lw t0, TI_FLAGS(t3) |
62 | li t1, _TIF_USEDFPU | 61 | li t1, _TIF_USEDFPU |
63 | and t2, t0, t1 | 62 | and t1, t0 |
64 | beqz t2, 1f | 63 | beqz t1, 1f |
65 | nor t1, zero, t1 | 64 | nor t1, zero, t1 |
66 | 65 | ||
67 | and t0, t0, t1 | 66 | and t0, t0, t1 |
@@ -74,10 +73,13 @@ LEAF(resume) | |||
74 | li t1, ~ST0_CU1 | 73 | li t1, ~ST0_CU1 |
75 | and t0, t0, t1 | 74 | and t0, t0, t1 |
76 | sw t0, ST_OFF(t3) | 75 | sw t0, ST_OFF(t3) |
76 | /* clear thread_struct CU1 bit */ | ||
77 | and t2, t1 | ||
77 | 78 | ||
78 | fpu_save_single a0, t0 # clobbers t0 | 79 | fpu_save_single a0, t0 # clobbers t0 |
79 | 80 | ||
80 | 1: | 81 | 1: |
82 | sw t2, THREAD_STATUS(a0) | ||
81 | /* | 83 | /* |
82 | * The order of restoring the registers takes care of the race | 84 | * The order of restoring the registers takes care of the race |
83 | * updating $28, $29 and kernelsp without disabling ints. | 85 | * updating $28, $29 and kernelsp without disabling ints. |
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index 59c1577ecbb3..dbd42adc52ed 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S | |||
@@ -114,14 +114,6 @@ LEAF(_save_fp_context32) | |||
114 | */ | 114 | */ |
115 | LEAF(_restore_fp_context) | 115 | LEAF(_restore_fp_context) |
116 | EX lw t0, SC_FPC_CSR(a0) | 116 | EX lw t0, SC_FPC_CSR(a0) |
117 | |||
118 | /* Fail if the CSR has exceptions pending */ | ||
119 | srl t1, t0, 5 | ||
120 | and t1, t0 | ||
121 | andi t1, 0x1f << 7 | ||
122 | bnez t1, fault | ||
123 | nop | ||
124 | |||
125 | #ifdef CONFIG_64BIT | 117 | #ifdef CONFIG_64BIT |
126 | EX ldc1 $f1, SC_FPREGS+8(a0) | 118 | EX ldc1 $f1, SC_FPREGS+8(a0) |
127 | EX ldc1 $f3, SC_FPREGS+24(a0) | 119 | EX ldc1 $f3, SC_FPREGS+24(a0) |
@@ -165,14 +157,6 @@ LEAF(_restore_fp_context) | |||
165 | LEAF(_restore_fp_context32) | 157 | LEAF(_restore_fp_context32) |
166 | /* Restore an o32 sigcontext. */ | 158 | /* Restore an o32 sigcontext. */ |
167 | EX lw t0, SC32_FPC_CSR(a0) | 159 | EX lw t0, SC32_FPC_CSR(a0) |
168 | |||
169 | /* Fail if the CSR has exceptions pending */ | ||
170 | srl t1, t0, 5 | ||
171 | and t1, t0 | ||
172 | andi t1, 0x1f << 7 | ||
173 | bnez t1, fault | ||
174 | nop | ||
175 | |||
176 | EX ldc1 $f0, SC32_FPREGS+0(a0) | 160 | EX ldc1 $f0, SC32_FPREGS+0(a0) |
177 | EX ldc1 $f2, SC32_FPREGS+16(a0) | 161 | EX ldc1 $f2, SC32_FPREGS+16(a0) |
178 | EX ldc1 $f4, SC32_FPREGS+32(a0) | 162 | EX ldc1 $f4, SC32_FPREGS+32(a0) |
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S index cc566cf12246..c7698fd9955c 100644 --- a/arch/mips/kernel/r4k_switch.S +++ b/arch/mips/kernel/r4k_switch.S | |||
@@ -48,8 +48,7 @@ | |||
48 | #ifndef CONFIG_CPU_HAS_LLSC | 48 | #ifndef CONFIG_CPU_HAS_LLSC |
49 | sw zero, ll_bit | 49 | sw zero, ll_bit |
50 | #endif | 50 | #endif |
51 | mfc0 t1, CP0_STATUS | 51 | mfc0 t2, CP0_STATUS |
52 | LONG_S t1, THREAD_STATUS(a0) | ||
53 | cpu_save_nonscratch a0 | 52 | cpu_save_nonscratch a0 |
54 | LONG_S ra, THREAD_REG31(a0) | 53 | LONG_S ra, THREAD_REG31(a0) |
55 | 54 | ||
@@ -59,8 +58,8 @@ | |||
59 | PTR_L t3, TASK_THREAD_INFO(a0) | 58 | PTR_L t3, TASK_THREAD_INFO(a0) |
60 | LONG_L t0, TI_FLAGS(t3) | 59 | LONG_L t0, TI_FLAGS(t3) |
61 | li t1, _TIF_USEDFPU | 60 | li t1, _TIF_USEDFPU |
62 | and t2, t0, t1 | 61 | and t1, t0 |
63 | beqz t2, 1f | 62 | beqz t1, 1f |
64 | nor t1, zero, t1 | 63 | nor t1, zero, t1 |
65 | 64 | ||
66 | and t0, t0, t1 | 65 | and t0, t0, t1 |
@@ -73,10 +72,13 @@ | |||
73 | li t1, ~ST0_CU1 | 72 | li t1, ~ST0_CU1 |
74 | and t0, t0, t1 | 73 | and t0, t0, t1 |
75 | LONG_S t0, ST_OFF(t3) | 74 | LONG_S t0, ST_OFF(t3) |
75 | /* clear thread_struct CU1 bit */ | ||
76 | and t2, t1 | ||
76 | 77 | ||
77 | fpu_save_double a0 t0 t1 # c0_status passed in t0 | 78 | fpu_save_double a0 t0 t1 # c0_status passed in t0 |
78 | # clobbers t1 | 79 | # clobbers t1 |
79 | 1: | 80 | 1: |
81 | LONG_S t2, THREAD_STATUS(a0) | ||
80 | 82 | ||
81 | /* | 83 | /* |
82 | * The order of restoring the registers takes care of the race | 84 | * The order of restoring the registers takes care of the race |
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index e14ae09eda2b..e6e3047151a6 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -54,6 +54,7 @@ static struct chan_waitqueues { | |||
54 | wait_queue_head_t rt_queue; | 54 | wait_queue_head_t rt_queue; |
55 | wait_queue_head_t lx_queue; | 55 | wait_queue_head_t lx_queue; |
56 | atomic_t in_open; | 56 | atomic_t in_open; |
57 | struct mutex mutex; | ||
57 | } channel_wqs[RTLX_CHANNELS]; | 58 | } channel_wqs[RTLX_CHANNELS]; |
58 | 59 | ||
59 | static struct irqaction irq; | 60 | static struct irqaction irq; |
@@ -146,7 +147,7 @@ static void stopping(int vpe) | |||
146 | 147 | ||
147 | int rtlx_open(int index, int can_sleep) | 148 | int rtlx_open(int index, int can_sleep) |
148 | { | 149 | { |
149 | volatile struct rtlx_info **p; | 150 | struct rtlx_info **p; |
150 | struct rtlx_channel *chan; | 151 | struct rtlx_channel *chan; |
151 | enum rtlx_state state; | 152 | enum rtlx_state state; |
152 | int ret = 0; | 153 | int ret = 0; |
@@ -179,13 +180,24 @@ int rtlx_open(int index, int can_sleep) | |||
179 | } | 180 | } |
180 | } | 181 | } |
181 | 182 | ||
183 | smp_rmb(); | ||
182 | if (*p == NULL) { | 184 | if (*p == NULL) { |
183 | if (can_sleep) { | 185 | if (can_sleep) { |
184 | __wait_event_interruptible(channel_wqs[index].lx_queue, | 186 | DEFINE_WAIT(wait); |
185 | *p != NULL, | 187 | |
186 | ret); | 188 | for (;;) { |
187 | if (ret) | 189 | prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE); |
190 | smp_rmb(); | ||
191 | if (*p != NULL) | ||
192 | break; | ||
193 | if (!signal_pending(current)) { | ||
194 | schedule(); | ||
195 | continue; | ||
196 | } | ||
197 | ret = -ERESTARTSYS; | ||
188 | goto out_fail; | 198 | goto out_fail; |
199 | } | ||
200 | finish_wait(&channel_wqs[index].lx_queue, &wait); | ||
189 | } else { | 201 | } else { |
190 | printk(" *vpe_get_shared is NULL. " | 202 | printk(" *vpe_get_shared is NULL. " |
191 | "Has an SP program been loaded?\n"); | 203 | "Has an SP program been loaded?\n"); |
@@ -277,56 +289,52 @@ unsigned int rtlx_write_poll(int index) | |||
277 | return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); | 289 | return write_spacefree(chan->rt_read, chan->rt_write, chan->buffer_size); |
278 | } | 290 | } |
279 | 291 | ||
280 | static inline void copy_to(void *dst, void *src, size_t count, int user) | 292 | ssize_t rtlx_read(int index, void __user *buff, size_t count, int user) |
281 | { | ||
282 | if (user) | ||
283 | copy_to_user(dst, src, count); | ||
284 | else | ||
285 | memcpy(dst, src, count); | ||
286 | } | ||
287 | |||
288 | static inline void copy_from(void *dst, void *src, size_t count, int user) | ||
289 | { | 293 | { |
290 | if (user) | 294 | size_t lx_write, fl = 0L; |
291 | copy_from_user(dst, src, count); | ||
292 | else | ||
293 | memcpy(dst, src, count); | ||
294 | } | ||
295 | |||
296 | ssize_t rtlx_read(int index, void *buff, size_t count, int user) | ||
297 | { | ||
298 | size_t fl = 0L; | ||
299 | struct rtlx_channel *lx; | 295 | struct rtlx_channel *lx; |
296 | unsigned long failed; | ||
300 | 297 | ||
301 | if (rtlx == NULL) | 298 | if (rtlx == NULL) |
302 | return -ENOSYS; | 299 | return -ENOSYS; |
303 | 300 | ||
304 | lx = &rtlx->channel[index]; | 301 | lx = &rtlx->channel[index]; |
305 | 302 | ||
303 | mutex_lock(&channel_wqs[index].mutex); | ||
304 | smp_rmb(); | ||
305 | lx_write = lx->lx_write; | ||
306 | |||
306 | /* find out how much in total */ | 307 | /* find out how much in total */ |
307 | count = min(count, | 308 | count = min(count, |
308 | (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read) | 309 | (size_t)(lx_write + lx->buffer_size - lx->lx_read) |
309 | % lx->buffer_size); | 310 | % lx->buffer_size); |
310 | 311 | ||
311 | /* then how much from the read pointer onwards */ | 312 | /* then how much from the read pointer onwards */ |
312 | fl = min( count, (size_t)lx->buffer_size - lx->lx_read); | 313 | fl = min(count, (size_t)lx->buffer_size - lx->lx_read); |
313 | 314 | ||
314 | copy_to(buff, &lx->lx_buffer[lx->lx_read], fl, user); | 315 | failed = copy_to_user(buff, lx->lx_buffer + lx->lx_read, fl); |
316 | if (failed) | ||
317 | goto out; | ||
315 | 318 | ||
316 | /* and if there is anything left at the beginning of the buffer */ | 319 | /* and if there is anything left at the beginning of the buffer */ |
317 | if ( count - fl ) | 320 | if (count - fl) |
318 | copy_to (buff + fl, lx->lx_buffer, count - fl, user); | 321 | failed = copy_to_user(buff + fl, lx->lx_buffer, count - fl); |
319 | 322 | ||
320 | /* update the index */ | 323 | out: |
321 | lx->lx_read += count; | 324 | count -= failed; |
322 | lx->lx_read %= lx->buffer_size; | 325 | |
326 | smp_wmb(); | ||
327 | lx->lx_read = (lx->lx_read + count) % lx->buffer_size; | ||
328 | smp_wmb(); | ||
329 | mutex_unlock(&channel_wqs[index].mutex); | ||
323 | 330 | ||
324 | return count; | 331 | return count; |
325 | } | 332 | } |
326 | 333 | ||
327 | ssize_t rtlx_write(int index, void *buffer, size_t count, int user) | 334 | ssize_t rtlx_write(int index, const void __user *buffer, size_t count, int user) |
328 | { | 335 | { |
329 | struct rtlx_channel *rt; | 336 | struct rtlx_channel *rt; |
337 | size_t rt_read; | ||
330 | size_t fl; | 338 | size_t fl; |
331 | 339 | ||
332 | if (rtlx == NULL) | 340 | if (rtlx == NULL) |
@@ -334,24 +342,35 @@ ssize_t rtlx_write(int index, void *buffer, size_t count, int user) | |||
334 | 342 | ||
335 | rt = &rtlx->channel[index]; | 343 | rt = &rtlx->channel[index]; |
336 | 344 | ||
345 | mutex_lock(&channel_wqs[index].mutex); | ||
346 | smp_rmb(); | ||
347 | rt_read = rt->rt_read; | ||
348 | |||
337 | /* total number of bytes to copy */ | 349 | /* total number of bytes to copy */ |
338 | count = min(count, | 350 | count = min(count, |
339 | (size_t)write_spacefree(rt->rt_read, rt->rt_write, | 351 | (size_t)write_spacefree(rt_read, rt->rt_write, rt->buffer_size)); |
340 | rt->buffer_size)); | ||
341 | 352 | ||
342 | /* first bit from write pointer to the end of the buffer, or count */ | 353 | /* first bit from write pointer to the end of the buffer, or count */ |
343 | fl = min(count, (size_t) rt->buffer_size - rt->rt_write); | 354 | fl = min(count, (size_t) rt->buffer_size - rt->rt_write); |
344 | 355 | ||
345 | copy_from (&rt->rt_buffer[rt->rt_write], buffer, fl, user); | 356 | failed = copy_from_user(rt->rt_buffer + rt->rt_write, buffer, fl); |
357 | if (failed) | ||
358 | goto out; | ||
346 | 359 | ||
347 | /* if there's any left copy to the beginning of the buffer */ | 360 | /* if there's any left copy to the beginning of the buffer */ |
348 | if( count - fl ) | 361 | if (count - fl) { |
349 | copy_from (rt->rt_buffer, buffer + fl, count - fl, user); | 362 | failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl); |
363 | } | ||
364 | |||
365 | out: | ||
366 | count -= cailed; | ||
350 | 367 | ||
351 | rt->rt_write += count; | 368 | smp_wmb(); |
352 | rt->rt_write %= rt->buffer_size; | 369 | rt->rt_write = (rt->rt_write + count) % rt->buffer_size; |
370 | smp_wmb(); | ||
371 | mutex_unlock(&channel_wqs[index].mutex); | ||
353 | 372 | ||
354 | return(count); | 373 | return count; |
355 | } | 374 | } |
356 | 375 | ||
357 | 376 | ||
@@ -403,7 +422,7 @@ static ssize_t file_read(struct file *file, char __user * buffer, size_t count, | |||
403 | return 0; // -EAGAIN makes cat whinge | 422 | return 0; // -EAGAIN makes cat whinge |
404 | } | 423 | } |
405 | 424 | ||
406 | return rtlx_read(minor, buffer, count, 1); | 425 | return rtlx_read(minor, buffer, count); |
407 | } | 426 | } |
408 | 427 | ||
409 | static ssize_t file_write(struct file *file, const char __user * buffer, | 428 | static ssize_t file_write(struct file *file, const char __user * buffer, |
@@ -429,7 +448,7 @@ static ssize_t file_write(struct file *file, const char __user * buffer, | |||
429 | return ret; | 448 | return ret; |
430 | } | 449 | } |
431 | 450 | ||
432 | return rtlx_write(minor, (void *)buffer, count, 1); | 451 | return rtlx_write(minor, buffer, count); |
433 | } | 452 | } |
434 | 453 | ||
435 | static const struct file_operations rtlx_fops = { | 454 | static const struct file_operations rtlx_fops = { |
@@ -468,6 +487,7 @@ static int rtlx_module_init(void) | |||
468 | init_waitqueue_head(&channel_wqs[i].rt_queue); | 487 | init_waitqueue_head(&channel_wqs[i].rt_queue); |
469 | init_waitqueue_head(&channel_wqs[i].lx_queue); | 488 | init_waitqueue_head(&channel_wqs[i].lx_queue); |
470 | atomic_set(&channel_wqs[i].in_open, 0); | 489 | atomic_set(&channel_wqs[i].in_open, 0); |
490 | mutex_init(&channel_wqs[i].mutex); | ||
471 | 491 | ||
472 | dev = device_create(mt_class, NULL, MKDEV(major, i), | 492 | dev = device_create(mt_class, NULL, MKDEV(major, i), |
473 | "%s%d", module_name, i); | 493 | "%s%d", module_name, i); |
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h index fdbdbdc65b54..297dfcb97524 100644 --- a/arch/mips/kernel/signal-common.h +++ b/arch/mips/kernel/signal-common.h | |||
@@ -31,4 +31,7 @@ extern void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
31 | */ | 31 | */ |
32 | extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall); | 32 | extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall); |
33 | 33 | ||
34 | /* Check and clear pending FPU exceptions in saved CSR */ | ||
35 | extern int fpcsr_pending(unsigned int __user *fpcsr); | ||
36 | |||
34 | #endif /* __SIGNAL_COMMON_H */ | 37 | #endif /* __SIGNAL_COMMON_H */ |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index f091786187a6..8c3c5a5789b0 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -82,6 +82,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
82 | { | 82 | { |
83 | int err = 0; | 83 | int err = 0; |
84 | int i; | 84 | int i; |
85 | unsigned int used_math; | ||
85 | 86 | ||
86 | err |= __put_user(regs->cp0_epc, &sc->sc_pc); | 87 | err |= __put_user(regs->cp0_epc, &sc->sc_pc); |
87 | 88 | ||
@@ -104,26 +105,53 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
104 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); | 105 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); |
105 | } | 106 | } |
106 | 107 | ||
107 | err |= __put_user(!!used_math(), &sc->sc_used_math); | 108 | used_math = !!used_math(); |
109 | err |= __put_user(used_math, &sc->sc_used_math); | ||
108 | 110 | ||
109 | if (used_math()) { | 111 | if (used_math) { |
110 | /* | 112 | /* |
111 | * Save FPU state to signal context. Signal handler | 113 | * Save FPU state to signal context. Signal handler |
112 | * will "inherit" current FPU state. | 114 | * will "inherit" current FPU state. |
113 | */ | 115 | */ |
114 | preempt_disable(); | 116 | own_fpu(1); |
115 | 117 | enable_fp_in_kernel(); | |
116 | if (!is_fpu_owner()) { | ||
117 | own_fpu(); | ||
118 | restore_fp(current); | ||
119 | } | ||
120 | err |= save_fp_context(sc); | 118 | err |= save_fp_context(sc); |
121 | 119 | disable_fp_in_kernel(); | |
122 | preempt_enable(); | ||
123 | } | 120 | } |
124 | return err; | 121 | return err; |
125 | } | 122 | } |
126 | 123 | ||
124 | int fpcsr_pending(unsigned int __user *fpcsr) | ||
125 | { | ||
126 | int err, sig = 0; | ||
127 | unsigned int csr, enabled; | ||
128 | |||
129 | err = __get_user(csr, fpcsr); | ||
130 | enabled = FPU_CSR_UNI_X | ((csr & FPU_CSR_ALL_E) << 5); | ||
131 | /* | ||
132 | * If the signal handler set some FPU exceptions, clear it and | ||
133 | * send SIGFPE. | ||
134 | */ | ||
135 | if (csr & enabled) { | ||
136 | csr &= ~enabled; | ||
137 | err |= __put_user(csr, fpcsr); | ||
138 | sig = SIGFPE; | ||
139 | } | ||
140 | return err ?: sig; | ||
141 | } | ||
142 | |||
143 | static int | ||
144 | check_and_restore_fp_context(struct sigcontext __user *sc) | ||
145 | { | ||
146 | int err, sig; | ||
147 | |||
148 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); | ||
149 | if (err > 0) | ||
150 | err = 0; | ||
151 | err |= restore_fp_context(sc); | ||
152 | return err ?: sig; | ||
153 | } | ||
154 | |||
127 | int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | 155 | int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) |
128 | { | 156 | { |
129 | unsigned int used_math; | 157 | unsigned int used_math; |
@@ -157,19 +185,18 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
157 | err |= __get_user(used_math, &sc->sc_used_math); | 185 | err |= __get_user(used_math, &sc->sc_used_math); |
158 | conditional_used_math(used_math); | 186 | conditional_used_math(used_math); |
159 | 187 | ||
160 | preempt_disable(); | 188 | if (used_math) { |
161 | |||
162 | if (used_math()) { | ||
163 | /* restore fpu context if we have used it before */ | 189 | /* restore fpu context if we have used it before */ |
164 | own_fpu(); | 190 | own_fpu(0); |
165 | err |= restore_fp_context(sc); | 191 | enable_fp_in_kernel(); |
192 | if (!err) | ||
193 | err = check_and_restore_fp_context(sc); | ||
194 | disable_fp_in_kernel(); | ||
166 | } else { | 195 | } else { |
167 | /* signal handler may have used FPU. Give it up. */ | 196 | /* signal handler may have used FPU. Give it up. */ |
168 | lose_fpu(); | 197 | lose_fpu(0); |
169 | } | 198 | } |
170 | 199 | ||
171 | preempt_enable(); | ||
172 | |||
173 | return err; | 200 | return err; |
174 | } | 201 | } |
175 | 202 | ||
@@ -332,6 +359,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
332 | { | 359 | { |
333 | struct sigframe __user *frame; | 360 | struct sigframe __user *frame; |
334 | sigset_t blocked; | 361 | sigset_t blocked; |
362 | int sig; | ||
335 | 363 | ||
336 | frame = (struct sigframe __user *) regs.regs[29]; | 364 | frame = (struct sigframe __user *) regs.regs[29]; |
337 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 365 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -345,8 +373,11 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
345 | recalc_sigpending(); | 373 | recalc_sigpending(); |
346 | spin_unlock_irq(¤t->sighand->siglock); | 374 | spin_unlock_irq(¤t->sighand->siglock); |
347 | 375 | ||
348 | if (restore_sigcontext(®s, &frame->sf_sc)) | 376 | sig = restore_sigcontext(®s, &frame->sf_sc); |
377 | if (sig < 0) | ||
349 | goto badframe; | 378 | goto badframe; |
379 | else if (sig) | ||
380 | force_sig(sig, current); | ||
350 | 381 | ||
351 | /* | 382 | /* |
352 | * Don't let your children do this ... | 383 | * Don't let your children do this ... |
@@ -368,6 +399,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
368 | struct rt_sigframe __user *frame; | 399 | struct rt_sigframe __user *frame; |
369 | sigset_t set; | 400 | sigset_t set; |
370 | stack_t st; | 401 | stack_t st; |
402 | int sig; | ||
371 | 403 | ||
372 | frame = (struct rt_sigframe __user *) regs.regs[29]; | 404 | frame = (struct rt_sigframe __user *) regs.regs[29]; |
373 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 405 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -381,8 +413,11 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
381 | recalc_sigpending(); | 413 | recalc_sigpending(); |
382 | spin_unlock_irq(¤t->sighand->siglock); | 414 | spin_unlock_irq(¤t->sighand->siglock); |
383 | 415 | ||
384 | if (restore_sigcontext(®s, &frame->rs_uc.uc_mcontext)) | 416 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
417 | if (sig < 0) | ||
385 | goto badframe; | 418 | goto badframe; |
419 | else if (sig) | ||
420 | force_sig(sig, current); | ||
386 | 421 | ||
387 | if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) | 422 | if (__copy_from_user(&st, &frame->rs_uc.uc_stack, sizeof(st))) |
388 | goto badframe; | 423 | goto badframe; |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 19bbef001959..151fd2f0893a 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -181,6 +181,7 @@ static int setup_sigcontext32(struct pt_regs *regs, | |||
181 | { | 181 | { |
182 | int err = 0; | 182 | int err = 0; |
183 | int i; | 183 | int i; |
184 | u32 used_math; | ||
184 | 185 | ||
185 | err |= __put_user(regs->cp0_epc, &sc->sc_pc); | 186 | err |= __put_user(regs->cp0_epc, &sc->sc_pc); |
186 | 187 | ||
@@ -200,26 +201,34 @@ static int setup_sigcontext32(struct pt_regs *regs, | |||
200 | err |= __put_user(mflo3(), &sc->sc_lo3); | 201 | err |= __put_user(mflo3(), &sc->sc_lo3); |
201 | } | 202 | } |
202 | 203 | ||
203 | err |= __put_user(!!used_math(), &sc->sc_used_math); | 204 | used_math = !!used_math(); |
205 | err |= __put_user(used_math, &sc->sc_used_math); | ||
204 | 206 | ||
205 | if (used_math()) { | 207 | if (used_math) { |
206 | /* | 208 | /* |
207 | * Save FPU state to signal context. Signal handler | 209 | * Save FPU state to signal context. Signal handler |
208 | * will "inherit" current FPU state. | 210 | * will "inherit" current FPU state. |
209 | */ | 211 | */ |
210 | preempt_disable(); | 212 | own_fpu(1); |
211 | 213 | enable_fp_in_kernel(); | |
212 | if (!is_fpu_owner()) { | ||
213 | own_fpu(); | ||
214 | restore_fp(current); | ||
215 | } | ||
216 | err |= save_fp_context32(sc); | 214 | err |= save_fp_context32(sc); |
217 | 215 | disable_fp_in_kernel(); | |
218 | preempt_enable(); | ||
219 | } | 216 | } |
220 | return err; | 217 | return err; |
221 | } | 218 | } |
222 | 219 | ||
220 | static int | ||
221 | check_and_restore_fp_context32(struct sigcontext32 __user *sc) | ||
222 | { | ||
223 | int err, sig; | ||
224 | |||
225 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); | ||
226 | if (err > 0) | ||
227 | err = 0; | ||
228 | err |= restore_fp_context32(sc); | ||
229 | return err ?: sig; | ||
230 | } | ||
231 | |||
223 | static int restore_sigcontext32(struct pt_regs *regs, | 232 | static int restore_sigcontext32(struct pt_regs *regs, |
224 | struct sigcontext32 __user *sc) | 233 | struct sigcontext32 __user *sc) |
225 | { | 234 | { |
@@ -250,19 +259,18 @@ static int restore_sigcontext32(struct pt_regs *regs, | |||
250 | err |= __get_user(used_math, &sc->sc_used_math); | 259 | err |= __get_user(used_math, &sc->sc_used_math); |
251 | conditional_used_math(used_math); | 260 | conditional_used_math(used_math); |
252 | 261 | ||
253 | preempt_disable(); | 262 | if (used_math) { |
254 | |||
255 | if (used_math()) { | ||
256 | /* restore fpu context if we have used it before */ | 263 | /* restore fpu context if we have used it before */ |
257 | own_fpu(); | 264 | own_fpu(0); |
258 | err |= restore_fp_context32(sc); | 265 | enable_fp_in_kernel(); |
266 | if (!err) | ||
267 | err = check_and_restore_fp_context32(sc); | ||
268 | disable_fp_in_kernel(); | ||
259 | } else { | 269 | } else { |
260 | /* signal handler may have used FPU. Give it up. */ | 270 | /* signal handler may have used FPU. Give it up. */ |
261 | lose_fpu(); | 271 | lose_fpu(0); |
262 | } | 272 | } |
263 | 273 | ||
264 | preempt_enable(); | ||
265 | |||
266 | return err; | 274 | return err; |
267 | } | 275 | } |
268 | 276 | ||
@@ -508,6 +516,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
508 | { | 516 | { |
509 | struct sigframe32 __user *frame; | 517 | struct sigframe32 __user *frame; |
510 | sigset_t blocked; | 518 | sigset_t blocked; |
519 | int sig; | ||
511 | 520 | ||
512 | frame = (struct sigframe32 __user *) regs.regs[29]; | 521 | frame = (struct sigframe32 __user *) regs.regs[29]; |
513 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 522 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -521,8 +530,11 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
521 | recalc_sigpending(); | 530 | recalc_sigpending(); |
522 | spin_unlock_irq(¤t->sighand->siglock); | 531 | spin_unlock_irq(¤t->sighand->siglock); |
523 | 532 | ||
524 | if (restore_sigcontext32(®s, &frame->sf_sc)) | 533 | sig = restore_sigcontext32(®s, &frame->sf_sc); |
534 | if (sig < 0) | ||
525 | goto badframe; | 535 | goto badframe; |
536 | else if (sig) | ||
537 | force_sig(sig, current); | ||
526 | 538 | ||
527 | /* | 539 | /* |
528 | * Don't let your children do this ... | 540 | * Don't let your children do this ... |
@@ -545,6 +557,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
545 | sigset_t set; | 557 | sigset_t set; |
546 | stack_t st; | 558 | stack_t st; |
547 | s32 sp; | 559 | s32 sp; |
560 | int sig; | ||
548 | 561 | ||
549 | frame = (struct rt_sigframe32 __user *) regs.regs[29]; | 562 | frame = (struct rt_sigframe32 __user *) regs.regs[29]; |
550 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 563 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -558,8 +571,11 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
558 | recalc_sigpending(); | 571 | recalc_sigpending(); |
559 | spin_unlock_irq(¤t->sighand->siglock); | 572 | spin_unlock_irq(¤t->sighand->siglock); |
560 | 573 | ||
561 | if (restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext)) | 574 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); |
575 | if (sig < 0) | ||
562 | goto badframe; | 576 | goto badframe; |
577 | else if (sig) | ||
578 | force_sig(sig, current); | ||
563 | 579 | ||
564 | /* The ucontext contains a stack32_t, so we must convert! */ | 580 | /* The ucontext contains a stack32_t, so we must convert! */ |
565 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) | 581 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index ecf1f7ecaad9..a9202fa95987 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
@@ -127,6 +127,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
127 | sigset_t set; | 127 | sigset_t set; |
128 | stack_t st; | 128 | stack_t st; |
129 | s32 sp; | 129 | s32 sp; |
130 | int sig; | ||
130 | 131 | ||
131 | frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; | 132 | frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; |
132 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 133 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -140,8 +141,11 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
140 | recalc_sigpending(); | 141 | recalc_sigpending(); |
141 | spin_unlock_irq(¤t->sighand->siglock); | 142 | spin_unlock_irq(¤t->sighand->siglock); |
142 | 143 | ||
143 | if (restore_sigcontext(®s, &frame->rs_uc.uc_mcontext)) | 144 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
145 | if (sig < 0) | ||
144 | goto badframe; | 146 | goto badframe; |
147 | else if (sig) | ||
148 | force_sig(sig, current); | ||
145 | 149 | ||
146 | /* The ucontext contains a stack32_t, so we must convert! */ | 150 | /* The ucontext contains a stack32_t, so we must convert! */ |
147 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) | 151 | if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp)) |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 18f56a9dbcfa..7d76a85422b2 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -610,16 +610,6 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | |||
610 | if (fcr31 & FPU_CSR_UNI_X) { | 610 | if (fcr31 & FPU_CSR_UNI_X) { |
611 | int sig; | 611 | int sig; |
612 | 612 | ||
613 | preempt_disable(); | ||
614 | |||
615 | #ifdef CONFIG_PREEMPT | ||
616 | if (!is_fpu_owner()) { | ||
617 | /* We might lose fpu before disabling preempt... */ | ||
618 | own_fpu(); | ||
619 | BUG_ON(!used_math()); | ||
620 | restore_fp(current); | ||
621 | } | ||
622 | #endif | ||
623 | /* | 613 | /* |
624 | * Unimplemented operation exception. If we've got the full | 614 | * Unimplemented operation exception. If we've got the full |
625 | * software emulator on-board, let's use it... | 615 | * software emulator on-board, let's use it... |
@@ -630,18 +620,12 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | |||
630 | * register operands before invoking the emulator, which seems | 620 | * register operands before invoking the emulator, which seems |
631 | * a bit extreme for what should be an infrequent event. | 621 | * a bit extreme for what should be an infrequent event. |
632 | */ | 622 | */ |
633 | save_fp(current); | ||
634 | /* Ensure 'resume' not overwrite saved fp context again. */ | 623 | /* Ensure 'resume' not overwrite saved fp context again. */ |
635 | lose_fpu(); | 624 | lose_fpu(1); |
636 | |||
637 | preempt_enable(); | ||
638 | 625 | ||
639 | /* Run the emulator */ | 626 | /* Run the emulator */ |
640 | sig = fpu_emulator_cop1Handler (regs, ¤t->thread.fpu, 1); | 627 | sig = fpu_emulator_cop1Handler (regs, ¤t->thread.fpu, 1); |
641 | 628 | ||
642 | preempt_disable(); | ||
643 | |||
644 | own_fpu(); /* Using the FPU again. */ | ||
645 | /* | 629 | /* |
646 | * We can't allow the emulated instruction to leave any of | 630 | * We can't allow the emulated instruction to leave any of |
647 | * the cause bit set in $fcr31. | 631 | * the cause bit set in $fcr31. |
@@ -649,9 +633,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) | |||
649 | current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; | 633 | current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; |
650 | 634 | ||
651 | /* Restore the hardware register state */ | 635 | /* Restore the hardware register state */ |
652 | restore_fp(current); | 636 | own_fpu(1); /* Using the FPU again. */ |
653 | |||
654 | preempt_enable(); | ||
655 | 637 | ||
656 | /* If something went wrong, signal */ | 638 | /* If something went wrong, signal */ |
657 | if (sig) | 639 | if (sig) |
@@ -775,12 +757,11 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
775 | { | 757 | { |
776 | unsigned int cpid; | 758 | unsigned int cpid; |
777 | 759 | ||
778 | die_if_kernel("do_cpu invoked from kernel context!", regs); | ||
779 | |||
780 | cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; | 760 | cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; |
781 | 761 | ||
782 | switch (cpid) { | 762 | switch (cpid) { |
783 | case 0: | 763 | case 0: |
764 | die_if_kernel("do_cpu invoked from kernel context!", regs); | ||
784 | if (!cpu_has_llsc) | 765 | if (!cpu_has_llsc) |
785 | if (!simulate_llsc(regs)) | 766 | if (!simulate_llsc(regs)) |
786 | return; | 767 | return; |
@@ -791,21 +772,30 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
791 | break; | 772 | break; |
792 | 773 | ||
793 | case 1: | 774 | case 1: |
794 | preempt_disable(); | 775 | if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) |
795 | 776 | die_if_kernel("do_cpu invoked from kernel context!", | |
796 | own_fpu(); | 777 | regs); |
797 | if (used_math()) { /* Using the FPU again. */ | 778 | if (used_math()) /* Using the FPU again. */ |
798 | restore_fp(current); | 779 | own_fpu(1); |
799 | } else { /* First time FPU user. */ | 780 | else { /* First time FPU user. */ |
800 | init_fpu(); | 781 | init_fpu(); |
801 | set_used_math(); | 782 | set_used_math(); |
802 | } | 783 | } |
803 | 784 | ||
804 | if (cpu_has_fpu) { | 785 | if (raw_cpu_has_fpu) { |
805 | preempt_enable(); | 786 | if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) { |
787 | local_irq_disable(); | ||
788 | if (cpu_has_fpu) | ||
789 | regs->cp0_status |= ST0_CU1; | ||
790 | /* | ||
791 | * We must return without enabling | ||
792 | * interrupts to ensure keep FPU | ||
793 | * ownership until resume. | ||
794 | */ | ||
795 | return; | ||
796 | } | ||
806 | } else { | 797 | } else { |
807 | int sig; | 798 | int sig; |
808 | preempt_enable(); | ||
809 | sig = fpu_emulator_cop1Handler(regs, | 799 | sig = fpu_emulator_cop1Handler(regs, |
810 | ¤t->thread.fpu, 0); | 800 | ¤t->thread.fpu, 0); |
811 | if (sig) | 801 | if (sig) |
@@ -1259,26 +1249,26 @@ static inline void mips_srs_init(void) | |||
1259 | /* | 1249 | /* |
1260 | * This is used by native signal handling | 1250 | * This is used by native signal handling |
1261 | */ | 1251 | */ |
1262 | asmlinkage int (*save_fp_context)(struct sigcontext *sc); | 1252 | asmlinkage int (*save_fp_context)(struct sigcontext __user *sc); |
1263 | asmlinkage int (*restore_fp_context)(struct sigcontext *sc); | 1253 | asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc); |
1264 | 1254 | ||
1265 | extern asmlinkage int _save_fp_context(struct sigcontext *sc); | 1255 | extern asmlinkage int _save_fp_context(struct sigcontext __user *sc); |
1266 | extern asmlinkage int _restore_fp_context(struct sigcontext *sc); | 1256 | extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc); |
1267 | 1257 | ||
1268 | extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc); | 1258 | extern asmlinkage int fpu_emulator_save_context(struct sigcontext __user *sc); |
1269 | extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc); | 1259 | extern asmlinkage int fpu_emulator_restore_context(struct sigcontext __user *sc); |
1270 | 1260 | ||
1271 | #ifdef CONFIG_SMP | 1261 | #ifdef CONFIG_SMP |
1272 | static int smp_save_fp_context(struct sigcontext *sc) | 1262 | static int smp_save_fp_context(struct sigcontext __user *sc) |
1273 | { | 1263 | { |
1274 | return cpu_has_fpu | 1264 | return raw_cpu_has_fpu |
1275 | ? _save_fp_context(sc) | 1265 | ? _save_fp_context(sc) |
1276 | : fpu_emulator_save_context(sc); | 1266 | : fpu_emulator_save_context(sc); |
1277 | } | 1267 | } |
1278 | 1268 | ||
1279 | static int smp_restore_fp_context(struct sigcontext *sc) | 1269 | static int smp_restore_fp_context(struct sigcontext __user *sc) |
1280 | { | 1270 | { |
1281 | return cpu_has_fpu | 1271 | return raw_cpu_has_fpu |
1282 | ? _restore_fp_context(sc) | 1272 | ? _restore_fp_context(sc) |
1283 | : fpu_emulator_restore_context(sc); | 1273 | : fpu_emulator_restore_context(sc); |
1284 | } | 1274 | } |
@@ -1306,14 +1296,14 @@ static inline void signal_init(void) | |||
1306 | /* | 1296 | /* |
1307 | * This is used by 32-bit signal stuff on the 64-bit kernel | 1297 | * This is used by 32-bit signal stuff on the 64-bit kernel |
1308 | */ | 1298 | */ |
1309 | asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc); | 1299 | asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc); |
1310 | asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc); | 1300 | asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc); |
1311 | 1301 | ||
1312 | extern asmlinkage int _save_fp_context32(struct sigcontext32 *sc); | 1302 | extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc); |
1313 | extern asmlinkage int _restore_fp_context32(struct sigcontext32 *sc); | 1303 | extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc); |
1314 | 1304 | ||
1315 | extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 *sc); | 1305 | extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 __user *sc); |
1316 | extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 *sc); | 1306 | extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user *sc); |
1317 | 1307 | ||
1318 | static inline void signal32_init(void) | 1308 | static inline void signal32_init(void) |
1319 | { | 1309 | { |
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c index 5b3390f64917..ed49ef01ac53 100644 --- a/arch/mips/math-emu/kernel_linkage.c +++ b/arch/mips/math-emu/kernel_linkage.c | |||
@@ -51,7 +51,7 @@ void fpu_emulator_init_fpu(void) | |||
51 | * with appropriate macros from uaccess.h | 51 | * with appropriate macros from uaccess.h |
52 | */ | 52 | */ |
53 | 53 | ||
54 | int fpu_emulator_save_context(struct sigcontext *sc) | 54 | int fpu_emulator_save_context(struct sigcontext __user *sc) |
55 | { | 55 | { |
56 | int i; | 56 | int i; |
57 | int err = 0; | 57 | int err = 0; |
@@ -65,7 +65,7 @@ int fpu_emulator_save_context(struct sigcontext *sc) | |||
65 | return err; | 65 | return err; |
66 | } | 66 | } |
67 | 67 | ||
68 | int fpu_emulator_restore_context(struct sigcontext *sc) | 68 | int fpu_emulator_restore_context(struct sigcontext __user *sc) |
69 | { | 69 | { |
70 | int i; | 70 | int i; |
71 | int err = 0; | 71 | int err = 0; |
@@ -84,7 +84,7 @@ int fpu_emulator_restore_context(struct sigcontext *sc) | |||
84 | * This is the o32 version | 84 | * This is the o32 version |
85 | */ | 85 | */ |
86 | 86 | ||
87 | int fpu_emulator_save_context32(struct sigcontext32 *sc) | 87 | int fpu_emulator_save_context32(struct sigcontext32 __user *sc) |
88 | { | 88 | { |
89 | int i; | 89 | int i; |
90 | int err = 0; | 90 | int err = 0; |
@@ -98,7 +98,7 @@ int fpu_emulator_save_context32(struct sigcontext32 *sc) | |||
98 | return err; | 98 | return err; |
99 | } | 99 | } |
100 | 100 | ||
101 | int fpu_emulator_restore_context32(struct sigcontext32 *sc) | 101 | int fpu_emulator_restore_context32(struct sigcontext32 __user *sc) |
102 | { | 102 | { |
103 | int i; | 103 | int i; |
104 | int err = 0; | 104 | int err = 0; |
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc64/kernel/ktlb.S index e492db845ea3..d4024ac0d619 100644 --- a/arch/sparc64/kernel/ktlb.S +++ b/arch/sparc64/kernel/ktlb.S | |||
@@ -138,9 +138,15 @@ kvmap_dtlb_4v: | |||
138 | brgez,pn %g4, kvmap_dtlb_nonlinear | 138 | brgez,pn %g4, kvmap_dtlb_nonlinear |
139 | nop | 139 | nop |
140 | 140 | ||
141 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
142 | /* Index through the base page size TSB even for linear | ||
143 | * mappings when using page allocation debugging. | ||
144 | */ | ||
145 | KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) | ||
146 | #else | ||
141 | /* Correct TAG_TARGET is already in %g6, check 4mb TSB. */ | 147 | /* Correct TAG_TARGET is already in %g6, check 4mb TSB. */ |
142 | KERN_TSB4M_LOOKUP_TL1(%g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) | 148 | KERN_TSB4M_LOOKUP_TL1(%g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) |
143 | 149 | #endif | |
144 | /* TSB entry address left in %g1, lookup linear PTE. | 150 | /* TSB entry address left in %g1, lookup linear PTE. |
145 | * Must preserve %g1 and %g6 (TAG). | 151 | * Must preserve %g1 and %g6 (TAG). |
146 | */ | 152 | */ |
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index b1a1ee0cc6bd..f146071a4b2a 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -59,8 +59,10 @@ unsigned long kern_linear_pte_xor[2] __read_mostly; | |||
59 | */ | 59 | */ |
60 | unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; | 60 | unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; |
61 | 61 | ||
62 | #ifndef CONFIG_DEBUG_PAGEALLOC | ||
62 | /* A special kernel TSB for 4MB and 256MB linear mappings. */ | 63 | /* A special kernel TSB for 4MB and 256MB linear mappings. */ |
63 | struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES]; | 64 | struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES]; |
65 | #endif | ||
64 | 66 | ||
65 | #define MAX_BANKS 32 | 67 | #define MAX_BANKS 32 |
66 | 68 | ||
@@ -1301,7 +1303,12 @@ static void __init tsb_phys_patch(void) | |||
1301 | } | 1303 | } |
1302 | 1304 | ||
1303 | /* Don't mark as init, we give this to the Hypervisor. */ | 1305 | /* Don't mark as init, we give this to the Hypervisor. */ |
1304 | static struct hv_tsb_descr ktsb_descr[2]; | 1306 | #ifndef CONFIG_DEBUG_PAGEALLOC |
1307 | #define NUM_KTSB_DESCR 2 | ||
1308 | #else | ||
1309 | #define NUM_KTSB_DESCR 1 | ||
1310 | #endif | ||
1311 | static struct hv_tsb_descr ktsb_descr[NUM_KTSB_DESCR]; | ||
1305 | extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; | 1312 | extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; |
1306 | 1313 | ||
1307 | static void __init sun4v_ktsb_init(void) | 1314 | static void __init sun4v_ktsb_init(void) |
@@ -1340,6 +1347,7 @@ static void __init sun4v_ktsb_init(void) | |||
1340 | ktsb_descr[0].tsb_base = ktsb_pa; | 1347 | ktsb_descr[0].tsb_base = ktsb_pa; |
1341 | ktsb_descr[0].resv = 0; | 1348 | ktsb_descr[0].resv = 0; |
1342 | 1349 | ||
1350 | #ifndef CONFIG_DEBUG_PAGEALLOC | ||
1343 | /* Second KTSB for 4MB/256MB mappings. */ | 1351 | /* Second KTSB for 4MB/256MB mappings. */ |
1344 | ktsb_pa = (kern_base + | 1352 | ktsb_pa = (kern_base + |
1345 | ((unsigned long)&swapper_4m_tsb[0] - KERNBASE)); | 1353 | ((unsigned long)&swapper_4m_tsb[0] - KERNBASE)); |
@@ -1352,6 +1360,7 @@ static void __init sun4v_ktsb_init(void) | |||
1352 | ktsb_descr[1].ctx_idx = 0; | 1360 | ktsb_descr[1].ctx_idx = 0; |
1353 | ktsb_descr[1].tsb_base = ktsb_pa; | 1361 | ktsb_descr[1].tsb_base = ktsb_pa; |
1354 | ktsb_descr[1].resv = 0; | 1362 | ktsb_descr[1].resv = 0; |
1363 | #endif | ||
1355 | } | 1364 | } |
1356 | 1365 | ||
1357 | void __cpuinit sun4v_ktsb_register(void) | 1366 | void __cpuinit sun4v_ktsb_register(void) |
@@ -1364,7 +1373,7 @@ void __cpuinit sun4v_ktsb_register(void) | |||
1364 | pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); | 1373 | pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); |
1365 | 1374 | ||
1366 | func = HV_FAST_MMU_TSB_CTX0; | 1375 | func = HV_FAST_MMU_TSB_CTX0; |
1367 | arg0 = 2; | 1376 | arg0 = NUM_KTSB_DESCR; |
1368 | arg1 = pa; | 1377 | arg1 = pa; |
1369 | __asm__ __volatile__("ta %6" | 1378 | __asm__ __volatile__("ta %6" |
1370 | : "=&r" (func), "=&r" (arg0), "=&r" (arg1) | 1379 | : "=&r" (func), "=&r" (arg0), "=&r" (arg1) |
@@ -1393,7 +1402,9 @@ void __init paging_init(void) | |||
1393 | 1402 | ||
1394 | /* Invalidate both kernel TSBs. */ | 1403 | /* Invalidate both kernel TSBs. */ |
1395 | memset(swapper_tsb, 0x40, sizeof(swapper_tsb)); | 1404 | memset(swapper_tsb, 0x40, sizeof(swapper_tsb)); |
1405 | #ifndef CONFIG_DEBUG_PAGEALLOC | ||
1396 | memset(swapper_4m_tsb, 0x40, sizeof(swapper_4m_tsb)); | 1406 | memset(swapper_4m_tsb, 0x40, sizeof(swapper_4m_tsb)); |
1407 | #endif | ||
1397 | 1408 | ||
1398 | if (tlb_type == hypervisor) | 1409 | if (tlb_type == hypervisor) |
1399 | sun4v_pgprot_init(); | 1410 | sun4v_pgprot_init(); |
@@ -1725,8 +1736,13 @@ static void __init sun4u_pgprot_init(void) | |||
1725 | pg_iobits = (_PAGE_VALID | _PAGE_PRESENT_4U | __DIRTY_BITS_4U | | 1736 | pg_iobits = (_PAGE_VALID | _PAGE_PRESENT_4U | __DIRTY_BITS_4U | |
1726 | __ACCESS_BITS_4U | _PAGE_E_4U); | 1737 | __ACCESS_BITS_4U | _PAGE_E_4U); |
1727 | 1738 | ||
1739 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
1740 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZBITS_4U) ^ | ||
1741 | 0xfffff80000000000; | ||
1742 | #else | ||
1728 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4U) ^ | 1743 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4U) ^ |
1729 | 0xfffff80000000000; | 1744 | 0xfffff80000000000; |
1745 | #endif | ||
1730 | kern_linear_pte_xor[0] |= (_PAGE_CP_4U | _PAGE_CV_4U | | 1746 | kern_linear_pte_xor[0] |= (_PAGE_CP_4U | _PAGE_CV_4U | |
1731 | _PAGE_P_4U | _PAGE_W_4U); | 1747 | _PAGE_P_4U | _PAGE_W_4U); |
1732 | 1748 | ||
@@ -1769,13 +1785,23 @@ static void __init sun4v_pgprot_init(void) | |||
1769 | _PAGE_E = _PAGE_E_4V; | 1785 | _PAGE_E = _PAGE_E_4V; |
1770 | _PAGE_CACHE = _PAGE_CACHE_4V; | 1786 | _PAGE_CACHE = _PAGE_CACHE_4V; |
1771 | 1787 | ||
1788 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
1789 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZBITS_4V) ^ | ||
1790 | 0xfffff80000000000; | ||
1791 | #else | ||
1772 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^ | 1792 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^ |
1773 | 0xfffff80000000000; | 1793 | 0xfffff80000000000; |
1794 | #endif | ||
1774 | kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V | | 1795 | kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V | |
1775 | _PAGE_P_4V | _PAGE_W_4V); | 1796 | _PAGE_P_4V | _PAGE_W_4V); |
1776 | 1797 | ||
1798 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
1799 | kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZBITS_4V) ^ | ||
1800 | 0xfffff80000000000; | ||
1801 | #else | ||
1777 | kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^ | 1802 | kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^ |
1778 | 0xfffff80000000000; | 1803 | 0xfffff80000000000; |
1804 | #endif | ||
1779 | kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V | | 1805 | kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V | |
1780 | _PAGE_P_4V | _PAGE_W_4V); | 1806 | _PAGE_P_4V | _PAGE_W_4V); |
1781 | 1807 | ||
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index 5f4fdcf7c96e..1f0962616ee5 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c | |||
@@ -11,9 +11,6 @@ | |||
11 | * March 2001: Ported from 2.0.34 by Liam Davies | 11 | * March 2001: Ported from 2.0.34 by Liam Davies |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | |||
15 | #define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */ | ||
16 | |||
17 | #include <linux/types.h> | 14 | #include <linux/types.h> |
18 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
19 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
@@ -32,8 +29,6 @@ | |||
32 | 29 | ||
33 | #include "lcd.h" | 30 | #include "lcd.h" |
34 | 31 | ||
35 | static DEFINE_SPINLOCK(lcd_lock); | ||
36 | |||
37 | static int lcd_ioctl(struct inode *inode, struct file *file, | 32 | static int lcd_ioctl(struct inode *inode, struct file *file, |
38 | unsigned int cmd, unsigned long arg); | 33 | unsigned int cmd, unsigned long arg); |
39 | 34 | ||
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index c3f8e383933b..1bbb45b937fd 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -724,6 +724,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | |||
724 | return -ENOMEM; | 724 | return -ENOMEM; |
725 | memset(vc, 0, sizeof(*vc)); | 725 | memset(vc, 0, sizeof(*vc)); |
726 | vc_cons[currcons].d = vc; | 726 | vc_cons[currcons].d = vc; |
727 | INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); | ||
727 | visual_init(vc, currcons, 1); | 728 | visual_init(vc, currcons, 1); |
728 | if (!*vc->vc_uni_pagedir_loc) | 729 | if (!*vc->vc_uni_pagedir_loc) |
729 | con_set_default_unimap(vc); | 730 | con_set_default_unimap(vc); |
@@ -2185,10 +2186,28 @@ static void console_callback(struct work_struct *ignored) | |||
2185 | release_console_sem(); | 2186 | release_console_sem(); |
2186 | } | 2187 | } |
2187 | 2188 | ||
2188 | void set_console(int nr) | 2189 | int set_console(int nr) |
2189 | { | 2190 | { |
2191 | struct vc_data *vc = vc_cons[fg_console].d; | ||
2192 | |||
2193 | if (!vc_cons_allocated(nr) || vt_dont_switch || | ||
2194 | (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { | ||
2195 | |||
2196 | /* | ||
2197 | * Console switch will fail in console_callback() or | ||
2198 | * change_console() so there is no point scheduling | ||
2199 | * the callback | ||
2200 | * | ||
2201 | * Existing set_console() users don't check the return | ||
2202 | * value so this shouldn't break anything | ||
2203 | */ | ||
2204 | return -EINVAL; | ||
2205 | } | ||
2206 | |||
2190 | want_console = nr; | 2207 | want_console = nr; |
2191 | schedule_console_callback(); | 2208 | schedule_console_callback(); |
2209 | |||
2210 | return 0; | ||
2192 | } | 2211 | } |
2193 | 2212 | ||
2194 | struct tty_driver *console_driver; | 2213 | struct tty_driver *console_driver; |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 3a5d301e783b..1fa2da8f4fbe 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/kbd_diacr.h> | 34 | #include <linux/kbd_diacr.h> |
35 | #include <linux/selection.h> | 35 | #include <linux/selection.h> |
36 | 36 | ||
37 | static char vt_dont_switch; | 37 | char vt_dont_switch; |
38 | extern struct tty_driver *console_driver; | 38 | extern struct tty_driver *console_driver; |
39 | 39 | ||
40 | #define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) | 40 | #define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 15278044295c..322ee2984e3d 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -176,6 +176,7 @@ void dma_chan_cleanup(struct kref *kref) | |||
176 | chan->client = NULL; | 176 | chan->client = NULL; |
177 | kref_put(&chan->device->refcount, dma_async_device_cleanup); | 177 | kref_put(&chan->device->refcount, dma_async_device_cleanup); |
178 | } | 178 | } |
179 | EXPORT_SYMBOL(dma_chan_cleanup); | ||
179 | 180 | ||
180 | static void dma_chan_free_rcu(struct rcu_head *rcu) | 181 | static void dma_chan_free_rcu(struct rcu_head *rcu) |
181 | { | 182 | { |
@@ -261,6 +262,7 @@ struct dma_client *dma_async_client_register(dma_event_callback event_callback) | |||
261 | 262 | ||
262 | return client; | 263 | return client; |
263 | } | 264 | } |
265 | EXPORT_SYMBOL(dma_async_client_register); | ||
264 | 266 | ||
265 | /** | 267 | /** |
266 | * dma_async_client_unregister - unregister a client and free the &dma_client | 268 | * dma_async_client_unregister - unregister a client and free the &dma_client |
@@ -287,6 +289,7 @@ void dma_async_client_unregister(struct dma_client *client) | |||
287 | kfree(client); | 289 | kfree(client); |
288 | dma_chans_rebalance(); | 290 | dma_chans_rebalance(); |
289 | } | 291 | } |
292 | EXPORT_SYMBOL(dma_async_client_unregister); | ||
290 | 293 | ||
291 | /** | 294 | /** |
292 | * dma_async_client_chan_request - request DMA channels | 295 | * dma_async_client_chan_request - request DMA channels |
@@ -304,6 +307,7 @@ void dma_async_client_chan_request(struct dma_client *client, | |||
304 | client->chans_desired = number; | 307 | client->chans_desired = number; |
305 | dma_chans_rebalance(); | 308 | dma_chans_rebalance(); |
306 | } | 309 | } |
310 | EXPORT_SYMBOL(dma_async_client_chan_request); | ||
307 | 311 | ||
308 | /** | 312 | /** |
309 | * dma_async_device_register - registers DMA devices found | 313 | * dma_async_device_register - registers DMA devices found |
@@ -346,6 +350,7 @@ int dma_async_device_register(struct dma_device *device) | |||
346 | 350 | ||
347 | return 0; | 351 | return 0; |
348 | } | 352 | } |
353 | EXPORT_SYMBOL(dma_async_device_register); | ||
349 | 354 | ||
350 | /** | 355 | /** |
351 | * dma_async_device_cleanup - function called when all references are released | 356 | * dma_async_device_cleanup - function called when all references are released |
@@ -390,23 +395,12 @@ void dma_async_device_unregister(struct dma_device *device) | |||
390 | kref_put(&device->refcount, dma_async_device_cleanup); | 395 | kref_put(&device->refcount, dma_async_device_cleanup); |
391 | wait_for_completion(&device->done); | 396 | wait_for_completion(&device->done); |
392 | } | 397 | } |
398 | EXPORT_SYMBOL(dma_async_device_unregister); | ||
393 | 399 | ||
394 | static int __init dma_bus_init(void) | 400 | static int __init dma_bus_init(void) |
395 | { | 401 | { |
396 | mutex_init(&dma_list_mutex); | 402 | mutex_init(&dma_list_mutex); |
397 | return class_register(&dma_devclass); | 403 | return class_register(&dma_devclass); |
398 | } | 404 | } |
399 | |||
400 | subsys_initcall(dma_bus_init); | 405 | subsys_initcall(dma_bus_init); |
401 | 406 | ||
402 | EXPORT_SYMBOL(dma_async_client_register); | ||
403 | EXPORT_SYMBOL(dma_async_client_unregister); | ||
404 | EXPORT_SYMBOL(dma_async_client_chan_request); | ||
405 | EXPORT_SYMBOL(dma_async_memcpy_buf_to_buf); | ||
406 | EXPORT_SYMBOL(dma_async_memcpy_buf_to_pg); | ||
407 | EXPORT_SYMBOL(dma_async_memcpy_pg_to_pg); | ||
408 | EXPORT_SYMBOL(dma_async_memcpy_complete); | ||
409 | EXPORT_SYMBOL(dma_async_memcpy_issue_pending); | ||
410 | EXPORT_SYMBOL(dma_async_device_register); | ||
411 | EXPORT_SYMBOL(dma_async_device_unregister); | ||
412 | EXPORT_SYMBOL(dma_chan_cleanup); | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index c3d4856fb618..6d105a1d41b1 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -527,6 +527,7 @@ config SENSORS_W83792D | |||
527 | config SENSORS_W83793 | 527 | config SENSORS_W83793 |
528 | tristate "Winbond W83793" | 528 | tristate "Winbond W83793" |
529 | depends on HWMON && I2C && EXPERIMENTAL | 529 | depends on HWMON && I2C && EXPERIMENTAL |
530 | select HWMON_VID | ||
530 | help | 531 | help |
531 | If you say yes here you get support for the Winbond W83793 | 532 | If you say yes here you get support for the Winbond W83793 |
532 | hardware monitoring chip. | 533 | hardware monitoring chip. |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index c625ddb8833d..d5ecd2d53046 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -188,7 +188,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
188 | for (i=0; i < cnt-1 ; i++) { | 188 | for (i=0; i < cnt-1 ; i++) { |
189 | sector_t sz = 0; | 189 | sector_t sz = 0; |
190 | int j; | 190 | int j; |
191 | for (j=i; i<cnt-1 && sz < min_spacing ; j++) | 191 | for (j = i; j < cnt - 1 && sz < min_spacing; j++) |
192 | sz += conf->disks[j].size; | 192 | sz += conf->disks[j].size; |
193 | if (sz >= min_spacing && sz < conf->hash_spacing) | 193 | if (sz >= min_spacing && sz < conf->hash_spacing) |
194 | conf->hash_spacing = sz; | 194 | conf->hash_spacing = sz; |
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 5026b345cb30..57e6ab1004d0 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -451,7 +451,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
451 | return -EINVAL; | 451 | return -EINVAL; |
452 | 452 | ||
453 | if(!pnp_can_configure(dev)) { | 453 | if(!pnp_can_configure(dev)) { |
454 | pnp_info("Device %s does not support resource configuration.", dev->dev.bus_id); | 454 | pnp_dbg("Device %s does not support resource configuration.", dev->dev.bus_id); |
455 | return -ENODEV; | 455 | return -ENODEV; |
456 | } | 456 | } |
457 | 457 | ||
@@ -482,7 +482,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
482 | int pnp_start_dev(struct pnp_dev *dev) | 482 | int pnp_start_dev(struct pnp_dev *dev) |
483 | { | 483 | { |
484 | if (!pnp_can_write(dev)) { | 484 | if (!pnp_can_write(dev)) { |
485 | pnp_info("Device %s does not support activation.", dev->dev.bus_id); | 485 | pnp_dbg("Device %s does not support activation.", dev->dev.bus_id); |
486 | return -EINVAL; | 486 | return -EINVAL; |
487 | } | 487 | } |
488 | 488 | ||
@@ -506,7 +506,7 @@ int pnp_start_dev(struct pnp_dev *dev) | |||
506 | int pnp_stop_dev(struct pnp_dev *dev) | 506 | int pnp_stop_dev(struct pnp_dev *dev) |
507 | { | 507 | { |
508 | if (!pnp_can_disable(dev)) { | 508 | if (!pnp_can_disable(dev)) { |
509 | pnp_info("Device %s does not support disabling.", dev->dev.bus_id); | 509 | pnp_dbg("Device %s does not support disabling.", dev->dev.bus_id); |
510 | return -EINVAL; | 510 | return -EINVAL; |
511 | } | 511 | } |
512 | if (dev->protocol->disable(dev)<0) { | 512 | if (dev->protocol->disable(dev)<0) { |
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index 48e4f48e779f..8efa07e8b8c2 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c | |||
@@ -291,7 +291,7 @@ static int at25_probe(struct spi_device *spi) | |||
291 | */ | 291 | */ |
292 | sr = spi_w8r8(spi, AT25_RDSR); | 292 | sr = spi_w8r8(spi, AT25_RDSR); |
293 | if (sr < 0 || sr & AT25_SR_nRDY) { | 293 | if (sr < 0 || sr & AT25_SR_nRDY) { |
294 | dev_dbg(&at25->spi->dev, "rdsr --> %d (%02x)\n", sr, sr); | 294 | dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr); |
295 | err = -ENXIO; | 295 | err = -ENXIO; |
296 | goto fail; | 296 | goto fail; |
297 | } | 297 | } |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 6fa260d1a9be..66e7bc985797 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -425,7 +425,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
425 | if (ret) | 425 | if (ret) |
426 | return ret; | 426 | return ret; |
427 | spi->controller_state = (void *)npcs_pin; | 427 | spi->controller_state = (void *)npcs_pin; |
428 | gpio_direction_output(npcs_pin); | 428 | gpio_direction_output(npcs_pin, !(spi->mode & SPI_CS_HIGH)); |
429 | } | 429 | } |
430 | 430 | ||
431 | dev_dbg(&spi->dev, | 431 | dev_dbg(&spi->dev, |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 24a330d82395..88425e1af4d3 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -302,10 +302,6 @@ static void bitbang_work(struct work_struct *work) | |||
302 | setup_transfer = NULL; | 302 | setup_transfer = NULL; |
303 | 303 | ||
304 | list_for_each_entry (t, &m->transfers, transfer_list) { | 304 | list_for_each_entry (t, &m->transfers, transfer_list) { |
305 | if (bitbang->shutdown) { | ||
306 | status = -ESHUTDOWN; | ||
307 | break; | ||
308 | } | ||
309 | 305 | ||
310 | /* override or restore speed and wordsize */ | 306 | /* override or restore speed and wordsize */ |
311 | if (t->speed_hz || t->bits_per_word) { | 307 | if (t->speed_hz || t->bits_per_word) { |
@@ -410,8 +406,6 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
410 | m->status = -EINPROGRESS; | 406 | m->status = -EINPROGRESS; |
411 | 407 | ||
412 | bitbang = spi_master_get_devdata(spi->master); | 408 | bitbang = spi_master_get_devdata(spi->master); |
413 | if (bitbang->shutdown) | ||
414 | return -ESHUTDOWN; | ||
415 | 409 | ||
416 | spin_lock_irqsave(&bitbang->lock, flags); | 410 | spin_lock_irqsave(&bitbang->lock, flags); |
417 | if (!spi->max_speed_hz) | 411 | if (!spi->max_speed_hz) |
@@ -507,28 +501,12 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start); | |||
507 | */ | 501 | */ |
508 | int spi_bitbang_stop(struct spi_bitbang *bitbang) | 502 | int spi_bitbang_stop(struct spi_bitbang *bitbang) |
509 | { | 503 | { |
510 | unsigned limit = 500; | 504 | spi_unregister_master(bitbang->master); |
511 | |||
512 | spin_lock_irq(&bitbang->lock); | ||
513 | bitbang->shutdown = 0; | ||
514 | while (!list_empty(&bitbang->queue) && limit--) { | ||
515 | spin_unlock_irq(&bitbang->lock); | ||
516 | 505 | ||
517 | dev_dbg(bitbang->master->cdev.dev, "wait for queue\n"); | 506 | WARN_ON(!list_empty(&bitbang->queue)); |
518 | msleep(10); | ||
519 | |||
520 | spin_lock_irq(&bitbang->lock); | ||
521 | } | ||
522 | spin_unlock_irq(&bitbang->lock); | ||
523 | if (!list_empty(&bitbang->queue)) { | ||
524 | dev_err(bitbang->master->cdev.dev, "queue didn't empty\n"); | ||
525 | return -EBUSY; | ||
526 | } | ||
527 | 507 | ||
528 | destroy_workqueue(bitbang->workqueue); | 508 | destroy_workqueue(bitbang->workqueue); |
529 | 509 | ||
530 | spi_unregister_master(bitbang->master); | ||
531 | |||
532 | return 0; | 510 | return 0; |
533 | } | 511 | } |
534 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); | 512 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 651379c51ae6..220abce63e4a 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -41,7 +41,7 @@ struct s3c24xx_spi { | |||
41 | int len; | 41 | int len; |
42 | int count; | 42 | int count; |
43 | 43 | ||
44 | int (*set_cs)(struct s3c2410_spi_info *spi, | 44 | void (*set_cs)(struct s3c2410_spi_info *spi, |
45 | int cs, int pol); | 45 | int cs, int pol); |
46 | 46 | ||
47 | /* data buffers */ | 47 | /* data buffers */ |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7f5a59836818..e4f0dd00ae85 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1320,7 +1320,7 @@ config FB_AU1100 | |||
1320 | 1320 | ||
1321 | config FB_AU1200 | 1321 | config FB_AU1200 |
1322 | bool "Au1200 LCD Driver" | 1322 | bool "Au1200 LCD Driver" |
1323 | depends on FB && MIPS && SOC_AU1200 | 1323 | depends on (FB = y) && MIPS && SOC_AU1200 |
1324 | select FB_CFB_FILLRECT | 1324 | select FB_CFB_FILLRECT |
1325 | select FB_CFB_COPYAREA | 1325 | select FB_CFB_COPYAREA |
1326 | select FB_CFB_IMAGEBLIT | 1326 | select FB_CFB_IMAGEBLIT |
@@ -1470,7 +1470,7 @@ config FB_G364 | |||
1470 | 1470 | ||
1471 | config FB_68328 | 1471 | config FB_68328 |
1472 | bool "Motorola 68328 native frame buffer support" | 1472 | bool "Motorola 68328 native frame buffer support" |
1473 | depends on FB && (M68328 || M68EZ328 || M68VZ328) | 1473 | depends on (FB = y) && (M68328 || M68EZ328 || M68VZ328) |
1474 | select FB_CFB_FILLRECT | 1474 | select FB_CFB_FILLRECT |
1475 | select FB_CFB_COPYAREA | 1475 | select FB_CFB_COPYAREA |
1476 | select FB_CFB_IMAGEBLIT | 1476 | select FB_CFB_IMAGEBLIT |
@@ -1616,7 +1616,7 @@ config FB_IBM_GXT4500 | |||
1616 | 1616 | ||
1617 | config FB_PS3 | 1617 | config FB_PS3 |
1618 | bool "PS3 GPU framebuffer driver" | 1618 | bool "PS3 GPU framebuffer driver" |
1619 | depends on FB && PS3_PS3AV | 1619 | depends on (FB = y) && PS3_PS3AV |
1620 | select FB_CFB_FILLRECT | 1620 | select FB_CFB_FILLRECT |
1621 | select FB_CFB_COPYAREA | 1621 | select FB_CFB_COPYAREA |
1622 | select FB_CFB_IMAGEBLIT | 1622 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 4afa30522fdb..0166ec2ccf32 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -384,6 +384,19 @@ SavageSetup2DEngine(struct savagefb_par *par) | |||
384 | BCI_SEND(0); | 384 | BCI_SEND(0); |
385 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); | 385 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); |
386 | BCI_SEND(GlobalBitmapDescriptor); | 386 | BCI_SEND(GlobalBitmapDescriptor); |
387 | |||
388 | /* | ||
389 | * I don't know why, sending this twice fixes the intial black screen, | ||
390 | * prevents X from crashing at least in Toshiba laptops with SavageIX. | ||
391 | * --Tony | ||
392 | */ | ||
393 | par->bci_ptr = 0; | ||
394 | par->SavageWaitFifo(par, 4); | ||
395 | |||
396 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD1); | ||
397 | BCI_SEND(0); | ||
398 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); | ||
399 | BCI_SEND(GlobalBitmapDescriptor); | ||
387 | } | 400 | } |
388 | 401 | ||
389 | static void savagefb_set_clip(struct fb_info *info) | 402 | static void savagefb_set_clip(struct fb_info *info) |
@@ -496,7 +509,7 @@ static int common_calc_clock(long freq, int min_m, int min_n1, int max_n1, | |||
496 | #ifdef SAVAGEFB_DEBUG | 509 | #ifdef SAVAGEFB_DEBUG |
497 | /* This function is used to debug, it prints out the contents of s3 regs */ | 510 | /* This function is used to debug, it prints out the contents of s3 regs */ |
498 | 511 | ||
499 | static void SavagePrintRegs(void) | 512 | static void SavagePrintRegs(struct savagefb_par *par) |
500 | { | 513 | { |
501 | unsigned char i; | 514 | unsigned char i; |
502 | int vgaCRIndex = 0x3d4; | 515 | int vgaCRIndex = 0x3d4; |
@@ -1525,7 +1538,7 @@ static int savagefb_set_par(struct fb_info *info) | |||
1525 | savagefb_set_fix(info); | 1538 | savagefb_set_fix(info); |
1526 | savagefb_set_clip(info); | 1539 | savagefb_set_clip(info); |
1527 | 1540 | ||
1528 | SavagePrintRegs(); | 1541 | SavagePrintRegs(par); |
1529 | return 0; | 1542 | return 0; |
1530 | } | 1543 | } |
1531 | 1544 | ||
@@ -2155,7 +2168,6 @@ static int __devinit savagefb_probe(struct pci_dev* dev, | |||
2155 | int video_len; | 2168 | int video_len; |
2156 | 2169 | ||
2157 | DBG("savagefb_probe"); | 2170 | DBG("savagefb_probe"); |
2158 | SavagePrintRegs(); | ||
2159 | 2171 | ||
2160 | info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev); | 2172 | info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev); |
2161 | if (!info) | 2173 | if (!info) |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 59cd1e750f30..62fa5500361d 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
@@ -257,6 +257,7 @@ static void __sst_dac_write(u8 __iomem *vbase, u8 reg, u8 val) | |||
257 | r_dprintk("sst_dac_write(%#x, %#x)\n", reg, val); | 257 | r_dprintk("sst_dac_write(%#x, %#x)\n", reg, val); |
258 | reg &= 0x07; | 258 | reg &= 0x07; |
259 | __sst_write(vbase, DAC_DATA,(((u32)reg << 8)) | (u32)val); | 259 | __sst_write(vbase, DAC_DATA,(((u32)reg << 8)) | (u32)val); |
260 | __sst_wait_idle(vbase); | ||
260 | } | 261 | } |
261 | 262 | ||
262 | /* indexed access to ti/att dacs */ | 263 | /* indexed access to ti/att dacs */ |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 51db1182b27e..a2fceba7ef8e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -507,7 +507,7 @@ out: | |||
507 | #define INTERPRETER_ELF 2 | 507 | #define INTERPRETER_ELF 2 |
508 | 508 | ||
509 | #ifndef STACK_RND_MASK | 509 | #ifndef STACK_RND_MASK |
510 | #define STACK_RND_MASK 0x7ff /* with 4K pages 8MB of VA */ | 510 | #define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) /* 8MB of VA */ |
511 | #endif | 511 | #endif |
512 | 512 | ||
513 | static unsigned long randomize_stack_top(unsigned long stack_top) | 513 | static unsigned long randomize_stack_top(unsigned long stack_top) |
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 329efcd3d8c9..cb20b964419f 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
@@ -78,18 +78,13 @@ struct kmem_cache *ecryptfs_dentry_info_cache; | |||
78 | */ | 78 | */ |
79 | static void ecryptfs_d_release(struct dentry *dentry) | 79 | static void ecryptfs_d_release(struct dentry *dentry) |
80 | { | 80 | { |
81 | struct dentry *lower_dentry; | 81 | if (ecryptfs_dentry_to_private(dentry)) { |
82 | 82 | if (ecryptfs_dentry_to_lower(dentry)) { | |
83 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 83 | mntput(ecryptfs_dentry_to_lower_mnt(dentry)); |
84 | if (ecryptfs_dentry_to_private(dentry)) | 84 | dput(ecryptfs_dentry_to_lower(dentry)); |
85 | } | ||
85 | kmem_cache_free(ecryptfs_dentry_info_cache, | 86 | kmem_cache_free(ecryptfs_dentry_info_cache, |
86 | ecryptfs_dentry_to_private(dentry)); | 87 | ecryptfs_dentry_to_private(dentry)); |
87 | if (lower_dentry) { | ||
88 | struct vfsmount *lower_mnt = | ||
89 | ecryptfs_dentry_to_lower_mnt(dentry); | ||
90 | |||
91 | mntput(lower_mnt); | ||
92 | dput(lower_dentry); | ||
93 | } | 88 | } |
94 | return; | 89 | return; |
95 | } | 90 | } |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index af53c02f473b..93d046c85f52 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -429,7 +429,8 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
429 | int err; | 429 | int err; |
430 | 430 | ||
431 | /* Flush out writes to the server in order to update c/mtime */ | 431 | /* Flush out writes to the server in order to update c/mtime */ |
432 | nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT); | 432 | if (S_ISREG(inode->i_mode)) |
433 | nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT); | ||
433 | 434 | ||
434 | /* | 435 | /* |
435 | * We may force a getattr if the user cares about atime. | 436 | * We may force a getattr if the user cares about atime. |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index bb516a2cfbaf..f1eae44b9a1a 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -151,10 +151,10 @@ int __init register_nfs_fs(void) | |||
151 | if (ret < 0) | 151 | if (ret < 0) |
152 | goto error_0; | 152 | goto error_0; |
153 | 153 | ||
154 | #ifdef CONFIG_NFS_V4 | ||
155 | ret = nfs_register_sysctl(); | 154 | ret = nfs_register_sysctl(); |
156 | if (ret < 0) | 155 | if (ret < 0) |
157 | goto error_1; | 156 | goto error_1; |
157 | #ifdef CONFIG_NFS_V4 | ||
158 | ret = register_filesystem(&nfs4_fs_type); | 158 | ret = register_filesystem(&nfs4_fs_type); |
159 | if (ret < 0) | 159 | if (ret < 0) |
160 | goto error_2; | 160 | goto error_2; |
@@ -165,9 +165,9 @@ int __init register_nfs_fs(void) | |||
165 | #ifdef CONFIG_NFS_V4 | 165 | #ifdef CONFIG_NFS_V4 |
166 | error_2: | 166 | error_2: |
167 | nfs_unregister_sysctl(); | 167 | nfs_unregister_sysctl(); |
168 | #endif | ||
168 | error_1: | 169 | error_1: |
169 | unregister_filesystem(&nfs_fs_type); | 170 | unregister_filesystem(&nfs_fs_type); |
170 | #endif | ||
171 | error_0: | 171 | error_0: |
172 | return ret; | 172 | return ret; |
173 | } | 173 | } |
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c index fcdcafbb3293..b62481dabae9 100644 --- a/fs/nfs/sysctl.c +++ b/fs/nfs/sysctl.c | |||
@@ -50,6 +50,14 @@ static ctl_table nfs_cb_sysctls[] = { | |||
50 | .proc_handler = &proc_dointvec_jiffies, | 50 | .proc_handler = &proc_dointvec_jiffies, |
51 | .strategy = &sysctl_jiffies, | 51 | .strategy = &sysctl_jiffies, |
52 | }, | 52 | }, |
53 | { | ||
54 | .ctl_name = CTL_UNNUMBERED, | ||
55 | .procname = "nfs_congestion_kb", | ||
56 | .data = &nfs_congestion_kb, | ||
57 | .maxlen = sizeof(nfs_congestion_kb), | ||
58 | .mode = 0644, | ||
59 | .proc_handler = &proc_dointvec, | ||
60 | }, | ||
53 | { .ctl_name = 0 } | 61 | { .ctl_name = 0 } |
54 | }; | 62 | }; |
55 | 63 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index febdade91670..2867e6b7096f 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/file.h> | 13 | #include <linux/file.h> |
14 | #include <linux/writeback.h> | 14 | #include <linux/writeback.h> |
15 | #include <linux/swap.h> | ||
15 | 16 | ||
16 | #include <linux/sunrpc/clnt.h> | 17 | #include <linux/sunrpc/clnt.h> |
17 | #include <linux/nfs_fs.h> | 18 | #include <linux/nfs_fs.h> |
@@ -38,7 +39,6 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context*, | |||
38 | struct page *, | 39 | struct page *, |
39 | unsigned int, unsigned int); | 40 | unsigned int, unsigned int); |
40 | static void nfs_mark_request_dirty(struct nfs_page *req); | 41 | static void nfs_mark_request_dirty(struct nfs_page *req); |
41 | static int nfs_wait_on_write_congestion(struct address_space *, int); | ||
42 | static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); | 42 | static long nfs_flush_mapping(struct address_space *mapping, struct writeback_control *wbc, int how); |
43 | static const struct rpc_call_ops nfs_write_partial_ops; | 43 | static const struct rpc_call_ops nfs_write_partial_ops; |
44 | static const struct rpc_call_ops nfs_write_full_ops; | 44 | static const struct rpc_call_ops nfs_write_full_ops; |
@@ -48,8 +48,6 @@ static struct kmem_cache *nfs_wdata_cachep; | |||
48 | static mempool_t *nfs_wdata_mempool; | 48 | static mempool_t *nfs_wdata_mempool; |
49 | static mempool_t *nfs_commit_mempool; | 49 | static mempool_t *nfs_commit_mempool; |
50 | 50 | ||
51 | static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion); | ||
52 | |||
53 | struct nfs_write_data *nfs_commit_alloc(void) | 51 | struct nfs_write_data *nfs_commit_alloc(void) |
54 | { | 52 | { |
55 | struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS); | 53 | struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, GFP_NOFS); |
@@ -211,6 +209,40 @@ static int wb_priority(struct writeback_control *wbc) | |||
211 | } | 209 | } |
212 | 210 | ||
213 | /* | 211 | /* |
212 | * NFS congestion control | ||
213 | */ | ||
214 | |||
215 | int nfs_congestion_kb; | ||
216 | |||
217 | #define NFS_CONGESTION_ON_THRESH (nfs_congestion_kb >> (PAGE_SHIFT-10)) | ||
218 | #define NFS_CONGESTION_OFF_THRESH \ | ||
219 | (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2)) | ||
220 | |||
221 | static void nfs_set_page_writeback(struct page *page) | ||
222 | { | ||
223 | if (!test_set_page_writeback(page)) { | ||
224 | struct inode *inode = page->mapping->host; | ||
225 | struct nfs_server *nfss = NFS_SERVER(inode); | ||
226 | |||
227 | if (atomic_inc_return(&nfss->writeback) > | ||
228 | NFS_CONGESTION_ON_THRESH) | ||
229 | set_bdi_congested(&nfss->backing_dev_info, WRITE); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | static void nfs_end_page_writeback(struct page *page) | ||
234 | { | ||
235 | struct inode *inode = page->mapping->host; | ||
236 | struct nfs_server *nfss = NFS_SERVER(inode); | ||
237 | |||
238 | end_page_writeback(page); | ||
239 | if (atomic_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) { | ||
240 | clear_bdi_congested(&nfss->backing_dev_info, WRITE); | ||
241 | congestion_end(WRITE); | ||
242 | } | ||
243 | } | ||
244 | |||
245 | /* | ||
214 | * Find an associated nfs write request, and prepare to flush it out | 246 | * Find an associated nfs write request, and prepare to flush it out |
215 | * Returns 1 if there was no write request, or if the request was | 247 | * Returns 1 if there was no write request, or if the request was |
216 | * already tagged by nfs_set_page_dirty.Returns 0 if the request | 248 | * already tagged by nfs_set_page_dirty.Returns 0 if the request |
@@ -247,7 +279,7 @@ static int nfs_page_mark_flush(struct page *page) | |||
247 | spin_unlock(req_lock); | 279 | spin_unlock(req_lock); |
248 | if (test_and_set_bit(PG_FLUSHING, &req->wb_flags) == 0) { | 280 | if (test_and_set_bit(PG_FLUSHING, &req->wb_flags) == 0) { |
249 | nfs_mark_request_dirty(req); | 281 | nfs_mark_request_dirty(req); |
250 | set_page_writeback(page); | 282 | nfs_set_page_writeback(page); |
251 | } | 283 | } |
252 | ret = test_bit(PG_NEED_FLUSH, &req->wb_flags); | 284 | ret = test_bit(PG_NEED_FLUSH, &req->wb_flags); |
253 | nfs_unlock_request(req); | 285 | nfs_unlock_request(req); |
@@ -302,13 +334,8 @@ int nfs_writepage(struct page *page, struct writeback_control *wbc) | |||
302 | return err; | 334 | return err; |
303 | } | 335 | } |
304 | 336 | ||
305 | /* | ||
306 | * Note: causes nfs_update_request() to block on the assumption | ||
307 | * that the writeback is generated due to memory pressure. | ||
308 | */ | ||
309 | int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) | 337 | int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) |
310 | { | 338 | { |
311 | struct backing_dev_info *bdi = mapping->backing_dev_info; | ||
312 | struct inode *inode = mapping->host; | 339 | struct inode *inode = mapping->host; |
313 | int err; | 340 | int err; |
314 | 341 | ||
@@ -317,20 +344,12 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) | |||
317 | err = generic_writepages(mapping, wbc); | 344 | err = generic_writepages(mapping, wbc); |
318 | if (err) | 345 | if (err) |
319 | return err; | 346 | return err; |
320 | while (test_and_set_bit(BDI_write_congested, &bdi->state) != 0) { | ||
321 | if (wbc->nonblocking) | ||
322 | return 0; | ||
323 | nfs_wait_on_write_congestion(mapping, 0); | ||
324 | } | ||
325 | err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc)); | 347 | err = nfs_flush_mapping(mapping, wbc, wb_priority(wbc)); |
326 | if (err < 0) | 348 | if (err < 0) |
327 | goto out; | 349 | goto out; |
328 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); | 350 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, err); |
329 | err = 0; | 351 | err = 0; |
330 | out: | 352 | out: |
331 | clear_bit(BDI_write_congested, &bdi->state); | ||
332 | wake_up_all(&nfs_write_congestion); | ||
333 | congestion_end(WRITE); | ||
334 | return err; | 353 | return err; |
335 | } | 354 | } |
336 | 355 | ||
@@ -360,7 +379,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | |||
360 | } | 379 | } |
361 | 380 | ||
362 | /* | 381 | /* |
363 | * Insert a write request into an inode | 382 | * Remove a write request from an inode |
364 | */ | 383 | */ |
365 | static void nfs_inode_remove_request(struct nfs_page *req) | 384 | static void nfs_inode_remove_request(struct nfs_page *req) |
366 | { | 385 | { |
@@ -531,10 +550,10 @@ static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, un | |||
531 | } | 550 | } |
532 | #endif | 551 | #endif |
533 | 552 | ||
534 | static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr) | 553 | static int nfs_wait_on_write_congestion(struct address_space *mapping) |
535 | { | 554 | { |
555 | struct inode *inode = mapping->host; | ||
536 | struct backing_dev_info *bdi = mapping->backing_dev_info; | 556 | struct backing_dev_info *bdi = mapping->backing_dev_info; |
537 | DEFINE_WAIT(wait); | ||
538 | int ret = 0; | 557 | int ret = 0; |
539 | 558 | ||
540 | might_sleep(); | 559 | might_sleep(); |
@@ -542,31 +561,23 @@ static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr) | |||
542 | if (!bdi_write_congested(bdi)) | 561 | if (!bdi_write_congested(bdi)) |
543 | return 0; | 562 | return 0; |
544 | 563 | ||
545 | nfs_inc_stats(mapping->host, NFSIOS_CONGESTIONWAIT); | 564 | nfs_inc_stats(inode, NFSIOS_CONGESTIONWAIT); |
546 | 565 | ||
547 | if (intr) { | 566 | do { |
548 | struct rpc_clnt *clnt = NFS_CLIENT(mapping->host); | 567 | struct rpc_clnt *clnt = NFS_CLIENT(inode); |
549 | sigset_t oldset; | 568 | sigset_t oldset; |
550 | 569 | ||
551 | rpc_clnt_sigmask(clnt, &oldset); | 570 | rpc_clnt_sigmask(clnt, &oldset); |
552 | prepare_to_wait(&nfs_write_congestion, &wait, TASK_INTERRUPTIBLE); | 571 | ret = congestion_wait_interruptible(WRITE, HZ/10); |
553 | if (bdi_write_congested(bdi)) { | ||
554 | if (signalled()) | ||
555 | ret = -ERESTARTSYS; | ||
556 | else | ||
557 | schedule(); | ||
558 | } | ||
559 | rpc_clnt_sigunmask(clnt, &oldset); | 572 | rpc_clnt_sigunmask(clnt, &oldset); |
560 | } else { | 573 | if (ret == -ERESTARTSYS) |
561 | prepare_to_wait(&nfs_write_congestion, &wait, TASK_UNINTERRUPTIBLE); | 574 | break; |
562 | if (bdi_write_congested(bdi)) | 575 | ret = 0; |
563 | schedule(); | 576 | } while (bdi_write_congested(bdi)); |
564 | } | 577 | |
565 | finish_wait(&nfs_write_congestion, &wait); | ||
566 | return ret; | 578 | return ret; |
567 | } | 579 | } |
568 | 580 | ||
569 | |||
570 | /* | 581 | /* |
571 | * Try to update any existing write request, or create one if there is none. | 582 | * Try to update any existing write request, or create one if there is none. |
572 | * In order to match, the request's credentials must match those of | 583 | * In order to match, the request's credentials must match those of |
@@ -577,14 +588,15 @@ static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr) | |||
577 | static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | 588 | static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, |
578 | struct page *page, unsigned int offset, unsigned int bytes) | 589 | struct page *page, unsigned int offset, unsigned int bytes) |
579 | { | 590 | { |
580 | struct inode *inode = page->mapping->host; | 591 | struct address_space *mapping = page->mapping; |
592 | struct inode *inode = mapping->host; | ||
581 | struct nfs_inode *nfsi = NFS_I(inode); | 593 | struct nfs_inode *nfsi = NFS_I(inode); |
582 | struct nfs_page *req, *new = NULL; | 594 | struct nfs_page *req, *new = NULL; |
583 | unsigned long rqend, end; | 595 | unsigned long rqend, end; |
584 | 596 | ||
585 | end = offset + bytes; | 597 | end = offset + bytes; |
586 | 598 | ||
587 | if (nfs_wait_on_write_congestion(page->mapping, NFS_SERVER(inode)->flags & NFS_MOUNT_INTR)) | 599 | if (nfs_wait_on_write_congestion(mapping)) |
588 | return ERR_PTR(-ERESTARTSYS); | 600 | return ERR_PTR(-ERESTARTSYS); |
589 | for (;;) { | 601 | for (;;) { |
590 | /* Loop over all inode entries and see if we find | 602 | /* Loop over all inode entries and see if we find |
@@ -727,7 +739,7 @@ int nfs_updatepage(struct file *file, struct page *page, | |||
727 | 739 | ||
728 | static void nfs_writepage_release(struct nfs_page *req) | 740 | static void nfs_writepage_release(struct nfs_page *req) |
729 | { | 741 | { |
730 | end_page_writeback(req->wb_page); | 742 | nfs_end_page_writeback(req->wb_page); |
731 | 743 | ||
732 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 744 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
733 | if (!PageError(req->wb_page)) { | 745 | if (!PageError(req->wb_page)) { |
@@ -1042,12 +1054,12 @@ static void nfs_writeback_done_full(struct rpc_task *task, void *calldata) | |||
1042 | if (task->tk_status < 0) { | 1054 | if (task->tk_status < 0) { |
1043 | nfs_set_pageerror(page); | 1055 | nfs_set_pageerror(page); |
1044 | req->wb_context->error = task->tk_status; | 1056 | req->wb_context->error = task->tk_status; |
1045 | end_page_writeback(page); | 1057 | nfs_end_page_writeback(page); |
1046 | nfs_inode_remove_request(req); | 1058 | nfs_inode_remove_request(req); |
1047 | dprintk(", error = %d\n", task->tk_status); | 1059 | dprintk(", error = %d\n", task->tk_status); |
1048 | goto next; | 1060 | goto next; |
1049 | } | 1061 | } |
1050 | end_page_writeback(page); | 1062 | nfs_end_page_writeback(page); |
1051 | 1063 | ||
1052 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 1064 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
1053 | if (data->args.stable != NFS_UNSTABLE || data->verf.committed == NFS_FILE_SYNC) { | 1065 | if (data->args.stable != NFS_UNSTABLE || data->verf.committed == NFS_FILE_SYNC) { |
@@ -1514,6 +1526,26 @@ int __init nfs_init_writepagecache(void) | |||
1514 | if (nfs_commit_mempool == NULL) | 1526 | if (nfs_commit_mempool == NULL) |
1515 | return -ENOMEM; | 1527 | return -ENOMEM; |
1516 | 1528 | ||
1529 | /* | ||
1530 | * NFS congestion size, scale with available memory. | ||
1531 | * | ||
1532 | * 64MB: 8192k | ||
1533 | * 128MB: 11585k | ||
1534 | * 256MB: 16384k | ||
1535 | * 512MB: 23170k | ||
1536 | * 1GB: 32768k | ||
1537 | * 2GB: 46340k | ||
1538 | * 4GB: 65536k | ||
1539 | * 8GB: 92681k | ||
1540 | * 16GB: 131072k | ||
1541 | * | ||
1542 | * This allows larger machines to have larger/more transfers. | ||
1543 | * Limit the default to 256M | ||
1544 | */ | ||
1545 | nfs_congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10); | ||
1546 | if (nfs_congestion_kb > 256*1024) | ||
1547 | nfs_congestion_kb = 256*1024; | ||
1548 | |||
1517 | return 0; | 1549 | return 0; |
1518 | } | 1550 | } |
1519 | 1551 | ||
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig index 74552c60b671..6e8bb66fe619 100644 --- a/fs/partitions/Kconfig +++ b/fs/partitions/Kconfig | |||
@@ -235,5 +235,4 @@ config EFI_PARTITION | |||
235 | select CRC32 | 235 | select CRC32 |
236 | help | 236 | help |
237 | Say Y here if you would like to use hard disks under Linux which | 237 | Say Y here if you would like to use hard disks under Linux which |
238 | were partitioned using EFI GPT. Presently only useful on the | 238 | were partitioned using EFI GPT. |
239 | IA-64 platform. | ||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index e46d237b10f9..8a7d0035ad7a 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -541,7 +541,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) | |||
541 | if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) | 541 | if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) |
542 | return 0; | 542 | return 0; |
543 | if (IS_ERR(state)) /* I/O error reading the partition table */ | 543 | if (IS_ERR(state)) /* I/O error reading the partition table */ |
544 | return PTR_ERR(state); | 544 | return -EIO; |
545 | for (p = 1; p < state->limit; p++) { | 545 | for (p = 1; p < state->limit; p++) { |
546 | sector_t size = state->parts[p].size; | 546 | sector_t size = state->parts[p].size; |
547 | sector_t from = state->parts[p].from; | 547 | sector_t from = state->parts[p].from; |
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c index 42261dbdf60f..723f7c667661 100644 --- a/fs/smbfs/request.c +++ b/fs/smbfs/request.c | |||
@@ -181,6 +181,7 @@ static int smb_setup_request(struct smb_request *req) | |||
181 | req->rq_errno = 0; | 181 | req->rq_errno = 0; |
182 | req->rq_fragment = 0; | 182 | req->rq_fragment = 0; |
183 | kfree(req->rq_trans2buffer); | 183 | kfree(req->rq_trans2buffer); |
184 | req->rq_trans2buffer = NULL; | ||
184 | 185 | ||
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index bcc44084e004..841ac25fd950 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -244,62 +244,87 @@ failed: | |||
244 | * We can come here from ufs_writepage or ufs_prepare_write, | 244 | * We can come here from ufs_writepage or ufs_prepare_write, |
245 | * locked_page is argument of these functions, so we already lock it. | 245 | * locked_page is argument of these functions, so we already lock it. |
246 | */ | 246 | */ |
247 | static void ufs_change_blocknr(struct inode *inode, unsigned int beg, | 247 | static void ufs_change_blocknr(struct inode *inode, sector_t beg, |
248 | unsigned int count, unsigned int oldb, | 248 | unsigned int count, sector_t oldb, |
249 | unsigned int newb, struct page *locked_page) | 249 | sector_t newb, struct page *locked_page) |
250 | { | 250 | { |
251 | const unsigned mask = (1 << (PAGE_CACHE_SHIFT - inode->i_blkbits)) - 1; | 251 | const unsigned blks_per_page = |
252 | 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); | ||
253 | const unsigned mask = blks_per_page - 1; | ||
252 | struct address_space * const mapping = inode->i_mapping; | 254 | struct address_space * const mapping = inode->i_mapping; |
253 | pgoff_t index, cur_index; | 255 | pgoff_t index, cur_index, last_index; |
254 | unsigned end, pos, j; | 256 | unsigned pos, j, lblock; |
257 | sector_t end, i; | ||
255 | struct page *page; | 258 | struct page *page; |
256 | struct buffer_head *head, *bh; | 259 | struct buffer_head *head, *bh; |
257 | 260 | ||
258 | UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n", | 261 | UFSD("ENTER, ino %lu, count %u, oldb %llu, newb %llu\n", |
259 | inode->i_ino, count, oldb, newb); | 262 | inode->i_ino, count, |
263 | (unsigned long long)oldb, (unsigned long long)newb); | ||
260 | 264 | ||
261 | BUG_ON(!locked_page); | 265 | BUG_ON(!locked_page); |
262 | BUG_ON(!PageLocked(locked_page)); | 266 | BUG_ON(!PageLocked(locked_page)); |
263 | 267 | ||
264 | cur_index = locked_page->index; | 268 | cur_index = locked_page->index; |
265 | 269 | end = count + beg; | |
266 | for (end = count + beg; beg < end; beg = (beg | mask) + 1) { | 270 | last_index = end >> (PAGE_CACHE_SHIFT - inode->i_blkbits); |
267 | index = beg >> (PAGE_CACHE_SHIFT - inode->i_blkbits); | 271 | for (i = beg; i < end; i = (i | mask) + 1) { |
272 | index = i >> (PAGE_CACHE_SHIFT - inode->i_blkbits); | ||
268 | 273 | ||
269 | if (likely(cur_index != index)) { | 274 | if (likely(cur_index != index)) { |
270 | page = ufs_get_locked_page(mapping, index); | 275 | page = ufs_get_locked_page(mapping, index); |
271 | if (!page || IS_ERR(page)) /* it was truncated or EIO */ | 276 | if (!page)/* it was truncated */ |
277 | continue; | ||
278 | if (IS_ERR(page)) {/* or EIO */ | ||
279 | ufs_error(inode->i_sb, __FUNCTION__, | ||
280 | "read of page %llu failed\n", | ||
281 | (unsigned long long)index); | ||
272 | continue; | 282 | continue; |
283 | } | ||
273 | } else | 284 | } else |
274 | page = locked_page; | 285 | page = locked_page; |
275 | 286 | ||
276 | head = page_buffers(page); | 287 | head = page_buffers(page); |
277 | bh = head; | 288 | bh = head; |
278 | pos = beg & mask; | 289 | pos = i & mask; |
279 | for (j = 0; j < pos; ++j) | 290 | for (j = 0; j < pos; ++j) |
280 | bh = bh->b_this_page; | 291 | bh = bh->b_this_page; |
281 | j = 0; | 292 | |
293 | |||
294 | if (unlikely(index == last_index)) | ||
295 | lblock = end & mask; | ||
296 | else | ||
297 | lblock = blks_per_page; | ||
298 | |||
282 | do { | 299 | do { |
283 | if (buffer_mapped(bh)) { | 300 | if (j >= lblock) |
284 | pos = bh->b_blocknr - oldb; | 301 | break; |
285 | if (pos < count) { | 302 | pos = (i - beg) + j; |
286 | UFSD(" change from %llu to %llu\n", | 303 | |
287 | (unsigned long long)pos + oldb, | 304 | if (!buffer_mapped(bh)) |
288 | (unsigned long long)pos + newb); | 305 | map_bh(bh, inode->i_sb, oldb + pos); |
289 | bh->b_blocknr = newb + pos; | 306 | if (!buffer_uptodate(bh)) { |
290 | unmap_underlying_metadata(bh->b_bdev, | 307 | ll_rw_block(READ, 1, &bh); |
291 | bh->b_blocknr); | 308 | wait_on_buffer(bh); |
292 | mark_buffer_dirty(bh); | 309 | if (!buffer_uptodate(bh)) { |
293 | ++j; | 310 | ufs_error(inode->i_sb, __FUNCTION__, |
311 | "read of block failed\n"); | ||
312 | break; | ||
294 | } | 313 | } |
295 | } | 314 | } |
296 | 315 | ||
316 | UFSD(" change from %llu to %llu, pos %u\n", | ||
317 | (unsigned long long)pos + oldb, | ||
318 | (unsigned long long)pos + newb, pos); | ||
319 | |||
320 | bh->b_blocknr = newb + pos; | ||
321 | unmap_underlying_metadata(bh->b_bdev, | ||
322 | bh->b_blocknr); | ||
323 | mark_buffer_dirty(bh); | ||
324 | ++j; | ||
297 | bh = bh->b_this_page; | 325 | bh = bh->b_this_page; |
298 | } while (bh != head); | 326 | } while (bh != head); |
299 | 327 | ||
300 | if (j) | ||
301 | set_page_dirty(page); | ||
302 | |||
303 | if (likely(cur_index != index)) | 328 | if (likely(cur_index != index)) |
304 | ufs_put_locked_page(page); | 329 | ufs_put_locked_page(page); |
305 | } | 330 | } |
@@ -457,8 +482,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, | |||
457 | if (result) { | 482 | if (result) { |
458 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, | 483 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
459 | locked_page != NULL); | 484 | locked_page != NULL); |
460 | ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp, | 485 | ufs_change_blocknr(inode, fragment - oldcount, oldcount, |
461 | result, locked_page); | 486 | uspi->s_sbbase + tmp, |
487 | uspi->s_sbbase + result, locked_page); | ||
462 | ufs_cpu_to_data_ptr(sb, p, result); | 488 | ufs_cpu_to_data_ptr(sb, p, result); |
463 | *err = 0; | 489 | *err = 0; |
464 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); | 490 | UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index b868878009b6..c28a8b6f2feb 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -343,9 +343,8 @@ cg_found: | |||
343 | lock_buffer(bh); | 343 | lock_buffer(bh); |
344 | ufs2_inode = (struct ufs2_inode *)bh->b_data; | 344 | ufs2_inode = (struct ufs2_inode *)bh->b_data; |
345 | ufs2_inode += ufs_inotofsbo(inode->i_ino); | 345 | ufs2_inode += ufs_inotofsbo(inode->i_ino); |
346 | ufs2_inode->ui_birthtime.tv_sec = | 346 | ufs2_inode->ui_birthtime = cpu_to_fs64(sb, CURRENT_TIME.tv_sec); |
347 | cpu_to_fs32(sb, CURRENT_TIME_SEC.tv_sec); | 347 | ufs2_inode->ui_birthnsec = cpu_to_fs32(sb, CURRENT_TIME.tv_nsec); |
348 | ufs2_inode->ui_birthtime.tv_usec = 0; | ||
349 | mark_buffer_dirty(bh); | 348 | mark_buffer_dirty(bh); |
350 | unlock_buffer(bh); | 349 | unlock_buffer(bh); |
351 | if (sb->s_flags & MS_SYNCHRONOUS) | 350 | if (sb->s_flags & MS_SYNCHRONOUS) |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index fb34ad03e224..013d7afe7cde 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -212,7 +212,7 @@ repeat: | |||
212 | brelse (result); | 212 | brelse (result); |
213 | goto repeat; | 213 | goto repeat; |
214 | } else { | 214 | } else { |
215 | *phys = tmp + blockoff; | 215 | *phys = uspi->s_sbbase + tmp + blockoff; |
216 | return NULL; | 216 | return NULL; |
217 | } | 217 | } |
218 | } | 218 | } |
@@ -282,9 +282,9 @@ repeat: | |||
282 | } | 282 | } |
283 | 283 | ||
284 | if (!phys) { | 284 | if (!phys) { |
285 | result = sb_getblk(sb, tmp + blockoff); | 285 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); |
286 | } else { | 286 | } else { |
287 | *phys = tmp + blockoff; | 287 | *phys = uspi->s_sbbase + tmp + blockoff; |
288 | result = NULL; | 288 | result = NULL; |
289 | *err = 0; | 289 | *err = 0; |
290 | *new = 1; | 290 | *new = 1; |
@@ -368,7 +368,7 @@ repeat: | |||
368 | brelse (result); | 368 | brelse (result); |
369 | goto repeat; | 369 | goto repeat; |
370 | } else { | 370 | } else { |
371 | *phys = tmp + blockoff; | 371 | *phys = uspi->s_sbbase + tmp + blockoff; |
372 | goto out; | 372 | goto out; |
373 | } | 373 | } |
374 | } | 374 | } |
@@ -389,9 +389,9 @@ repeat: | |||
389 | 389 | ||
390 | 390 | ||
391 | if (!phys) { | 391 | if (!phys) { |
392 | result = sb_getblk(sb, tmp + blockoff); | 392 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); |
393 | } else { | 393 | } else { |
394 | *phys = tmp + blockoff; | 394 | *phys = uspi->s_sbbase + tmp + blockoff; |
395 | *new = 1; | 395 | *new = 1; |
396 | } | 396 | } |
397 | 397 | ||
@@ -668,12 +668,12 @@ static void ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
668 | inode->i_gid = fs32_to_cpu(sb, ufs2_inode->ui_gid); | 668 | inode->i_gid = fs32_to_cpu(sb, ufs2_inode->ui_gid); |
669 | 669 | ||
670 | inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); | 670 | inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); |
671 | inode->i_atime.tv_sec = fs32_to_cpu(sb, ufs2_inode->ui_atime.tv_sec); | 671 | inode->i_atime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_atime); |
672 | inode->i_ctime.tv_sec = fs32_to_cpu(sb, ufs2_inode->ui_ctime.tv_sec); | 672 | inode->i_ctime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_ctime); |
673 | inode->i_mtime.tv_sec = fs32_to_cpu(sb, ufs2_inode->ui_mtime.tv_sec); | 673 | inode->i_mtime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_mtime); |
674 | inode->i_mtime.tv_nsec = 0; | 674 | inode->i_atime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_atimensec); |
675 | inode->i_atime.tv_nsec = 0; | 675 | inode->i_ctime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_ctimensec); |
676 | inode->i_ctime.tv_nsec = 0; | 676 | inode->i_mtime.tv_nsec = fs32_to_cpu(sb, ufs2_inode->ui_mtimensec); |
677 | inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); | 677 | inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); |
678 | inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen); | 678 | inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen); |
679 | ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags); | 679 | ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags); |
@@ -803,12 +803,12 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) | |||
803 | ufs_inode->ui_gid = cpu_to_fs32(sb, inode->i_gid); | 803 | ufs_inode->ui_gid = cpu_to_fs32(sb, inode->i_gid); |
804 | 804 | ||
805 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); | 805 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); |
806 | ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); | 806 | ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec); |
807 | ufs_inode->ui_atime.tv_usec = 0; | 807 | ufs_inode->ui_atimensec = cpu_to_fs32(sb, inode->i_atime.tv_nsec); |
808 | ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb, inode->i_ctime.tv_sec); | 808 | ufs_inode->ui_ctime = cpu_to_fs64(sb, inode->i_ctime.tv_sec); |
809 | ufs_inode->ui_ctime.tv_usec = 0; | 809 | ufs_inode->ui_ctimensec = cpu_to_fs32(sb, inode->i_ctime.tv_nsec); |
810 | ufs_inode->ui_mtime.tv_sec = cpu_to_fs32(sb, inode->i_mtime.tv_sec); | 810 | ufs_inode->ui_mtime = cpu_to_fs64(sb, inode->i_mtime.tv_sec); |
811 | ufs_inode->ui_mtime.tv_usec = 0; | 811 | ufs_inode->ui_mtimensec = cpu_to_fs32(sb, inode->i_mtime.tv_nsec); |
812 | 812 | ||
813 | ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks); | 813 | ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks); |
814 | ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); | 814 | ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 749581fa7729..79c54c85fb58 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -74,7 +74,7 @@ static int ufs_trunc_direct(struct inode *inode) | |||
74 | unsigned i, tmp; | 74 | unsigned i, tmp; |
75 | int retry; | 75 | int retry; |
76 | 76 | ||
77 | UFSD("ENTER\n"); | 77 | UFSD("ENTER: ino %lu\n", inode->i_ino); |
78 | 78 | ||
79 | sb = inode->i_sb; | 79 | sb = inode->i_sb; |
80 | uspi = UFS_SB(sb)->s_uspi; | 80 | uspi = UFS_SB(sb)->s_uspi; |
@@ -96,8 +96,8 @@ static int ufs_trunc_direct(struct inode *inode) | |||
96 | block2 = ufs_fragstoblks (frag3); | 96 | block2 = ufs_fragstoblks (frag3); |
97 | } | 97 | } |
98 | 98 | ||
99 | UFSD("frag1 %llu, frag2 %llu, block1 %llu, block2 %llu, frag3 %llu," | 99 | UFSD("ino %lu, frag1 %llu, frag2 %llu, block1 %llu, block2 %llu," |
100 | " frag4 %llu\n", | 100 | " frag3 %llu, frag4 %llu\n", inode->i_ino, |
101 | (unsigned long long)frag1, (unsigned long long)frag2, | 101 | (unsigned long long)frag1, (unsigned long long)frag2, |
102 | (unsigned long long)block1, (unsigned long long)block2, | 102 | (unsigned long long)block1, (unsigned long long)block2, |
103 | (unsigned long long)frag3, (unsigned long long)frag4); | 103 | (unsigned long long)frag3, (unsigned long long)frag4); |
@@ -163,7 +163,7 @@ next1: | |||
163 | mark_inode_dirty(inode); | 163 | mark_inode_dirty(inode); |
164 | next3: | 164 | next3: |
165 | 165 | ||
166 | UFSD("EXIT\n"); | 166 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
167 | return retry; | 167 | return retry; |
168 | } | 168 | } |
169 | 169 | ||
@@ -248,7 +248,7 @@ static int ufs_trunc_indirect(struct inode *inode, u64 offset, void *p) | |||
248 | } | 248 | } |
249 | ubh_brelse (ind_ubh); | 249 | ubh_brelse (ind_ubh); |
250 | 250 | ||
251 | UFSD("EXIT\n"); | 251 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
252 | 252 | ||
253 | return retry; | 253 | return retry; |
254 | } | 254 | } |
@@ -262,7 +262,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p) | |||
262 | void *dind; | 262 | void *dind; |
263 | int retry = 0; | 263 | int retry = 0; |
264 | 264 | ||
265 | UFSD("ENTER\n"); | 265 | UFSD("ENTER: ino %lu\n", inode->i_ino); |
266 | 266 | ||
267 | sb = inode->i_sb; | 267 | sb = inode->i_sb; |
268 | uspi = UFS_SB(sb)->s_uspi; | 268 | uspi = UFS_SB(sb)->s_uspi; |
@@ -312,7 +312,7 @@ static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p) | |||
312 | } | 312 | } |
313 | ubh_brelse (dind_bh); | 313 | ubh_brelse (dind_bh); |
314 | 314 | ||
315 | UFSD("EXIT\n"); | 315 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
316 | 316 | ||
317 | return retry; | 317 | return retry; |
318 | } | 318 | } |
@@ -327,7 +327,7 @@ static int ufs_trunc_tindirect(struct inode *inode) | |||
327 | void *tind, *p; | 327 | void *tind, *p; |
328 | int retry; | 328 | int retry; |
329 | 329 | ||
330 | UFSD("ENTER\n"); | 330 | UFSD("ENTER: ino %lu\n", inode->i_ino); |
331 | 331 | ||
332 | retry = 0; | 332 | retry = 0; |
333 | 333 | ||
@@ -348,7 +348,7 @@ static int ufs_trunc_tindirect(struct inode *inode) | |||
348 | } | 348 | } |
349 | 349 | ||
350 | for (i = tindirect_block ; i < uspi->s_apb ; i++) { | 350 | for (i = tindirect_block ; i < uspi->s_apb ; i++) { |
351 | tind = ubh_get_addr32 (tind_bh, i); | 351 | tind = ubh_get_data_ptr(uspi, tind_bh, i); |
352 | retry |= ufs_trunc_dindirect(inode, UFS_NDADDR + | 352 | retry |= ufs_trunc_dindirect(inode, UFS_NDADDR + |
353 | uspi->s_apb + ((i + 1) << uspi->s_2apbshift), tind); | 353 | uspi->s_apb + ((i + 1) << uspi->s_2apbshift), tind); |
354 | ubh_mark_buffer_dirty(tind_bh); | 354 | ubh_mark_buffer_dirty(tind_bh); |
@@ -372,19 +372,21 @@ static int ufs_trunc_tindirect(struct inode *inode) | |||
372 | } | 372 | } |
373 | ubh_brelse (tind_bh); | 373 | ubh_brelse (tind_bh); |
374 | 374 | ||
375 | UFSD("EXIT\n"); | 375 | UFSD("EXIT: ino %lu\n", inode->i_ino); |
376 | return retry; | 376 | return retry; |
377 | } | 377 | } |
378 | 378 | ||
379 | static int ufs_alloc_lastblock(struct inode *inode) | 379 | static int ufs_alloc_lastblock(struct inode *inode) |
380 | { | 380 | { |
381 | int err = 0; | 381 | int err = 0; |
382 | struct super_block *sb = inode->i_sb; | ||
382 | struct address_space *mapping = inode->i_mapping; | 383 | struct address_space *mapping = inode->i_mapping; |
383 | struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi; | 384 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
384 | unsigned i, end; | 385 | unsigned i, end; |
385 | sector_t lastfrag; | 386 | sector_t lastfrag; |
386 | struct page *lastpage; | 387 | struct page *lastpage; |
387 | struct buffer_head *bh; | 388 | struct buffer_head *bh; |
389 | u64 phys64; | ||
388 | 390 | ||
389 | lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift; | 391 | lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift; |
390 | 392 | ||
@@ -424,6 +426,20 @@ static int ufs_alloc_lastblock(struct inode *inode) | |||
424 | set_page_dirty(lastpage); | 426 | set_page_dirty(lastpage); |
425 | } | 427 | } |
426 | 428 | ||
429 | if (lastfrag >= UFS_IND_FRAGMENT) { | ||
430 | end = uspi->s_fpb - ufs_fragnum(lastfrag) - 1; | ||
431 | phys64 = bh->b_blocknr + 1; | ||
432 | for (i = 0; i < end; ++i) { | ||
433 | bh = sb_getblk(sb, i + phys64); | ||
434 | lock_buffer(bh); | ||
435 | memset(bh->b_data, 0, sb->s_blocksize); | ||
436 | set_buffer_uptodate(bh); | ||
437 | mark_buffer_dirty(bh); | ||
438 | unlock_buffer(bh); | ||
439 | sync_dirty_buffer(bh); | ||
440 | brelse(bh); | ||
441 | } | ||
442 | } | ||
427 | out_unlock: | 443 | out_unlock: |
428 | ufs_put_locked_page(lastpage); | 444 | ufs_put_locked_page(lastpage); |
429 | out: | 445 | out: |
diff --git a/include/asm-arm/arch-at91/gpio.h b/include/asm-arm/arch-at91/gpio.h index 98ad2114f43a..0a241e2fb672 100644 --- a/include/asm-arm/arch-at91/gpio.h +++ b/include/asm-arm/arch-at91/gpio.h | |||
@@ -223,7 +223,7 @@ static inline void gpio_free(unsigned gpio) | |||
223 | } | 223 | } |
224 | 224 | ||
225 | extern int gpio_direction_input(unsigned gpio); | 225 | extern int gpio_direction_input(unsigned gpio); |
226 | extern int gpio_direction_output(unsigned gpio); | 226 | extern int gpio_direction_output(unsigned gpio, int value); |
227 | 227 | ||
228 | static inline int gpio_get_value(unsigned gpio) | 228 | static inline int gpio_get_value(unsigned gpio) |
229 | { | 229 | { |
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h index 3762a6ae6a7f..590917efc94a 100644 --- a/include/asm-arm/arch-omap/gpio.h +++ b/include/asm-arm/arch-omap/gpio.h | |||
@@ -113,8 +113,9 @@ static inline int gpio_direction_input(unsigned gpio) | |||
113 | return __gpio_set_direction(gpio, 1); | 113 | return __gpio_set_direction(gpio, 1); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline int gpio_direction_output(unsigned gpio) | 116 | static inline int gpio_direction_output(unsigned gpio, int value) |
117 | { | 117 | { |
118 | omap_set_gpio_dataout(gpio, value); | ||
118 | return __gpio_set_direction(gpio, 0); | 119 | return __gpio_set_direction(gpio, 0); |
119 | } | 120 | } |
120 | 121 | ||
diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h index 3d348a351157..aeba24347f8e 100644 --- a/include/asm-arm/arch-pxa/gpio.h +++ b/include/asm-arm/arch-pxa/gpio.h | |||
@@ -43,9 +43,9 @@ static inline int gpio_direction_input(unsigned gpio) | |||
43 | return pxa_gpio_mode(gpio | GPIO_IN); | 43 | return pxa_gpio_mode(gpio | GPIO_IN); |
44 | } | 44 | } |
45 | 45 | ||
46 | static inline int gpio_direction_output(unsigned gpio) | 46 | static inline int gpio_direction_output(unsigned gpio, int value) |
47 | { | 47 | { |
48 | return pxa_gpio_mode(gpio | GPIO_OUT); | 48 | return pxa_gpio_mode(gpio | GPIO_OUT | (value ? 0 : GPIO_DFLT_LOW)); |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline int __gpio_get_value(unsigned gpio) | 51 | static inline int __gpio_get_value(unsigned gpio) |
diff --git a/include/asm-arm/arch-s3c2410/gpio.h b/include/asm-arm/arch-s3c2410/gpio.h index d47ae453f8ca..7583895fd336 100644 --- a/include/asm-arm/arch-s3c2410/gpio.h +++ b/include/asm-arm/arch-s3c2410/gpio.h | |||
@@ -44,9 +44,11 @@ static inline int gpio_direction_input(unsigned gpio) | |||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | static inline int gpio_direction_output(unsigned gpio) | 47 | static inline int gpio_direction_output(unsigned gpio, int value) |
48 | { | 48 | { |
49 | s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT); | 49 | s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT); |
50 | /* REVISIT can we write the value first, to avoid glitching? */ | ||
51 | s3c2410_gpio_setpin(gpio, value); | ||
50 | return 0; | 52 | return 0; |
51 | } | 53 | } |
52 | 54 | ||
diff --git a/include/asm-arm/arch-sa1100/gpio.h b/include/asm-arm/arch-sa1100/gpio.h index da7575b0e5d0..e7a9d26e22a8 100644 --- a/include/asm-arm/arch-sa1100/gpio.h +++ b/include/asm-arm/arch-sa1100/gpio.h | |||
@@ -38,7 +38,7 @@ static inline void gpio_free(unsigned gpio) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | extern int gpio_direction_input(unsigned gpio); | 40 | extern int gpio_direction_input(unsigned gpio); |
41 | extern int gpio_direction_output(unsigned gpio); | 41 | extern int gpio_direction_output(unsigned gpio, int value); |
42 | 42 | ||
43 | 43 | ||
44 | static inline int gpio_get_value(unsigned gpio) | 44 | static inline int gpio_get_value(unsigned gpio) |
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h index fcb756bdaa8e..80a21aa9ae77 100644 --- a/include/asm-avr32/arch-at32ap/gpio.h +++ b/include/asm-avr32/arch-at32ap/gpio.h | |||
@@ -10,7 +10,7 @@ int __must_check gpio_request(unsigned int gpio, const char *label); | |||
10 | void gpio_free(unsigned int gpio); | 10 | void gpio_free(unsigned int gpio); |
11 | 11 | ||
12 | int gpio_direction_input(unsigned int gpio); | 12 | int gpio_direction_input(unsigned int gpio); |
13 | int gpio_direction_output(unsigned int gpio); | 13 | int gpio_direction_output(unsigned int gpio, int value); |
14 | int gpio_get_value(unsigned int gpio); | 14 | int gpio_get_value(unsigned int gpio); |
15 | void gpio_set_value(unsigned int gpio, int value); | 15 | void gpio_set_value(unsigned int gpio, int value); |
16 | 16 | ||
diff --git a/include/asm-i386/sync_bitops.h b/include/asm-i386/sync_bitops.h index c94d51c993ee..7d72351bea75 100644 --- a/include/asm-i386/sync_bitops.h +++ b/include/asm-i386/sync_bitops.h | |||
@@ -130,7 +130,7 @@ static inline int sync_test_and_change_bit(int nr, volatile unsigned long* addr) | |||
130 | return oldbit; | 130 | return oldbit; |
131 | } | 131 | } |
132 | 132 | ||
133 | static __always_inline int sync_const_test_bit(int nr, const volatile unsigned long *addr) | 133 | static __always_inline int sync_constant_test_bit(int nr, const volatile unsigned long *addr) |
134 | { | 134 | { |
135 | return ((1UL << (nr & 31)) & | 135 | return ((1UL << (nr & 31)) & |
136 | (((const volatile unsigned int *)addr)[nr >> 5])) != 0; | 136 | (((const volatile unsigned int *)addr)[nr >> 5])) != 0; |
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h index 8578869a8bcf..1ac50b6c47ad 100644 --- a/include/asm-mips/atomic.h +++ b/include/asm-mips/atomic.h | |||
@@ -79,9 +79,9 @@ static __inline__ void atomic_add(int i, atomic_t * v) | |||
79 | } else { | 79 | } else { |
80 | unsigned long flags; | 80 | unsigned long flags; |
81 | 81 | ||
82 | local_irq_save(flags); | 82 | raw_local_irq_save(flags); |
83 | v->counter += i; | 83 | v->counter += i; |
84 | local_irq_restore(flags); | 84 | raw_local_irq_restore(flags); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
@@ -124,9 +124,9 @@ static __inline__ void atomic_sub(int i, atomic_t * v) | |||
124 | } else { | 124 | } else { |
125 | unsigned long flags; | 125 | unsigned long flags; |
126 | 126 | ||
127 | local_irq_save(flags); | 127 | raw_local_irq_save(flags); |
128 | v->counter -= i; | 128 | v->counter -= i; |
129 | local_irq_restore(flags); | 129 | raw_local_irq_restore(flags); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
@@ -173,11 +173,11 @@ static __inline__ int atomic_add_return(int i, atomic_t * v) | |||
173 | } else { | 173 | } else { |
174 | unsigned long flags; | 174 | unsigned long flags; |
175 | 175 | ||
176 | local_irq_save(flags); | 176 | raw_local_irq_save(flags); |
177 | result = v->counter; | 177 | result = v->counter; |
178 | result += i; | 178 | result += i; |
179 | v->counter = result; | 179 | v->counter = result; |
180 | local_irq_restore(flags); | 180 | raw_local_irq_restore(flags); |
181 | } | 181 | } |
182 | 182 | ||
183 | smp_mb(); | 183 | smp_mb(); |
@@ -225,11 +225,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v) | |||
225 | } else { | 225 | } else { |
226 | unsigned long flags; | 226 | unsigned long flags; |
227 | 227 | ||
228 | local_irq_save(flags); | 228 | raw_local_irq_save(flags); |
229 | result = v->counter; | 229 | result = v->counter; |
230 | result -= i; | 230 | result -= i; |
231 | v->counter = result; | 231 | v->counter = result; |
232 | local_irq_restore(flags); | 232 | raw_local_irq_restore(flags); |
233 | } | 233 | } |
234 | 234 | ||
235 | smp_mb(); | 235 | smp_mb(); |
@@ -293,12 +293,12 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v) | |||
293 | } else { | 293 | } else { |
294 | unsigned long flags; | 294 | unsigned long flags; |
295 | 295 | ||
296 | local_irq_save(flags); | 296 | raw_local_irq_save(flags); |
297 | result = v->counter; | 297 | result = v->counter; |
298 | result -= i; | 298 | result -= i; |
299 | if (result >= 0) | 299 | if (result >= 0) |
300 | v->counter = result; | 300 | v->counter = result; |
301 | local_irq_restore(flags); | 301 | raw_local_irq_restore(flags); |
302 | } | 302 | } |
303 | 303 | ||
304 | smp_mb(); | 304 | smp_mb(); |
@@ -454,9 +454,9 @@ static __inline__ void atomic64_add(long i, atomic64_t * v) | |||
454 | } else { | 454 | } else { |
455 | unsigned long flags; | 455 | unsigned long flags; |
456 | 456 | ||
457 | local_irq_save(flags); | 457 | raw_local_irq_save(flags); |
458 | v->counter += i; | 458 | v->counter += i; |
459 | local_irq_restore(flags); | 459 | raw_local_irq_restore(flags); |
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||
@@ -499,9 +499,9 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v) | |||
499 | } else { | 499 | } else { |
500 | unsigned long flags; | 500 | unsigned long flags; |
501 | 501 | ||
502 | local_irq_save(flags); | 502 | raw_local_irq_save(flags); |
503 | v->counter -= i; | 503 | v->counter -= i; |
504 | local_irq_restore(flags); | 504 | raw_local_irq_restore(flags); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
@@ -548,11 +548,11 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v) | |||
548 | } else { | 548 | } else { |
549 | unsigned long flags; | 549 | unsigned long flags; |
550 | 550 | ||
551 | local_irq_save(flags); | 551 | raw_local_irq_save(flags); |
552 | result = v->counter; | 552 | result = v->counter; |
553 | result += i; | 553 | result += i; |
554 | v->counter = result; | 554 | v->counter = result; |
555 | local_irq_restore(flags); | 555 | raw_local_irq_restore(flags); |
556 | } | 556 | } |
557 | 557 | ||
558 | smp_mb(); | 558 | smp_mb(); |
@@ -600,11 +600,11 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) | |||
600 | } else { | 600 | } else { |
601 | unsigned long flags; | 601 | unsigned long flags; |
602 | 602 | ||
603 | local_irq_save(flags); | 603 | raw_local_irq_save(flags); |
604 | result = v->counter; | 604 | result = v->counter; |
605 | result -= i; | 605 | result -= i; |
606 | v->counter = result; | 606 | v->counter = result; |
607 | local_irq_restore(flags); | 607 | raw_local_irq_restore(flags); |
608 | } | 608 | } |
609 | 609 | ||
610 | smp_mb(); | 610 | smp_mb(); |
@@ -668,12 +668,12 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v) | |||
668 | } else { | 668 | } else { |
669 | unsigned long flags; | 669 | unsigned long flags; |
670 | 670 | ||
671 | local_irq_save(flags); | 671 | raw_local_irq_save(flags); |
672 | result = v->counter; | 672 | result = v->counter; |
673 | result -= i; | 673 | result -= i; |
674 | if (result >= 0) | 674 | if (result >= 0) |
675 | v->counter = result; | 675 | v->counter = result; |
676 | local_irq_restore(flags); | 676 | raw_local_irq_restore(flags); |
677 | } | 677 | } |
678 | 678 | ||
679 | smp_mb(); | 679 | smp_mb(); |
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 8959da245cfb..d995413e11fd 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
@@ -100,9 +100,9 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
100 | 100 | ||
101 | a += nr >> SZLONG_LOG; | 101 | a += nr >> SZLONG_LOG; |
102 | mask = 1UL << bit; | 102 | mask = 1UL << bit; |
103 | local_irq_save(flags); | 103 | raw_local_irq_save(flags); |
104 | *a |= mask; | 104 | *a |= mask; |
105 | local_irq_restore(flags); | 105 | raw_local_irq_restore(flags); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
@@ -165,9 +165,9 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
165 | 165 | ||
166 | a += nr >> SZLONG_LOG; | 166 | a += nr >> SZLONG_LOG; |
167 | mask = 1UL << bit; | 167 | mask = 1UL << bit; |
168 | local_irq_save(flags); | 168 | raw_local_irq_save(flags); |
169 | *a &= ~mask; | 169 | *a &= ~mask; |
170 | local_irq_restore(flags); | 170 | raw_local_irq_restore(flags); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
@@ -220,9 +220,9 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
220 | 220 | ||
221 | a += nr >> SZLONG_LOG; | 221 | a += nr >> SZLONG_LOG; |
222 | mask = 1UL << bit; | 222 | mask = 1UL << bit; |
223 | local_irq_save(flags); | 223 | raw_local_irq_save(flags); |
224 | *a ^= mask; | 224 | *a ^= mask; |
225 | local_irq_restore(flags); | 225 | raw_local_irq_restore(flags); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
@@ -287,10 +287,10 @@ static inline int test_and_set_bit(unsigned long nr, | |||
287 | 287 | ||
288 | a += nr >> SZLONG_LOG; | 288 | a += nr >> SZLONG_LOG; |
289 | mask = 1UL << bit; | 289 | mask = 1UL << bit; |
290 | local_irq_save(flags); | 290 | raw_local_irq_save(flags); |
291 | retval = (mask & *a) != 0; | 291 | retval = (mask & *a) != 0; |
292 | *a |= mask; | 292 | *a |= mask; |
293 | local_irq_restore(flags); | 293 | raw_local_irq_restore(flags); |
294 | 294 | ||
295 | return retval; | 295 | return retval; |
296 | } | 296 | } |
@@ -381,10 +381,10 @@ static inline int test_and_clear_bit(unsigned long nr, | |||
381 | 381 | ||
382 | a += nr >> SZLONG_LOG; | 382 | a += nr >> SZLONG_LOG; |
383 | mask = 1UL << bit; | 383 | mask = 1UL << bit; |
384 | local_irq_save(flags); | 384 | raw_local_irq_save(flags); |
385 | retval = (mask & *a) != 0; | 385 | retval = (mask & *a) != 0; |
386 | *a &= ~mask; | 386 | *a &= ~mask; |
387 | local_irq_restore(flags); | 387 | raw_local_irq_restore(flags); |
388 | 388 | ||
389 | return retval; | 389 | return retval; |
390 | } | 390 | } |
@@ -452,10 +452,10 @@ static inline int test_and_change_bit(unsigned long nr, | |||
452 | 452 | ||
453 | a += nr >> SZLONG_LOG; | 453 | a += nr >> SZLONG_LOG; |
454 | mask = 1UL << bit; | 454 | mask = 1UL << bit; |
455 | local_irq_save(flags); | 455 | raw_local_irq_save(flags); |
456 | retval = (mask & *a) != 0; | 456 | retval = (mask & *a) != 0; |
457 | *a ^= mask; | 457 | *a ^= mask; |
458 | local_irq_restore(flags); | 458 | raw_local_irq_restore(flags); |
459 | 459 | ||
460 | return retval; | 460 | return retval; |
461 | } | 461 | } |
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h index eadca266f159..5e4bed123b48 100644 --- a/include/asm-mips/cpu-features.h +++ b/include/asm-mips/cpu-features.h | |||
@@ -40,6 +40,9 @@ | |||
40 | #endif | 40 | #endif |
41 | #ifndef cpu_has_fpu | 41 | #ifndef cpu_has_fpu |
42 | #define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU) | 42 | #define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU) |
43 | #define raw_cpu_has_fpu (raw_current_cpu_data.options & MIPS_CPU_FPU) | ||
44 | #else | ||
45 | #define raw_cpu_has_fpu cpu_has_fpu | ||
43 | #endif | 46 | #endif |
44 | #ifndef cpu_has_32fpr | 47 | #ifndef cpu_has_32fpr |
45 | #define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR) | 48 | #define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR) |
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h index 610d0cdeaa9e..22fe8453fcc7 100644 --- a/include/asm-mips/cpu-info.h +++ b/include/asm-mips/cpu-info.h | |||
@@ -87,6 +87,7 @@ struct cpuinfo_mips { | |||
87 | 87 | ||
88 | extern struct cpuinfo_mips cpu_data[]; | 88 | extern struct cpuinfo_mips cpu_data[]; |
89 | #define current_cpu_data cpu_data[smp_processor_id()] | 89 | #define current_cpu_data cpu_data[smp_processor_id()] |
90 | #define raw_current_cpu_data cpu_data[raw_smp_processor_id()] | ||
90 | 91 | ||
91 | extern void cpu_probe(void); | 92 | extern void cpu_probe(void); |
92 | extern void cpu_report(void); | 93 | extern void cpu_report(void); |
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h index efef843b93f0..4e12d1f9534f 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h | |||
@@ -27,11 +27,11 @@ | |||
27 | struct sigcontext; | 27 | struct sigcontext; |
28 | struct sigcontext32; | 28 | struct sigcontext32; |
29 | 29 | ||
30 | extern asmlinkage int (*save_fp_context)(struct sigcontext *sc); | 30 | extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc); |
31 | extern asmlinkage int (*restore_fp_context)(struct sigcontext *sc); | 31 | extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc); |
32 | 32 | ||
33 | extern asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc); | 33 | extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc); |
34 | extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc); | 34 | extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc); |
35 | 35 | ||
36 | extern void fpu_emulator_init_fpu(void); | 36 | extern void fpu_emulator_init_fpu(void); |
37 | extern void _init_fpu(void); | 37 | extern void _init_fpu(void); |
@@ -68,6 +68,8 @@ do { \ | |||
68 | /* We don't care about the c0 hazard here */ \ | 68 | /* We don't care about the c0 hazard here */ \ |
69 | } while (0) | 69 | } while (0) |
70 | 70 | ||
71 | #define __fpu_enabled() (read_c0_status() & ST0_CU1) | ||
72 | |||
71 | #define enable_fpu() \ | 73 | #define enable_fpu() \ |
72 | do { \ | 74 | do { \ |
73 | if (cpu_has_fpu) \ | 75 | if (cpu_has_fpu) \ |
@@ -93,31 +95,47 @@ static inline int is_fpu_owner(void) | |||
93 | return cpu_has_fpu && __is_fpu_owner(); | 95 | return cpu_has_fpu && __is_fpu_owner(); |
94 | } | 96 | } |
95 | 97 | ||
96 | static inline void own_fpu(void) | 98 | static inline void __own_fpu(void) |
97 | { | 99 | { |
98 | if (cpu_has_fpu) { | 100 | __enable_fpu(); |
99 | __enable_fpu(); | 101 | KSTK_STATUS(current) |= ST0_CU1; |
100 | KSTK_STATUS(current) |= ST0_CU1; | 102 | set_thread_flag(TIF_USEDFPU); |
101 | set_thread_flag(TIF_USEDFPU); | 103 | } |
104 | |||
105 | static inline void own_fpu(int restore) | ||
106 | { | ||
107 | preempt_disable(); | ||
108 | if (cpu_has_fpu && !__is_fpu_owner()) { | ||
109 | __own_fpu(); | ||
110 | if (restore) | ||
111 | _restore_fp(current); | ||
102 | } | 112 | } |
113 | preempt_enable(); | ||
103 | } | 114 | } |
104 | 115 | ||
105 | static inline void lose_fpu(void) | 116 | static inline void lose_fpu(int save) |
106 | { | 117 | { |
107 | if (cpu_has_fpu) { | 118 | preempt_disable(); |
119 | if (is_fpu_owner()) { | ||
120 | if (save) | ||
121 | _save_fp(current); | ||
108 | KSTK_STATUS(current) &= ~ST0_CU1; | 122 | KSTK_STATUS(current) &= ~ST0_CU1; |
109 | clear_thread_flag(TIF_USEDFPU); | 123 | clear_thread_flag(TIF_USEDFPU); |
110 | __disable_fpu(); | 124 | __disable_fpu(); |
111 | } | 125 | } |
126 | preempt_enable(); | ||
112 | } | 127 | } |
113 | 128 | ||
114 | static inline void init_fpu(void) | 129 | static inline void init_fpu(void) |
115 | { | 130 | { |
131 | preempt_disable(); | ||
116 | if (cpu_has_fpu) { | 132 | if (cpu_has_fpu) { |
133 | __own_fpu(); | ||
117 | _init_fpu(); | 134 | _init_fpu(); |
118 | } else { | 135 | } else { |
119 | fpu_emulator_init_fpu(); | 136 | fpu_emulator_init_fpu(); |
120 | } | 137 | } |
138 | preempt_enable(); | ||
121 | } | 139 | } |
122 | 140 | ||
123 | static inline void save_fp(struct task_struct *tsk) | 141 | static inline void save_fp(struct task_struct *tsk) |
@@ -144,4 +162,18 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) | |||
144 | return tsk->thread.fpu.fpr; | 162 | return tsk->thread.fpu.fpr; |
145 | } | 163 | } |
146 | 164 | ||
165 | static inline void enable_fp_in_kernel(void) | ||
166 | { | ||
167 | set_thread_flag(TIF_ALLOW_FP_IN_KERNEL); | ||
168 | /* make sure CU1 and FPU ownership are consistent */ | ||
169 | if (!__is_fpu_owner() && __fpu_enabled()) | ||
170 | __disable_fpu(); | ||
171 | } | ||
172 | |||
173 | static inline void disable_fp_in_kernel(void) | ||
174 | { | ||
175 | BUG_ON(!__is_fpu_owner() && __fpu_enabled()); | ||
176 | clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL); | ||
177 | } | ||
178 | |||
147 | #endif /* _ASM_FPU_H */ | 179 | #endif /* _ASM_FPU_H */ |
diff --git a/include/asm-mips/mach-ip27/dma-coherence.h b/include/asm-mips/mach-ip27/dma-coherence.h index 659816e200d4..3fdbbf68e952 100644 --- a/include/asm-mips/mach-ip27/dma-coherence.h +++ b/include/asm-mips/mach-ip27/dma-coherence.h | |||
@@ -18,7 +18,8 @@ | |||
18 | 18 | ||
19 | struct device; | 19 | struct device; |
20 | 20 | ||
21 | static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) | 21 | static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, |
22 | size_t size) | ||
22 | { | 23 | { |
23 | dma_addr_t pa = dev_to_baddr(dev, virt_to_phys(addr)); | 24 | dma_addr_t pa = dev_to_baddr(dev, virt_to_phys(addr)); |
24 | 25 | ||
@@ -37,7 +38,7 @@ static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) | |||
37 | return dma_addr & (0xffUL << 56); | 38 | return dma_addr & (0xffUL << 56); |
38 | } | 39 | } |
39 | 40 | ||
40 | static void plat_unmap_dma_mem(dma_addr_t dma_addr) | 41 | static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) |
41 | { | 42 | { |
42 | } | 43 | } |
43 | 44 | ||
diff --git a/include/asm-mips/mach-ip32/dma-coherence.h b/include/asm-mips/mach-ip32/dma-coherence.h index 950be17bbb86..c3f9a6a20eb0 100644 --- a/include/asm-mips/mach-ip32/dma-coherence.h +++ b/include/asm-mips/mach-ip32/dma-coherence.h | |||
@@ -26,7 +26,8 @@ struct device; | |||
26 | 26 | ||
27 | #define RAM_OFFSET_MASK 0x3fffffffUL | 27 | #define RAM_OFFSET_MASK 0x3fffffffUL |
28 | 28 | ||
29 | static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) | 29 | static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, |
30 | size_t size) | ||
30 | { | 31 | { |
31 | dma_addr_t pa = virt_to_phys(addr) & RAM_OFFSET_MASK; | 32 | dma_addr_t pa = virt_to_phys(addr) & RAM_OFFSET_MASK; |
32 | 33 | ||
@@ -59,7 +60,7 @@ static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) | |||
59 | return addr; | 60 | return addr; |
60 | } | 61 | } |
61 | 62 | ||
62 | static void plat_unmap_dma_mem(dma_addr_t dma_addr) | 63 | static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) |
63 | { | 64 | { |
64 | } | 65 | } |
65 | 66 | ||
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h index 59162f74a798..65778c890a62 100644 --- a/include/asm-mips/rtlx.h +++ b/include/asm-mips/rtlx.h | |||
@@ -23,8 +23,8 @@ | |||
23 | 23 | ||
24 | extern int rtlx_open(int index, int can_sleep); | 24 | extern int rtlx_open(int index, int can_sleep); |
25 | extern int rtlx_release(int index); | 25 | extern int rtlx_release(int index); |
26 | extern ssize_t rtlx_read(int index, void *buff, size_t count, int user); | 26 | extern ssize_t rtlx_read(int index, void __user *buff, size_t count); |
27 | extern ssize_t rtlx_write(int index, void *buffer, size_t count, int user); | 27 | extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count); |
28 | extern unsigned int rtlx_read_poll(int index, int can_sleep); | 28 | extern unsigned int rtlx_read_poll(int index, int can_sleep); |
29 | extern unsigned int rtlx_write_poll(int index); | 29 | extern unsigned int rtlx_write_poll(int index); |
30 | 30 | ||
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index 597a3743f6a1..290887077e44 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h | |||
@@ -121,10 +121,10 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val) | |||
121 | } else { | 121 | } else { |
122 | unsigned long flags; | 122 | unsigned long flags; |
123 | 123 | ||
124 | local_irq_save(flags); | 124 | raw_local_irq_save(flags); |
125 | retval = *m; | 125 | retval = *m; |
126 | *m = val; | 126 | *m = val; |
127 | local_irq_restore(flags); /* implies memory barrier */ | 127 | raw_local_irq_restore(flags); /* implies memory barrier */ |
128 | } | 128 | } |
129 | 129 | ||
130 | smp_mb(); | 130 | smp_mb(); |
@@ -169,10 +169,10 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val) | |||
169 | } else { | 169 | } else { |
170 | unsigned long flags; | 170 | unsigned long flags; |
171 | 171 | ||
172 | local_irq_save(flags); | 172 | raw_local_irq_save(flags); |
173 | retval = *m; | 173 | retval = *m; |
174 | *m = val; | 174 | *m = val; |
175 | local_irq_restore(flags); /* implies memory barrier */ | 175 | raw_local_irq_restore(flags); /* implies memory barrier */ |
176 | } | 176 | } |
177 | 177 | ||
178 | smp_mb(); | 178 | smp_mb(); |
@@ -250,11 +250,11 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old, | |||
250 | } else { | 250 | } else { |
251 | unsigned long flags; | 251 | unsigned long flags; |
252 | 252 | ||
253 | local_irq_save(flags); | 253 | raw_local_irq_save(flags); |
254 | retval = *m; | 254 | retval = *m; |
255 | if (retval == old) | 255 | if (retval == old) |
256 | *m = new; | 256 | *m = new; |
257 | local_irq_restore(flags); /* implies memory barrier */ | 257 | raw_local_irq_restore(flags); /* implies memory barrier */ |
258 | } | 258 | } |
259 | 259 | ||
260 | smp_mb(); | 260 | smp_mb(); |
@@ -304,11 +304,11 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old, | |||
304 | } else { | 304 | } else { |
305 | unsigned long flags; | 305 | unsigned long flags; |
306 | 306 | ||
307 | local_irq_save(flags); | 307 | raw_local_irq_save(flags); |
308 | retval = *m; | 308 | retval = *m; |
309 | if (retval == old) | 309 | if (retval == old) |
310 | *m = new; | 310 | *m = new; |
311 | local_irq_restore(flags); /* implies memory barrier */ | 311 | raw_local_irq_restore(flags); /* implies memory barrier */ |
312 | } | 312 | } |
313 | 313 | ||
314 | smp_mb(); | 314 | smp_mb(); |
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h index fbcda8204473..6cf05f4a4e7e 100644 --- a/include/asm-mips/thread_info.h +++ b/include/asm-mips/thread_info.h | |||
@@ -119,6 +119,7 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
119 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 119 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
120 | #define TIF_MEMDIE 18 | 120 | #define TIF_MEMDIE 18 |
121 | #define TIF_FREEZE 19 | 121 | #define TIF_FREEZE 19 |
122 | #define TIF_ALLOW_FP_IN_KERNEL 20 | ||
122 | #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ | 123 | #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ |
123 | 124 | ||
124 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 125 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h index e82612cd9f33..ab55ffcb7bf4 100644 --- a/include/asm-sparc64/tsb.h +++ b/include/asm-sparc64/tsb.h | |||
@@ -264,6 +264,7 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
264 | be,a,pt %xcc, OK_LABEL; \ | 264 | be,a,pt %xcc, OK_LABEL; \ |
265 | mov REG4, REG1; | 265 | mov REG4, REG1; |
266 | 266 | ||
267 | #ifndef CONFIG_DEBUG_PAGEALLOC | ||
267 | /* This version uses a trick, the TAG is already (VADDR >> 22) so | 268 | /* This version uses a trick, the TAG is already (VADDR >> 22) so |
268 | * we can make use of that for the index computation. | 269 | * we can make use of that for the index computation. |
269 | */ | 270 | */ |
@@ -277,5 +278,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
277 | cmp REG3, TAG; \ | 278 | cmp REG3, TAG; \ |
278 | be,a,pt %xcc, OK_LABEL; \ | 279 | be,a,pt %xcc, OK_LABEL; \ |
279 | mov REG4, REG1; | 280 | mov REG4, REG1; |
281 | #endif | ||
280 | 282 | ||
281 | #endif /* !(_SPARC64_TSB_H) */ | 283 | #endif /* !(_SPARC64_TSB_H) */ |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 7011d6255593..f2542c24b328 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -93,6 +93,7 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) | |||
93 | void clear_bdi_congested(struct backing_dev_info *bdi, int rw); | 93 | void clear_bdi_congested(struct backing_dev_info *bdi, int rw); |
94 | void set_bdi_congested(struct backing_dev_info *bdi, int rw); | 94 | void set_bdi_congested(struct backing_dev_info *bdi, int rw); |
95 | long congestion_wait(int rw, long timeout); | 95 | long congestion_wait(int rw, long timeout); |
96 | long congestion_wait_interruptible(int rw, long timeout); | ||
96 | void congestion_end(int rw); | 97 | void congestion_end(int rw); |
97 | 98 | ||
98 | #define bdi_cap_writeback_dirty(bdi) \ | 99 | #define bdi_cap_writeback_dirty(bdi) \ |
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index 06c58c423fe1..506ad20c18f8 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
@@ -75,7 +75,7 @@ extern int do_poke_blanked_console; | |||
75 | 75 | ||
76 | extern void (*kbd_ledfunc)(unsigned int led); | 76 | extern void (*kbd_ledfunc)(unsigned int led); |
77 | 77 | ||
78 | extern void set_console(int nr); | 78 | extern int set_console(int nr); |
79 | extern void schedule_console_callback(void); | 79 | extern void schedule_console_callback(void); |
80 | 80 | ||
81 | static inline void set_leds(void) | 81 | static inline void set_leds(void) |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index c68c7ac6b232..248305bb9a18 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -57,7 +57,11 @@ typedef union { | |||
57 | } ktime_t; | 57 | } ktime_t; |
58 | 58 | ||
59 | #define KTIME_MAX ((s64)~((u64)1 << 63)) | 59 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
60 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) | 60 | #if (BITS_PER_LONG == 64) |
61 | # define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) | ||
62 | #else | ||
63 | # define KTIME_SEC_MAX LONG_MAX | ||
64 | #endif | ||
61 | 65 | ||
62 | /* | 66 | /* |
63 | * ktime_t definitions when using the 64-bit scalar representation: | 67 | * ktime_t definitions when using the 64-bit scalar representation: |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 47aaa2c66738..e9ae0c6e2c62 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -415,6 +415,7 @@ extern void nfs_complete_unlink(struct dentry *); | |||
415 | /* | 415 | /* |
416 | * linux/fs/nfs/write.c | 416 | * linux/fs/nfs/write.c |
417 | */ | 417 | */ |
418 | extern int nfs_congestion_kb; | ||
418 | extern int nfs_writepage(struct page *page, struct writeback_control *wbc); | 419 | extern int nfs_writepage(struct page *page, struct writeback_control *wbc); |
419 | extern int nfs_writepages(struct address_space *, struct writeback_control *); | 420 | extern int nfs_writepages(struct address_space *, struct writeback_control *); |
420 | extern int nfs_flush_incompatible(struct file *file, struct page *page); | 421 | extern int nfs_flush_incompatible(struct file *file, struct page *page); |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 95796e6924f1..c95d5e642548 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -82,6 +82,7 @@ struct nfs_server { | |||
82 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ | 82 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ |
83 | struct nfs_iostats * io_stats; /* I/O statistics */ | 83 | struct nfs_iostats * io_stats; /* I/O statistics */ |
84 | struct backing_dev_info backing_dev_info; | 84 | struct backing_dev_info backing_dev_info; |
85 | atomic_t writeback; /* number of writeback pages */ | ||
85 | int flags; /* various flags */ | 86 | int flags; /* various flags */ |
86 | unsigned int caps; /* server capabilities */ | 87 | unsigned int caps; /* server capabilities */ |
87 | unsigned int rsize; /* read size */ | 88 | unsigned int rsize; /* read size */ |
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 2e8c048b9b80..9dbca629dcfb 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -25,7 +25,6 @@ struct spi_bitbang { | |||
25 | spinlock_t lock; | 25 | spinlock_t lock; |
26 | struct list_head queue; | 26 | struct list_head queue; |
27 | u8 busy; | 27 | u8 busy; |
28 | u8 shutdown; | ||
29 | u8 use_dma; | 28 | u8 use_dma; |
30 | 29 | ||
31 | struct spi_master *master; | 30 | struct spi_master *master; |
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index dc2e9fe69418..daeba22b7656 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h | |||
@@ -649,10 +649,10 @@ struct ufs2_inode { | |||
649 | __fs32 ui_blksize; /* 12: Inode blocksize. */ | 649 | __fs32 ui_blksize; /* 12: Inode blocksize. */ |
650 | __fs64 ui_size; /* 16: File byte count. */ | 650 | __fs64 ui_size; /* 16: File byte count. */ |
651 | __fs64 ui_blocks; /* 24: Bytes actually held. */ | 651 | __fs64 ui_blocks; /* 24: Bytes actually held. */ |
652 | struct ufs_timeval ui_atime; /* 32: Last access time. */ | 652 | __fs64 ui_atime; /* 32: Last access time. */ |
653 | struct ufs_timeval ui_mtime; /* 40: Last modified time. */ | 653 | __fs64 ui_mtime; /* 40: Last modified time. */ |
654 | struct ufs_timeval ui_ctime; /* 48: Last inode change time. */ | 654 | __fs64 ui_ctime; /* 48: Last inode change time. */ |
655 | struct ufs_timeval ui_birthtime; /* 56: Inode creation time. */ | 655 | __fs64 ui_birthtime; /* 56: Inode creation time. */ |
656 | __fs32 ui_mtimensec; /* 64: Last modified time. */ | 656 | __fs32 ui_mtimensec; /* 64: Last modified time. */ |
657 | __fs32 ui_atimensec; /* 68: Last access time. */ | 657 | __fs32 ui_atimensec; /* 68: Last access time. */ |
658 | __fs32 ui_ctimensec; /* 72: Last inode change time. */ | 658 | __fs32 ui_ctimensec; /* 72: Last inode change time. */ |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 37a1a41f5b65..e0db669998f3 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -83,6 +83,7 @@ void reset_vc(struct vc_data *vc); | |||
83 | #define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) | 83 | #define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) |
84 | extern char con_buf[CON_BUF_SIZE]; | 84 | extern char con_buf[CON_BUF_SIZE]; |
85 | extern struct semaphore con_buf_sem; | 85 | extern struct semaphore con_buf_sem; |
86 | extern char vt_dont_switch; | ||
86 | 87 | ||
87 | struct vt_spawn_console { | 88 | struct vt_spawn_console { |
88 | spinlock_t lock; | 89 | spinlock_t lock; |
diff --git a/kernel/fork.c b/kernel/fork.c index d154cc786489..6af959c034d8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -933,8 +933,8 @@ asmlinkage long sys_set_tid_address(int __user *tidptr) | |||
933 | 933 | ||
934 | static inline void rt_mutex_init_task(struct task_struct *p) | 934 | static inline void rt_mutex_init_task(struct task_struct *p) |
935 | { | 935 | { |
936 | #ifdef CONFIG_RT_MUTEXES | ||
937 | spin_lock_init(&p->pi_lock); | 936 | spin_lock_init(&p->pi_lock); |
937 | #ifdef CONFIG_RT_MUTEXES | ||
938 | plist_head_init(&p->pi_waiters, &p->pi_lock); | 938 | plist_head_init(&p->pi_waiters, &p->pi_lock); |
939 | p->pi_blocked_on = NULL; | 939 | p->pi_blocked_on = NULL; |
940 | #endif | 940 | #endif |
diff --git a/kernel/futex.c b/kernel/futex.c index e749e7df14b1..5a270b5e3f95 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -565,6 +565,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) | |||
565 | if (!pi_state) | 565 | if (!pi_state) |
566 | return -EINVAL; | 566 | return -EINVAL; |
567 | 567 | ||
568 | spin_lock(&pi_state->pi_mutex.wait_lock); | ||
568 | new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); | 569 | new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); |
569 | 570 | ||
570 | /* | 571 | /* |
@@ -604,6 +605,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) | |||
604 | pi_state->owner = new_owner; | 605 | pi_state->owner = new_owner; |
605 | spin_unlock_irq(&new_owner->pi_lock); | 606 | spin_unlock_irq(&new_owner->pi_lock); |
606 | 607 | ||
608 | spin_unlock(&pi_state->pi_mutex.wait_lock); | ||
607 | rt_mutex_unlock(&pi_state->pi_mutex); | 609 | rt_mutex_unlock(&pi_state->pi_mutex); |
608 | 610 | ||
609 | return 0; | 611 | return 0; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index ec4cb9f3e3b7..6a7938a0d513 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -135,7 +135,7 @@ EXPORT_SYMBOL_GPL(ktime_get_ts); | |||
135 | static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | 135 | static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) |
136 | { | 136 | { |
137 | ktime_t xtim, tomono; | 137 | ktime_t xtim, tomono; |
138 | struct timespec xts; | 138 | struct timespec xts, tom; |
139 | unsigned long seq; | 139 | unsigned long seq; |
140 | 140 | ||
141 | do { | 141 | do { |
@@ -145,10 +145,11 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
145 | #else | 145 | #else |
146 | xts = xtime; | 146 | xts = xtime; |
147 | #endif | 147 | #endif |
148 | tom = wall_to_monotonic; | ||
148 | } while (read_seqretry(&xtime_lock, seq)); | 149 | } while (read_seqretry(&xtime_lock, seq)); |
149 | 150 | ||
150 | xtim = timespec_to_ktime(xts); | 151 | xtim = timespec_to_ktime(xts); |
151 | tomono = timespec_to_ktime(wall_to_monotonic); | 152 | tomono = timespec_to_ktime(tom); |
152 | base->clock_base[CLOCK_REALTIME].softirq_time = xtim; | 153 | base->clock_base[CLOCK_REALTIME].softirq_time = xtim; |
153 | base->clock_base[CLOCK_MONOTONIC].softirq_time = | 154 | base->clock_base[CLOCK_MONOTONIC].softirq_time = |
154 | ktime_add(xtim, tomono); | 155 | ktime_add(xtim, tomono); |
@@ -644,6 +645,12 @@ hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) | |||
644 | orun++; | 645 | orun++; |
645 | } | 646 | } |
646 | timer->expires = ktime_add(timer->expires, interval); | 647 | timer->expires = ktime_add(timer->expires, interval); |
648 | /* | ||
649 | * Make sure, that the result did not wrap with a very large | ||
650 | * interval. | ||
651 | */ | ||
652 | if (timer->expires.tv64 < 0) | ||
653 | timer->expires = ktime_set(KTIME_SEC_MAX, 0); | ||
647 | 654 | ||
648 | return orun; | 655 | return orun; |
649 | } | 656 | } |
diff --git a/kernel/power/console.c b/kernel/power/console.c index 623786d44159..89bcf4973ee5 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c | |||
@@ -27,7 +27,15 @@ int pm_prepare_console(void) | |||
27 | return 1; | 27 | return 1; |
28 | } | 28 | } |
29 | 29 | ||
30 | set_console(SUSPEND_CONSOLE); | 30 | if (set_console(SUSPEND_CONSOLE)) { |
31 | /* | ||
32 | * We're unable to switch to the SUSPEND_CONSOLE. | ||
33 | * Let the calling function know so it can decide | ||
34 | * what to do. | ||
35 | */ | ||
36 | release_console_sem(); | ||
37 | return 1; | ||
38 | } | ||
31 | release_console_sem(); | 39 | release_console_sem(); |
32 | 40 | ||
33 | if (vt_waitactive(SUSPEND_CONSOLE)) { | 41 | if (vt_waitactive(SUSPEND_CONSOLE)) { |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 406b20adb27a..873cdf8ea5a4 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -58,6 +58,7 @@ static inline int platform_prepare(void) | |||
58 | 58 | ||
59 | static void power_down(suspend_disk_method_t mode) | 59 | static void power_down(suspend_disk_method_t mode) |
60 | { | 60 | { |
61 | disable_nonboot_cpus(); | ||
61 | switch(mode) { | 62 | switch(mode) { |
62 | case PM_DISK_PLATFORM: | 63 | case PM_DISK_PLATFORM: |
63 | if (pm_ops && pm_ops->enter) { | 64 | if (pm_ops && pm_ops->enter) { |
@@ -251,6 +252,7 @@ static int software_resume(void) | |||
251 | error = swsusp_read(); | 252 | error = swsusp_read(); |
252 | if (error) { | 253 | if (error) { |
253 | swsusp_free(); | 254 | swsusp_free(); |
255 | platform_finish(); | ||
254 | goto Thaw; | 256 | goto Thaw; |
255 | } | 257 | } |
256 | 258 | ||
diff --git a/kernel/power/user.c b/kernel/power/user.c index dd09efe7df54..d6a8dcc26ae5 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -398,9 +398,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
398 | 398 | ||
399 | case PMOPS_ENTER: | 399 | case PMOPS_ENTER: |
400 | if (data->platform_suspend) { | 400 | if (data->platform_suspend) { |
401 | disable_nonboot_cpus(); | ||
401 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); | 402 | kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); |
402 | error = pm_ops->enter(PM_SUSPEND_DISK); | 403 | error = pm_ops->enter(PM_SUSPEND_DISK); |
403 | error = 0; | 404 | enable_nonboot_cpus(); |
404 | } | 405 | } |
405 | break; | 406 | break; |
406 | 407 | ||
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 5567745470f7..eadfce2fff74 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -307,12 +307,19 @@ int tick_resume_broadcast(void) | |||
307 | spin_lock_irqsave(&tick_broadcast_lock, flags); | 307 | spin_lock_irqsave(&tick_broadcast_lock, flags); |
308 | 308 | ||
309 | bc = tick_broadcast_device.evtdev; | 309 | bc = tick_broadcast_device.evtdev; |
310 | if (bc) { | ||
311 | if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC && | ||
312 | !cpus_empty(tick_broadcast_mask)) | ||
313 | tick_broadcast_start_periodic(bc); | ||
314 | 310 | ||
315 | broadcast = cpu_isset(smp_processor_id(), tick_broadcast_mask); | 311 | if (bc) { |
312 | switch (tick_broadcast_device.mode) { | ||
313 | case TICKDEV_MODE_PERIODIC: | ||
314 | if(!cpus_empty(tick_broadcast_mask)) | ||
315 | tick_broadcast_start_periodic(bc); | ||
316 | broadcast = cpu_isset(smp_processor_id(), | ||
317 | tick_broadcast_mask); | ||
318 | break; | ||
319 | case TICKDEV_MODE_ONESHOT: | ||
320 | broadcast = tick_resume_broadcast_oneshot(bc); | ||
321 | break; | ||
322 | } | ||
316 | } | 323 | } |
317 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); | 324 | spin_unlock_irqrestore(&tick_broadcast_lock, flags); |
318 | 325 | ||
@@ -347,6 +354,16 @@ static int tick_broadcast_set_event(ktime_t expires, int force) | |||
347 | } | 354 | } |
348 | } | 355 | } |
349 | 356 | ||
357 | int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | ||
358 | { | ||
359 | clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); | ||
360 | |||
361 | if(!cpus_empty(tick_broadcast_oneshot_mask)) | ||
362 | tick_broadcast_set_event(ktime_get(), 1); | ||
363 | |||
364 | return cpu_isset(smp_processor_id(), tick_broadcast_oneshot_mask); | ||
365 | } | ||
366 | |||
350 | /* | 367 | /* |
351 | * Reprogram the broadcast device: | 368 | * Reprogram the broadcast device: |
352 | * | 369 | * |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 43ba1bdec14c..bfda3f7f0716 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -298,18 +298,17 @@ static void tick_shutdown(unsigned int *cpup) | |||
298 | spin_unlock_irqrestore(&tick_device_lock, flags); | 298 | spin_unlock_irqrestore(&tick_device_lock, flags); |
299 | } | 299 | } |
300 | 300 | ||
301 | static void tick_suspend_periodic(void) | 301 | static void tick_suspend(void) |
302 | { | 302 | { |
303 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 303 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); |
304 | unsigned long flags; | 304 | unsigned long flags; |
305 | 305 | ||
306 | spin_lock_irqsave(&tick_device_lock, flags); | 306 | spin_lock_irqsave(&tick_device_lock, flags); |
307 | if (td->mode == TICKDEV_MODE_PERIODIC) | 307 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); |
308 | clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); | ||
309 | spin_unlock_irqrestore(&tick_device_lock, flags); | 308 | spin_unlock_irqrestore(&tick_device_lock, flags); |
310 | } | 309 | } |
311 | 310 | ||
312 | static void tick_resume_periodic(void) | 311 | static void tick_resume(void) |
313 | { | 312 | { |
314 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | 313 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); |
315 | unsigned long flags; | 314 | unsigned long flags; |
@@ -317,6 +316,8 @@ static void tick_resume_periodic(void) | |||
317 | spin_lock_irqsave(&tick_device_lock, flags); | 316 | spin_lock_irqsave(&tick_device_lock, flags); |
318 | if (td->mode == TICKDEV_MODE_PERIODIC) | 317 | if (td->mode == TICKDEV_MODE_PERIODIC) |
319 | tick_setup_periodic(td->evtdev, 0); | 318 | tick_setup_periodic(td->evtdev, 0); |
319 | else | ||
320 | tick_resume_oneshot(); | ||
320 | spin_unlock_irqrestore(&tick_device_lock, flags); | 321 | spin_unlock_irqrestore(&tick_device_lock, flags); |
321 | } | 322 | } |
322 | 323 | ||
@@ -348,13 +349,13 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason, | |||
348 | break; | 349 | break; |
349 | 350 | ||
350 | case CLOCK_EVT_NOTIFY_SUSPEND: | 351 | case CLOCK_EVT_NOTIFY_SUSPEND: |
351 | tick_suspend_periodic(); | 352 | tick_suspend(); |
352 | tick_suspend_broadcast(); | 353 | tick_suspend_broadcast(); |
353 | break; | 354 | break; |
354 | 355 | ||
355 | case CLOCK_EVT_NOTIFY_RESUME: | 356 | case CLOCK_EVT_NOTIFY_RESUME: |
356 | if (!tick_resume_broadcast()) | 357 | if (!tick_resume_broadcast()) |
357 | tick_resume_periodic(); | 358 | tick_resume(); |
358 | break; | 359 | break; |
359 | 360 | ||
360 | default: | 361 | default: |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 75890efd24ff..c9d203bde518 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -19,12 +19,13 @@ extern void tick_setup_oneshot(struct clock_event_device *newdev, | |||
19 | extern int tick_program_event(ktime_t expires, int force); | 19 | extern int tick_program_event(ktime_t expires, int force); |
20 | extern void tick_oneshot_notify(void); | 20 | extern void tick_oneshot_notify(void); |
21 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); | 21 | extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); |
22 | 22 | extern void tick_resume_oneshot(void); | |
23 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 23 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
24 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); | 24 | extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); |
25 | extern void tick_broadcast_oneshot_control(unsigned long reason); | 25 | extern void tick_broadcast_oneshot_control(unsigned long reason); |
26 | extern void tick_broadcast_switch_to_oneshot(void); | 26 | extern void tick_broadcast_switch_to_oneshot(void); |
27 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | 27 | extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); |
28 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | ||
28 | # else /* BROADCAST */ | 29 | # else /* BROADCAST */ |
29 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 30 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
30 | { | 31 | { |
@@ -43,6 +44,10 @@ void tick_setup_oneshot(struct clock_event_device *newdev, | |||
43 | { | 44 | { |
44 | BUG(); | 45 | BUG(); |
45 | } | 46 | } |
47 | static inline void tick_resume_oneshot(void) | ||
48 | { | ||
49 | BUG(); | ||
50 | } | ||
46 | static inline int tick_program_event(ktime_t expires, int force) | 51 | static inline int tick_program_event(ktime_t expires, int force) |
47 | { | 52 | { |
48 | return 0; | 53 | return 0; |
@@ -54,6 +59,10 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |||
54 | } | 59 | } |
55 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } | 60 | static inline void tick_broadcast_oneshot_control(unsigned long reason) { } |
56 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 61 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
62 | static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | ||
63 | { | ||
64 | return 0; | ||
65 | } | ||
57 | #endif /* !TICK_ONESHOT */ | 66 | #endif /* !TICK_ONESHOT */ |
58 | 67 | ||
59 | /* | 68 | /* |
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 2e8b7ff863cc..f6997ab0c3c9 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c | |||
@@ -41,6 +41,18 @@ int tick_program_event(ktime_t expires, int force) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * tick_resume_onshot - resume oneshot mode | ||
45 | */ | ||
46 | void tick_resume_oneshot(void) | ||
47 | { | ||
48 | struct tick_device *td = &__get_cpu_var(tick_cpu_device); | ||
49 | struct clock_event_device *dev = td->evtdev; | ||
50 | |||
51 | clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); | ||
52 | tick_program_event(ktime_get(), 1); | ||
53 | } | ||
54 | |||
55 | /** | ||
44 | * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) | 56 | * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) |
45 | */ | 57 | */ |
46 | void tick_setup_oneshot(struct clock_event_device *newdev, | 58 | void tick_setup_oneshot(struct clock_event_device *newdev, |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index f50a2811f9dc..e5de3781d3fe 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -55,6 +55,22 @@ long congestion_wait(int rw, long timeout) | |||
55 | } | 55 | } |
56 | EXPORT_SYMBOL(congestion_wait); | 56 | EXPORT_SYMBOL(congestion_wait); |
57 | 57 | ||
58 | long congestion_wait_interruptible(int rw, long timeout) | ||
59 | { | ||
60 | long ret; | ||
61 | DEFINE_WAIT(wait); | ||
62 | wait_queue_head_t *wqh = &congestion_wqh[rw]; | ||
63 | |||
64 | prepare_to_wait(wqh, &wait, TASK_INTERRUPTIBLE); | ||
65 | if (signal_pending(current)) | ||
66 | ret = -ERESTARTSYS; | ||
67 | else | ||
68 | ret = io_schedule_timeout(timeout); | ||
69 | finish_wait(wqh, &wait); | ||
70 | return ret; | ||
71 | } | ||
72 | EXPORT_SYMBOL(congestion_wait_interruptible); | ||
73 | |||
58 | /** | 74 | /** |
59 | * congestion_end - wake up sleepers on a congested backing_dev_info | 75 | * congestion_end - wake up sleepers on a congested backing_dev_info |
60 | * @rw: READ or WRITE | 76 | * @rw: READ or WRITE |
diff --git a/mm/filemap.c b/mm/filemap.c index d1060b8d3cd6..5dfc093ceb3d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2379,7 +2379,8 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
2379 | struct file *file = iocb->ki_filp; | 2379 | struct file *file = iocb->ki_filp; |
2380 | struct address_space *mapping = file->f_mapping; | 2380 | struct address_space *mapping = file->f_mapping; |
2381 | ssize_t retval; | 2381 | ssize_t retval; |
2382 | size_t write_len = 0; | 2382 | size_t write_len; |
2383 | pgoff_t end = 0; /* silence gcc */ | ||
2383 | 2384 | ||
2384 | /* | 2385 | /* |
2385 | * If it's a write, unmap all mmappings of the file up-front. This | 2386 | * If it's a write, unmap all mmappings of the file up-front. This |
@@ -2388,23 +2389,46 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
2388 | */ | 2389 | */ |
2389 | if (rw == WRITE) { | 2390 | if (rw == WRITE) { |
2390 | write_len = iov_length(iov, nr_segs); | 2391 | write_len = iov_length(iov, nr_segs); |
2392 | end = (offset + write_len - 1) >> PAGE_CACHE_SHIFT; | ||
2391 | if (mapping_mapped(mapping)) | 2393 | if (mapping_mapped(mapping)) |
2392 | unmap_mapping_range(mapping, offset, write_len, 0); | 2394 | unmap_mapping_range(mapping, offset, write_len, 0); |
2393 | } | 2395 | } |
2394 | 2396 | ||
2395 | retval = filemap_write_and_wait(mapping); | 2397 | retval = filemap_write_and_wait(mapping); |
2396 | if (retval == 0) { | 2398 | if (retval) |
2397 | retval = mapping->a_ops->direct_IO(rw, iocb, iov, | 2399 | goto out; |
2398 | offset, nr_segs); | 2400 | |
2399 | if (rw == WRITE && mapping->nrpages) { | 2401 | /* |
2400 | pgoff_t end = (offset + write_len - 1) | 2402 | * After a write we want buffered reads to be sure to go to disk to get |
2401 | >> PAGE_CACHE_SHIFT; | 2403 | * the new data. We invalidate clean cached page from the region we're |
2402 | int err = invalidate_inode_pages2_range(mapping, | 2404 | * about to write. We do this *before* the write so that we can return |
2405 | * -EIO without clobbering -EIOCBQUEUED from ->direct_IO(). | ||
2406 | */ | ||
2407 | if (rw == WRITE && mapping->nrpages) { | ||
2408 | retval = invalidate_inode_pages2_range(mapping, | ||
2403 | offset >> PAGE_CACHE_SHIFT, end); | 2409 | offset >> PAGE_CACHE_SHIFT, end); |
2404 | if (err) | 2410 | if (retval) |
2405 | retval = err; | 2411 | goto out; |
2406 | } | ||
2407 | } | 2412 | } |
2413 | |||
2414 | retval = mapping->a_ops->direct_IO(rw, iocb, iov, offset, nr_segs); | ||
2415 | if (retval) | ||
2416 | goto out; | ||
2417 | |||
2418 | /* | ||
2419 | * Finally, try again to invalidate clean pages which might have been | ||
2420 | * faulted in by get_user_pages() if the source of the write was an | ||
2421 | * mmap()ed region of the file we're writing. That's a pretty crazy | ||
2422 | * thing to do, so we don't support it 100%. If this invalidation | ||
2423 | * fails and we have -EIOCBQUEUED we ignore the failure. | ||
2424 | */ | ||
2425 | if (rw == WRITE && mapping->nrpages) { | ||
2426 | int err = invalidate_inode_pages2_range(mapping, | ||
2427 | offset >> PAGE_CACHE_SHIFT, end); | ||
2428 | if (err && retval >= 0) | ||
2429 | retval = err; | ||
2430 | } | ||
2431 | out: | ||
2408 | return retval; | 2432 | return retval; |
2409 | } | 2433 | } |
2410 | 2434 | ||
diff --git a/mm/madvise.c b/mm/madvise.c index 4e196155a0c3..77916e9fc52b 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -155,11 +155,14 @@ static long madvise_dontneed(struct vm_area_struct * vma, | |||
155 | * Other filesystems return -ENOSYS. | 155 | * Other filesystems return -ENOSYS. |
156 | */ | 156 | */ |
157 | static long madvise_remove(struct vm_area_struct *vma, | 157 | static long madvise_remove(struct vm_area_struct *vma, |
158 | struct vm_area_struct **prev, | ||
158 | unsigned long start, unsigned long end) | 159 | unsigned long start, unsigned long end) |
159 | { | 160 | { |
160 | struct address_space *mapping; | 161 | struct address_space *mapping; |
161 | loff_t offset, endoff; | 162 | loff_t offset, endoff; |
162 | 163 | ||
164 | *prev = vma; | ||
165 | |||
163 | if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) | 166 | if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) |
164 | return -EINVAL; | 167 | return -EINVAL; |
165 | 168 | ||
@@ -199,7 +202,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, | |||
199 | error = madvise_behavior(vma, prev, start, end, behavior); | 202 | error = madvise_behavior(vma, prev, start, end, behavior); |
200 | break; | 203 | break; |
201 | case MADV_REMOVE: | 204 | case MADV_REMOVE: |
202 | error = madvise_remove(vma, start, end); | 205 | error = madvise_remove(vma, prev, start, end); |
203 | break; | 206 | break; |
204 | 207 | ||
205 | case MADV_WILLNEED: | 208 | case MADV_WILLNEED: |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index b278b8d60eee..2f3916986abf 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -320,7 +320,7 @@ static int oom_kill_task(struct task_struct *p) | |||
320 | * Don't kill the process if any threads are set to OOM_DISABLE | 320 | * Don't kill the process if any threads are set to OOM_DISABLE |
321 | */ | 321 | */ |
322 | do_each_thread(g, q) { | 322 | do_each_thread(g, q) { |
323 | if (q->mm == mm && p->oomkilladj == OOM_DISABLE) | 323 | if (q->mm == mm && q->oomkilladj == OOM_DISABLE) |
324 | return 1; | 324 | return 1; |
325 | } while_each_thread(g, q); | 325 | } while_each_thread(g, q); |
326 | 326 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 820761f9eeef..702fa8f08747 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -463,6 +463,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
463 | memcpy(n->cb, skb->cb, sizeof(skb->cb)); | 463 | memcpy(n->cb, skb->cb, sizeof(skb->cb)); |
464 | C(len); | 464 | C(len); |
465 | C(data_len); | 465 | C(data_len); |
466 | C(mac_len); | ||
466 | C(csum); | 467 | C(csum); |
467 | C(local_df); | 468 | C(local_df); |
468 | n->cloned = 1; | 469 | n->cloned = 1; |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 72b3036bbc09..ada9b3db507d 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1527,7 +1527,6 @@ static int trie_leaf_remove(struct trie *t, t_key key) | |||
1527 | t->revision++; | 1527 | t->revision++; |
1528 | t->size--; | 1528 | t->size--; |
1529 | 1529 | ||
1530 | preempt_disable(); | ||
1531 | tp = NODE_PARENT(n); | 1530 | tp = NODE_PARENT(n); |
1532 | tnode_free((struct tnode *) n); | 1531 | tnode_free((struct tnode *) n); |
1533 | 1532 | ||
@@ -1537,7 +1536,6 @@ static int trie_leaf_remove(struct trie *t, t_key key) | |||
1537 | rcu_assign_pointer(t->trie, trie_rebalance(t, tp)); | 1536 | rcu_assign_pointer(t->trie, trie_rebalance(t, tp)); |
1538 | } else | 1537 | } else |
1539 | rcu_assign_pointer(t->trie, NULL); | 1538 | rcu_assign_pointer(t->trie, NULL); |
1540 | preempt_enable(); | ||
1541 | 1539 | ||
1542 | return 1; | 1540 | return 1; |
1543 | } | 1541 | } |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 74c4d103ebc2..3834b10b5115 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2458,11 +2458,18 @@ void __init tcp_init(void) | |||
2458 | sysctl_max_syn_backlog = 128; | 2458 | sysctl_max_syn_backlog = 128; |
2459 | } | 2459 | } |
2460 | 2460 | ||
2461 | /* Allow no more than 3/4 kernel memory (usually less) allocated to TCP */ | 2461 | /* Set the pressure threshold to be a fraction of global memory that |
2462 | sysctl_tcp_mem[0] = (1536 / sizeof (struct inet_bind_hashbucket)) << order; | 2462 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of |
2463 | sysctl_tcp_mem[1] = sysctl_tcp_mem[0] * 4 / 3; | 2463 | * memory, with a floor of 128 pages. |
2464 | */ | ||
2465 | limit = min(nr_all_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT); | ||
2466 | limit = (limit * (nr_all_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11); | ||
2467 | limit = max(limit, 128UL); | ||
2468 | sysctl_tcp_mem[0] = limit / 4 * 3; | ||
2469 | sysctl_tcp_mem[1] = limit; | ||
2464 | sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2; | 2470 | sysctl_tcp_mem[2] = sysctl_tcp_mem[0] * 2; |
2465 | 2471 | ||
2472 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | ||
2466 | limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7); | 2473 | limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7); |
2467 | max_share = min(4UL*1024*1024, limit); | 2474 | max_share = min(4UL*1024*1024, limit); |
2468 | 2475 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index f57a9baa6b27..92f99927d12d 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1453,6 +1453,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1453 | First: no IPv4 options. | 1453 | First: no IPv4 options. |
1454 | */ | 1454 | */ |
1455 | newinet->opt = NULL; | 1455 | newinet->opt = NULL; |
1456 | newnp->ipv6_fl_list = NULL; | ||
1456 | 1457 | ||
1457 | /* Clone RX bits */ | 1458 | /* Clone RX bits */ |
1458 | newnp->rxopt.all = np->rxopt.all; | 1459 | newnp->rxopt.all = np->rxopt.all; |