Magellan Linux

Contents of /trunk/kernel26-alx/patches-3.10/0168-3.10.69-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2672 - (show annotations) (download)
Tue Jul 21 16:46:35 2015 UTC (8 years, 9 months ago) by niro
File size: 28351 byte(s)
-3.10.84-alx-r1
1 diff --git a/Makefile b/Makefile
2 index dd67be657716..81ede20061cf 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 10
8 -SUBLEVEL = 68
9 +SUBLEVEL = 69
10 EXTRAVERSION =
11 NAME = TOSSUG Baby Fish
12
13 diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
14 index cf2749488cd4..be9b5ca9a6c0 100644
15 --- a/arch/arm64/include/asm/cputype.h
16 +++ b/arch/arm64/include/asm/cputype.h
17 @@ -74,6 +74,8 @@ static inline u32 __attribute_const__ read_cpuid_cachetype(void)
18 return read_cpuid(ID_CTR_EL0);
19 }
20
21 +void cpuinfo_store_cpu(void);
22 +
23 #endif /* __ASSEMBLY__ */
24
25 #endif
26 diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
27 index add6ea616843..7cc551d1b0e1 100644
28 --- a/arch/arm64/kernel/setup.c
29 +++ b/arch/arm64/kernel/setup.c
30 @@ -41,6 +41,7 @@
31 #include <linux/memblock.h>
32 #include <linux/of_fdt.h>
33 #include <linux/of_platform.h>
34 +#include <linux/personality.h>
35
36 #include <asm/cputype.h>
37 #include <asm/elf.h>
38 @@ -97,6 +98,19 @@ void __init early_print(const char *str, ...)
39 printk("%s", buf);
40 }
41
42 +struct cpuinfo_arm64 {
43 + struct cpu cpu;
44 + u32 reg_midr;
45 +};
46 +
47 +static DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
48 +
49 +void cpuinfo_store_cpu(void)
50 +{
51 + struct cpuinfo_arm64 *info = this_cpu_ptr(&cpu_data);
52 + info->reg_midr = read_cpuid_id();
53 +}
54 +
55 static void __init setup_processor(void)
56 {
57 struct cpu_info *cpu_info;
58 @@ -127,6 +141,8 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
59 struct boot_param_header *devtree;
60 unsigned long dt_root;
61
62 + cpuinfo_store_cpu();
63 +
64 /* Check we have a non-NULL DT pointer */
65 if (!dt_phys) {
66 early_print("\n"
67 @@ -290,14 +306,12 @@ static int __init arm64_device_init(void)
68 }
69 arch_initcall(arm64_device_init);
70
71 -static DEFINE_PER_CPU(struct cpu, cpu_data);
72 -
73 static int __init topology_init(void)
74 {
75 int i;
76
77 for_each_possible_cpu(i) {
78 - struct cpu *cpu = &per_cpu(cpu_data, i);
79 + struct cpu *cpu = &per_cpu(cpu_data.cpu, i);
80 cpu->hotpluggable = 1;
81 register_cpu(cpu, i);
82 }
83 @@ -312,14 +326,41 @@ static const char *hwcap_str[] = {
84 NULL
85 };
86
87 +#ifdef CONFIG_COMPAT
88 +static const char *compat_hwcap_str[] = {
89 + "swp",
90 + "half",
91 + "thumb",
92 + "26bit",
93 + "fastmult",
94 + "fpa",
95 + "vfp",
96 + "edsp",
97 + "java",
98 + "iwmmxt",
99 + "crunch",
100 + "thumbee",
101 + "neon",
102 + "vfpv3",
103 + "vfpv3d16",
104 + "tls",
105 + "vfpv4",
106 + "idiva",
107 + "idivt",
108 + "vfpd32",
109 + "lpae",
110 + "evtstrm"
111 +};
112 +#endif /* CONFIG_COMPAT */
113 +
114 static int c_show(struct seq_file *m, void *v)
115 {
116 - int i;
117 -
118 - seq_printf(m, "Processor\t: %s rev %d (%s)\n",
119 - cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
120 + int i, j;
121
122 for_each_online_cpu(i) {
123 + struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
124 + u32 midr = cpuinfo->reg_midr;
125 +
126 /*
127 * glibc reads /proc/cpuinfo to determine the number of
128 * online processors, looking for lines beginning with
129 @@ -328,27 +369,36 @@ static int c_show(struct seq_file *m, void *v)
130 #ifdef CONFIG_SMP
131 seq_printf(m, "processor\t: %d\n", i);
132 #endif
133 - seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n",
134 + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
135 loops_per_jiffy / (500000UL/HZ),
136 loops_per_jiffy / (5000UL/HZ) % 100);
137 - }
138 -
139 - /* dump out the processor features */
140 - seq_puts(m, "Features\t: ");
141 -
142 - for (i = 0; hwcap_str[i]; i++)
143 - if (elf_hwcap & (1 << i))
144 - seq_printf(m, "%s ", hwcap_str[i]);
145
146 - seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
147 - seq_printf(m, "CPU architecture: AArch64\n");
148 - seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15);
149 - seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff);
150 - seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
151 -
152 - seq_puts(m, "\n");
153 -
154 - seq_printf(m, "Hardware\t: %s\n", machine_name);
155 + /*
156 + * Dump out the common processor features in a single line.
157 + * Userspace should read the hwcaps with getauxval(AT_HWCAP)
158 + * rather than attempting to parse this, but there's a body of
159 + * software which does already (at least for 32-bit).
160 + */
161 + seq_puts(m, "Features\t:");
162 + if (personality(current->personality) == PER_LINUX32) {
163 +#ifdef CONFIG_COMPAT
164 + for (j = 0; compat_hwcap_str[j]; j++)
165 + if (COMPAT_ELF_HWCAP & (1 << j))
166 + seq_printf(m, " %s", compat_hwcap_str[j]);
167 +#endif /* CONFIG_COMPAT */
168 + } else {
169 + for (j = 0; hwcap_str[j]; j++)
170 + if (elf_hwcap & (1 << j))
171 + seq_printf(m, " %s", hwcap_str[j]);
172 + }
173 + seq_puts(m, "\n");
174 +
175 + seq_printf(m, "CPU implementer\t: 0x%02x\n", (midr >> 24));
176 + seq_printf(m, "CPU architecture: 8\n");
177 + seq_printf(m, "CPU variant\t: 0x%x\n", ((midr >> 20) & 0xf));
178 + seq_printf(m, "CPU part\t: 0x%03x\n", ((midr >> 4) & 0xfff));
179 + seq_printf(m, "CPU revision\t: %d\n\n", (midr & 0xf));
180 + }
181
182 return 0;
183 }
184 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
185 index 9c93e126328c..b0a8703a25ec 100644
186 --- a/arch/arm64/kernel/smp.c
187 +++ b/arch/arm64/kernel/smp.c
188 @@ -200,6 +200,11 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
189 raw_spin_unlock(&boot_lock);
190
191 /*
192 + * Log the CPU info before it is marked online and might get read.
193 + */
194 + cpuinfo_store_cpu();
195 +
196 + /*
197 * OK, now it's safe to let the boot CPU continue. Wait for
198 * the CPU migration code to notice that the CPU is online
199 * before we continue.
200 diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
201 index 72ef2d25cbf2..ab941a366012 100644
202 --- a/arch/mips/kernel/irq_cpu.c
203 +++ b/arch/mips/kernel/irq_cpu.c
204 @@ -56,6 +56,8 @@ static struct irq_chip mips_cpu_irq_controller = {
205 .irq_mask_ack = mask_mips_irq,
206 .irq_unmask = unmask_mips_irq,
207 .irq_eoi = unmask_mips_irq,
208 + .irq_disable = mask_mips_irq,
209 + .irq_enable = unmask_mips_irq,
210 };
211
212 /*
213 @@ -92,6 +94,8 @@ static struct irq_chip mips_mt_cpu_irq_controller = {
214 .irq_mask_ack = mips_mt_cpu_irq_ack,
215 .irq_unmask = unmask_mips_irq,
216 .irq_eoi = unmask_mips_irq,
217 + .irq_disable = mask_mips_irq,
218 + .irq_enable = unmask_mips_irq,
219 };
220
221 void __init mips_cpu_irq_init(void)
222 diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
223 index 6e7862ab46cc..caeec21df1c4 100644
224 --- a/arch/mips/kernel/smp.c
225 +++ b/arch/mips/kernel/smp.c
226 @@ -109,10 +109,10 @@ asmlinkage __cpuinit void start_secondary(void)
227 else
228 #endif /* CONFIG_MIPS_MT_SMTC */
229 cpu_probe();
230 - cpu_report();
231 per_cpu_trap_init(false);
232 mips_clockevent_init();
233 mp_ops->init_secondary();
234 + cpu_report();
235
236 /*
237 * XXX parity protection should be folded in here when it's converted
238 diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
239 index 7a34e8fe54bd..dccea7f29051 100644
240 --- a/arch/x86/include/uapi/asm/vmx.h
241 +++ b/arch/x86/include/uapi/asm/vmx.h
242 @@ -67,6 +67,7 @@
243 #define EXIT_REASON_EPT_MISCONFIG 49
244 #define EXIT_REASON_INVEPT 50
245 #define EXIT_REASON_PREEMPTION_TIMER 52
246 +#define EXIT_REASON_INVVPID 53
247 #define EXIT_REASON_WBINVD 54
248 #define EXIT_REASON_XSETBV 55
249 #define EXIT_REASON_APIC_WRITE 56
250 @@ -112,6 +113,7 @@
251 { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \
252 { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \
253 { EXIT_REASON_INVD, "INVD" }, \
254 + { EXIT_REASON_INVVPID, "INVVPID" }, \
255 { EXIT_REASON_INVPCID, "INVPCID" }, \
256 { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }
257
258 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
259 index 7112be5f1eaf..04cc2fa7744f 100644
260 --- a/arch/x86/kvm/vmx.c
261 +++ b/arch/x86/kvm/vmx.c
262 @@ -438,6 +438,7 @@ struct vcpu_vmx {
263 #endif
264 int gs_ldt_reload_needed;
265 int fs_reload_needed;
266 + unsigned long vmcs_host_cr4; /* May not match real cr4 */
267 } host_state;
268 struct {
269 int vm86_active;
270 @@ -4076,11 +4077,16 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
271 u32 low32, high32;
272 unsigned long tmpl;
273 struct desc_ptr dt;
274 + unsigned long cr4;
275
276 vmcs_writel(HOST_CR0, read_cr0() & ~X86_CR0_TS); /* 22.2.3 */
277 - vmcs_writel(HOST_CR4, read_cr4()); /* 22.2.3, 22.2.5 */
278 vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */
279
280 + /* Save the most likely value for this task's CR4 in the VMCS. */
281 + cr4 = read_cr4();
282 + vmcs_writel(HOST_CR4, cr4); /* 22.2.3, 22.2.5 */
283 + vmx->host_state.vmcs_host_cr4 = cr4;
284 +
285 vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */
286 #ifdef CONFIG_X86_64
287 /*
288 @@ -6248,6 +6254,12 @@ static int handle_invept(struct kvm_vcpu *vcpu)
289 return 1;
290 }
291
292 +static int handle_invvpid(struct kvm_vcpu *vcpu)
293 +{
294 + kvm_queue_exception(vcpu, UD_VECTOR);
295 + return 1;
296 +}
297 +
298 /*
299 * The exit handlers return 1 if the exit was handled fully and guest execution
300 * may resume. Otherwise they set the kvm_run parameter to indicate what needs
301 @@ -6293,6 +6305,7 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
302 [EXIT_REASON_MWAIT_INSTRUCTION] = handle_invalid_op,
303 [EXIT_REASON_MONITOR_INSTRUCTION] = handle_invalid_op,
304 [EXIT_REASON_INVEPT] = handle_invept,
305 + [EXIT_REASON_INVVPID] = handle_invvpid,
306 };
307
308 static const int kvm_vmx_max_exit_handlers =
309 @@ -6519,7 +6532,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
310 case EXIT_REASON_VMPTRST: case EXIT_REASON_VMREAD:
311 case EXIT_REASON_VMRESUME: case EXIT_REASON_VMWRITE:
312 case EXIT_REASON_VMOFF: case EXIT_REASON_VMON:
313 - case EXIT_REASON_INVEPT:
314 + case EXIT_REASON_INVEPT: case EXIT_REASON_INVVPID:
315 /*
316 * VMX instructions trap unconditionally. This allows L1 to
317 * emulate them for its L2 guest, i.e., allows 3-level nesting!
318 @@ -6964,7 +6977,7 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx)
319 static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
320 {
321 struct vcpu_vmx *vmx = to_vmx(vcpu);
322 - unsigned long debugctlmsr;
323 + unsigned long debugctlmsr, cr4;
324
325 /* Record the guest's net vcpu time for enforced NMI injections. */
326 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
327 @@ -6985,6 +6998,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
328 if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty))
329 vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]);
330
331 + cr4 = read_cr4();
332 + if (unlikely(cr4 != vmx->host_state.vmcs_host_cr4)) {
333 + vmcs_writel(HOST_CR4, cr4);
334 + vmx->host_state.vmcs_host_cr4 = cr4;
335 + }
336 +
337 /* When single-stepping over STI and MOV SS, we must clear the
338 * corresponding interruptibility bits in the guest state. Otherwise
339 * vmentry fails as it then expects bit 14 (BS) in pending debug
340 diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
341 index 981c2dbd72cc..88f143d9754e 100644
342 --- a/arch/x86/pci/common.c
343 +++ b/arch/x86/pci/common.c
344 @@ -448,6 +448,22 @@ static const struct dmi_system_id pciprobe_dmi_table[] = {
345 DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
346 },
347 },
348 + {
349 + .callback = set_scan_all,
350 + .ident = "Stratus/NEC ftServer",
351 + .matches = {
352 + DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
353 + DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R32"),
354 + },
355 + },
356 + {
357 + .callback = set_scan_all,
358 + .ident = "Stratus/NEC ftServer",
359 + .matches = {
360 + DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
361 + DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R31"),
362 + },
363 + },
364 {}
365 };
366
367 diff --git a/crypto/crc32c.c b/crypto/crc32c.c
368 index 06f7018c9d95..238f0e627ef3 100644
369 --- a/crypto/crc32c.c
370 +++ b/crypto/crc32c.c
371 @@ -170,3 +170,4 @@ module_exit(crc32c_mod_fini);
372 MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>");
373 MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations wrapper for lib/crc32c");
374 MODULE_LICENSE("GPL");
375 +MODULE_ALIAS_CRYPTO("crc32c");
376 diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
377 index 1d74a80e031e..ca1cb2d756c2 100644
378 --- a/drivers/gpio/gpiolib.c
379 +++ b/drivers/gpio/gpiolib.c
380 @@ -874,6 +874,7 @@ static int gpiod_export_link(struct device *dev, const char *name,
381 if (tdev != NULL) {
382 status = sysfs_create_link(&dev->kobj, &tdev->kobj,
383 name);
384 + put_device(tdev);
385 } else {
386 status = -ENODEV;
387 }
388 @@ -927,7 +928,7 @@ static int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value)
389 }
390
391 status = sysfs_set_active_low(desc, dev, value);
392 -
393 + put_device(dev);
394 unlock:
395 mutex_unlock(&sysfs_lock);
396
397 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
398 index 4635788e14bf..ec9770f42538 100644
399 --- a/fs/ext4/file.c
400 +++ b/fs/ext4/file.c
401 @@ -100,7 +100,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
402 struct blk_plug plug;
403 int unaligned_aio = 0;
404 ssize_t ret;
405 - int overwrite = 0;
406 + int *overwrite = iocb->private;
407 size_t length = iov_length(iov, nr_segs);
408
409 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) &&
410 @@ -118,8 +118,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
411 mutex_lock(&inode->i_mutex);
412 blk_start_plug(&plug);
413
414 - iocb->private = &overwrite;
415 -
416 /* check whether we do a DIO overwrite or not */
417 if (ext4_should_dioread_nolock(inode) && !unaligned_aio &&
418 !file->f_mapping->nrpages && pos + length <= i_size_read(inode)) {
419 @@ -143,7 +141,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
420 * So we should check these two conditions.
421 */
422 if (err == len && (map.m_flags & EXT4_MAP_MAPPED))
423 - overwrite = 1;
424 + *overwrite = 1;
425 }
426
427 ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos);
428 @@ -170,6 +168,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
429 {
430 struct inode *inode = file_inode(iocb->ki_filp);
431 ssize_t ret;
432 + int overwrite = 0;
433
434 /*
435 * If we have encountered a bitmap-format file, the size limit
436 @@ -190,6 +189,7 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
437 }
438 }
439
440 + iocb->private = &overwrite;
441 if (unlikely(iocb->ki_filp->f_flags & O_DIRECT))
442 ret = ext4_file_dio_write(iocb, iov, nr_segs, pos);
443 else
444 diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
445 index 9bc72dec3fa6..b02c202223a6 100644
446 --- a/fs/nilfs2/nilfs.h
447 +++ b/fs/nilfs2/nilfs.h
448 @@ -141,7 +141,6 @@ enum {
449 * @ti_save: Backup of journal_info field of task_struct
450 * @ti_flags: Flags
451 * @ti_count: Nest level
452 - * @ti_garbage: List of inode to be put when releasing semaphore
453 */
454 struct nilfs_transaction_info {
455 u32 ti_magic;
456 @@ -150,7 +149,6 @@ struct nilfs_transaction_info {
457 one of other filesystems has a bug. */
458 unsigned short ti_flags;
459 unsigned short ti_count;
460 - struct list_head ti_garbage;
461 };
462
463 /* ti_magic */
464 diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
465 index 958a5b57ed4a..b3c95c1a4700 100644
466 --- a/fs/nilfs2/segment.c
467 +++ b/fs/nilfs2/segment.c
468 @@ -305,7 +305,6 @@ static void nilfs_transaction_lock(struct super_block *sb,
469 ti->ti_count = 0;
470 ti->ti_save = cur_ti;
471 ti->ti_magic = NILFS_TI_MAGIC;
472 - INIT_LIST_HEAD(&ti->ti_garbage);
473 current->journal_info = ti;
474
475 for (;;) {
476 @@ -332,8 +331,6 @@ static void nilfs_transaction_unlock(struct super_block *sb)
477
478 up_write(&nilfs->ns_segctor_sem);
479 current->journal_info = ti->ti_save;
480 - if (!list_empty(&ti->ti_garbage))
481 - nilfs_dispose_list(nilfs, &ti->ti_garbage, 0);
482 }
483
484 static void *nilfs_segctor_map_segsum_entry(struct nilfs_sc_info *sci,
485 @@ -746,6 +743,15 @@ static void nilfs_dispose_list(struct the_nilfs *nilfs,
486 }
487 }
488
489 +static void nilfs_iput_work_func(struct work_struct *work)
490 +{
491 + struct nilfs_sc_info *sci = container_of(work, struct nilfs_sc_info,
492 + sc_iput_work);
493 + struct the_nilfs *nilfs = sci->sc_super->s_fs_info;
494 +
495 + nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 0);
496 +}
497 +
498 static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs,
499 struct nilfs_root *root)
500 {
501 @@ -1899,8 +1905,8 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci,
502 static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
503 struct the_nilfs *nilfs)
504 {
505 - struct nilfs_transaction_info *ti = current->journal_info;
506 struct nilfs_inode_info *ii, *n;
507 + int defer_iput = false;
508
509 spin_lock(&nilfs->ns_inode_lock);
510 list_for_each_entry_safe(ii, n, &sci->sc_dirty_files, i_dirty) {
511 @@ -1911,9 +1917,24 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
512 clear_bit(NILFS_I_BUSY, &ii->i_state);
513 brelse(ii->i_bh);
514 ii->i_bh = NULL;
515 - list_move_tail(&ii->i_dirty, &ti->ti_garbage);
516 + list_del_init(&ii->i_dirty);
517 + if (!ii->vfs_inode.i_nlink) {
518 + /*
519 + * Defer calling iput() to avoid a deadlock
520 + * over I_SYNC flag for inodes with i_nlink == 0
521 + */
522 + list_add_tail(&ii->i_dirty, &sci->sc_iput_queue);
523 + defer_iput = true;
524 + } else {
525 + spin_unlock(&nilfs->ns_inode_lock);
526 + iput(&ii->vfs_inode);
527 + spin_lock(&nilfs->ns_inode_lock);
528 + }
529 }
530 spin_unlock(&nilfs->ns_inode_lock);
531 +
532 + if (defer_iput)
533 + schedule_work(&sci->sc_iput_work);
534 }
535
536 /*
537 @@ -2580,6 +2601,8 @@ static struct nilfs_sc_info *nilfs_segctor_new(struct super_block *sb,
538 INIT_LIST_HEAD(&sci->sc_segbufs);
539 INIT_LIST_HEAD(&sci->sc_write_logs);
540 INIT_LIST_HEAD(&sci->sc_gc_inodes);
541 + INIT_LIST_HEAD(&sci->sc_iput_queue);
542 + INIT_WORK(&sci->sc_iput_work, nilfs_iput_work_func);
543 init_timer(&sci->sc_timer);
544
545 sci->sc_interval = HZ * NILFS_SC_DEFAULT_TIMEOUT;
546 @@ -2606,6 +2629,8 @@ static void nilfs_segctor_write_out(struct nilfs_sc_info *sci)
547 ret = nilfs_segctor_construct(sci, SC_LSEG_SR);
548 nilfs_transaction_unlock(sci->sc_super);
549
550 + flush_work(&sci->sc_iput_work);
551 +
552 } while (ret && retrycount-- > 0);
553 }
554
555 @@ -2630,6 +2655,9 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
556 || sci->sc_seq_request != sci->sc_seq_done);
557 spin_unlock(&sci->sc_state_lock);
558
559 + if (flush_work(&sci->sc_iput_work))
560 + flag = true;
561 +
562 if (flag || !nilfs_segctor_confirm(sci))
563 nilfs_segctor_write_out(sci);
564
565 @@ -2639,6 +2667,12 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
566 nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1);
567 }
568
569 + if (!list_empty(&sci->sc_iput_queue)) {
570 + nilfs_warning(sci->sc_super, __func__,
571 + "iput queue is not empty\n");
572 + nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1);
573 + }
574 +
575 WARN_ON(!list_empty(&sci->sc_segbufs));
576 WARN_ON(!list_empty(&sci->sc_write_logs));
577
578 diff --git a/fs/nilfs2/segment.h b/fs/nilfs2/segment.h
579 index 38a1d0013314..a48d6de1e02c 100644
580 --- a/fs/nilfs2/segment.h
581 +++ b/fs/nilfs2/segment.h
582 @@ -26,6 +26,7 @@
583 #include <linux/types.h>
584 #include <linux/fs.h>
585 #include <linux/buffer_head.h>
586 +#include <linux/workqueue.h>
587 #include <linux/nilfs2_fs.h>
588 #include "nilfs.h"
589
590 @@ -92,6 +93,8 @@ struct nilfs_segsum_pointer {
591 * @sc_nblk_inc: Block count of current generation
592 * @sc_dirty_files: List of files to be written
593 * @sc_gc_inodes: List of GC inodes having blocks to be written
594 + * @sc_iput_queue: list of inodes for which iput should be done
595 + * @sc_iput_work: work struct to defer iput call
596 * @sc_freesegs: array of segment numbers to be freed
597 * @sc_nfreesegs: number of segments on @sc_freesegs
598 * @sc_dsync_inode: inode whose data pages are written for a sync operation
599 @@ -135,6 +138,8 @@ struct nilfs_sc_info {
600
601 struct list_head sc_dirty_files;
602 struct list_head sc_gc_inodes;
603 + struct list_head sc_iput_queue;
604 + struct work_struct sc_iput_work;
605
606 __u64 *sc_freesegs;
607 size_t sc_nfreesegs;
608 diff --git a/include/sound/ak4113.h b/include/sound/ak4113.h
609 index 2609048c1d44..3a34f6edc2d1 100644
610 --- a/include/sound/ak4113.h
611 +++ b/include/sound/ak4113.h
612 @@ -286,7 +286,7 @@ struct ak4113 {
613 ak4113_write_t *write;
614 ak4113_read_t *read;
615 void *private_data;
616 - unsigned int init:1;
617 + atomic_t wq_processing;
618 spinlock_t lock;
619 unsigned char regmap[AK4113_WRITABLE_REGS];
620 struct snd_kcontrol *kctls[AK4113_CONTROLS];
621 diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
622 index 3ce69fd92523..69441161009c 100644
623 --- a/include/sound/ak4114.h
624 +++ b/include/sound/ak4114.h
625 @@ -168,7 +168,7 @@ struct ak4114 {
626 ak4114_write_t * write;
627 ak4114_read_t * read;
628 void * private_data;
629 - unsigned int init: 1;
630 + atomic_t wq_processing;
631 spinlock_t lock;
632 unsigned char regmap[7];
633 unsigned char txcsb[5];
634 diff --git a/kernel/smpboot.c b/kernel/smpboot.c
635 index 02fc5c933673..7020eecb398b 100644
636 --- a/kernel/smpboot.c
637 +++ b/kernel/smpboot.c
638 @@ -279,6 +279,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
639 unsigned int cpu;
640 int ret = 0;
641
642 + get_online_cpus();
643 mutex_lock(&smpboot_threads_lock);
644 for_each_online_cpu(cpu) {
645 ret = __smpboot_create_thread(plug_thread, cpu);
646 @@ -291,6 +292,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
647 list_add(&plug_thread->list, &hotplug_threads);
648 out:
649 mutex_unlock(&smpboot_threads_lock);
650 + put_online_cpus();
651 return ret;
652 }
653 EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread);
654 diff --git a/lib/checksum.c b/lib/checksum.c
655 index 129775eb6de6..8b39e86dbab5 100644
656 --- a/lib/checksum.c
657 +++ b/lib/checksum.c
658 @@ -181,6 +181,15 @@ csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
659 EXPORT_SYMBOL(csum_partial_copy);
660
661 #ifndef csum_tcpudp_nofold
662 +static inline u32 from64to32(u64 x)
663 +{
664 + /* add up 32-bit and 32-bit for 32+c bit */
665 + x = (x & 0xffffffff) + (x >> 32);
666 + /* add up carry.. */
667 + x = (x & 0xffffffff) + (x >> 32);
668 + return (u32)x;
669 +}
670 +
671 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
672 unsigned short len,
673 unsigned short proto,
674 @@ -195,8 +204,7 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
675 #else
676 s += (proto + len) << 8;
677 #endif
678 - s += (s >> 32);
679 - return (__force __wsum)s;
680 + return (__force __wsum)from64to32(s);
681 }
682 EXPORT_SYMBOL(csum_tcpudp_nofold);
683 #endif
684 diff --git a/mm/pagewalk.c b/mm/pagewalk.c
685 index 2beeabf502c5..9056d22d2880 100644
686 --- a/mm/pagewalk.c
687 +++ b/mm/pagewalk.c
688 @@ -199,7 +199,10 @@ int walk_page_range(unsigned long addr, unsigned long end,
689 */
690 if ((vma->vm_start <= addr) &&
691 (vma->vm_flags & VM_PFNMAP)) {
692 - next = vma->vm_end;
693 + if (walk->pte_hole)
694 + err = walk->pte_hole(addr, next, walk);
695 + if (err)
696 + break;
697 pgd = pgd_offset(walk->mm, next);
698 continue;
699 }
700 diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
701 index e04e750a77ed..7a9149bb2a38 100644
702 --- a/sound/i2c/other/ak4113.c
703 +++ b/sound/i2c/other/ak4113.c
704 @@ -56,8 +56,7 @@ static inline unsigned char reg_read(struct ak4113 *ak4113, unsigned char reg)
705
706 static void snd_ak4113_free(struct ak4113 *chip)
707 {
708 - chip->init = 1; /* don't schedule new work */
709 - mb();
710 + atomic_inc(&chip->wq_processing); /* don't schedule new work */
711 cancel_delayed_work_sync(&chip->work);
712 kfree(chip);
713 }
714 @@ -89,6 +88,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
715 chip->write = write;
716 chip->private_data = private_data;
717 INIT_DELAYED_WORK(&chip->work, ak4113_stats);
718 + atomic_set(&chip->wq_processing, 0);
719
720 for (reg = 0; reg < AK4113_WRITABLE_REGS ; reg++)
721 chip->regmap[reg] = pgm[reg];
722 @@ -139,13 +139,11 @@ static void ak4113_init_regs(struct ak4113 *chip)
723
724 void snd_ak4113_reinit(struct ak4113 *chip)
725 {
726 - chip->init = 1;
727 - mb();
728 - flush_delayed_work(&chip->work);
729 + if (atomic_inc_return(&chip->wq_processing) == 1)
730 + cancel_delayed_work_sync(&chip->work);
731 ak4113_init_regs(chip);
732 /* bring up statistics / event queing */
733 - chip->init = 0;
734 - if (chip->kctls[0])
735 + if (atomic_dec_and_test(&chip->wq_processing))
736 schedule_delayed_work(&chip->work, HZ / 10);
737 }
738 EXPORT_SYMBOL_GPL(snd_ak4113_reinit);
739 @@ -632,8 +630,9 @@ static void ak4113_stats(struct work_struct *work)
740 {
741 struct ak4113 *chip = container_of(work, struct ak4113, work.work);
742
743 - if (!chip->init)
744 + if (atomic_inc_return(&chip->wq_processing) == 1)
745 snd_ak4113_check_rate_and_errors(chip, chip->check_flags);
746
747 - schedule_delayed_work(&chip->work, HZ / 10);
748 + if (atomic_dec_and_test(&chip->wq_processing))
749 + schedule_delayed_work(&chip->work, HZ / 10);
750 }
751 diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
752 index 5bf4fca19e48..84a1ee7af552 100644
753 --- a/sound/i2c/other/ak4114.c
754 +++ b/sound/i2c/other/ak4114.c
755 @@ -66,8 +66,7 @@ static void reg_dump(struct ak4114 *ak4114)
756
757 static void snd_ak4114_free(struct ak4114 *chip)
758 {
759 - chip->init = 1; /* don't schedule new work */
760 - mb();
761 + atomic_inc(&chip->wq_processing); /* don't schedule new work */
762 cancel_delayed_work_sync(&chip->work);
763 kfree(chip);
764 }
765 @@ -100,6 +99,7 @@ int snd_ak4114_create(struct snd_card *card,
766 chip->write = write;
767 chip->private_data = private_data;
768 INIT_DELAYED_WORK(&chip->work, ak4114_stats);
769 + atomic_set(&chip->wq_processing, 0);
770
771 for (reg = 0; reg < 7; reg++)
772 chip->regmap[reg] = pgm[reg];
773 @@ -152,13 +152,11 @@ static void ak4114_init_regs(struct ak4114 *chip)
774
775 void snd_ak4114_reinit(struct ak4114 *chip)
776 {
777 - chip->init = 1;
778 - mb();
779 - flush_delayed_work(&chip->work);
780 + if (atomic_inc_return(&chip->wq_processing) == 1)
781 + cancel_delayed_work_sync(&chip->work);
782 ak4114_init_regs(chip);
783 /* bring up statistics / event queing */
784 - chip->init = 0;
785 - if (chip->kctls[0])
786 + if (atomic_dec_and_test(&chip->wq_processing))
787 schedule_delayed_work(&chip->work, HZ / 10);
788 }
789
790 @@ -612,10 +610,10 @@ static void ak4114_stats(struct work_struct *work)
791 {
792 struct ak4114 *chip = container_of(work, struct ak4114, work.work);
793
794 - if (!chip->init)
795 + if (atomic_inc_return(&chip->wq_processing) == 1)
796 snd_ak4114_check_rate_and_errors(chip, chip->check_flags);
797 -
798 - schedule_delayed_work(&chip->work, HZ / 10);
799 + if (atomic_dec_and_test(&chip->wq_processing))
800 + schedule_delayed_work(&chip->work, HZ / 10);
801 }
802
803 EXPORT_SYMBOL(snd_ak4114_create);
804 diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
805 index f3fdfa07fcb9..c5f79591e68b 100644
806 --- a/sound/soc/atmel/atmel_ssc_dai.c
807 +++ b/sound/soc/atmel/atmel_ssc_dai.c
808 @@ -331,7 +331,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
809 struct atmel_pcm_dma_params *dma_params;
810 int dir, channels, bits;
811 u32 tfmr, rfmr, tcmr, rcmr;
812 - int start_event;
813 int ret;
814
815 /*
816 @@ -450,19 +449,10 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
817 * The SSC transmit clock is obtained from the BCLK signal on
818 * on the TK line, and the SSC receive clock is
819 * generated from the transmit clock.
820 - *
821 - * For single channel data, one sample is transferred
822 - * on the falling edge of the LRC clock.
823 - * For two channel data, one sample is
824 - * transferred on both edges of the LRC clock.
825 */
826 - start_event = ((channels == 1)
827 - ? SSC_START_FALLING_RF
828 - : SSC_START_EDGE_RF);
829 -
830 rcmr = SSC_BF(RCMR_PERIOD, 0)
831 | SSC_BF(RCMR_STTDLY, START_DELAY)
832 - | SSC_BF(RCMR_START, start_event)
833 + | SSC_BF(RCMR_START, SSC_START_FALLING_RF)
834 | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
835 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
836 | SSC_BF(RCMR_CKS, SSC_CKS_CLOCK);
837 @@ -470,14 +460,14 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
838 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
839 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
840 | SSC_BF(RFMR_FSLEN, 0)
841 - | SSC_BF(RFMR_DATNB, 0)
842 + | SSC_BF(RFMR_DATNB, (channels - 1))
843 | SSC_BIT(RFMR_MSBF)
844 | SSC_BF(RFMR_LOOP, 0)
845 | SSC_BF(RFMR_DATLEN, (bits - 1));
846
847 tcmr = SSC_BF(TCMR_PERIOD, 0)
848 | SSC_BF(TCMR_STTDLY, START_DELAY)
849 - | SSC_BF(TCMR_START, start_event)
850 + | SSC_BF(TCMR_START, SSC_START_FALLING_RF)
851 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
852 | SSC_BF(TCMR_CKO, SSC_CKO_NONE)
853 | SSC_BF(TCMR_CKS, SSC_CKS_PIN);
854 @@ -486,7 +476,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
855 | SSC_BF(TFMR_FSDEN, 0)
856 | SSC_BF(TFMR_FSOS, SSC_FSOS_NONE)
857 | SSC_BF(TFMR_FSLEN, 0)
858 - | SSC_BF(TFMR_DATNB, 0)
859 + | SSC_BF(TFMR_DATNB, (channels - 1))
860 | SSC_BIT(TFMR_MSBF)
861 | SSC_BF(TFMR_DATDEF, 0)
862 | SSC_BF(TFMR_DATLEN, (bits - 1));
863 diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
864 index 23670737116e..3b5f565a23a5 100644
865 --- a/sound/soc/codecs/sgtl5000.c
866 +++ b/sound/soc/codecs/sgtl5000.c
867 @@ -1242,6 +1242,9 @@ static int sgtl5000_enable_regulators(struct snd_soc_codec *codec)
868 /* wait for all power rails bring up */
869 udelay(10);
870
871 + /* Need 8 clocks before I2C accesses */
872 + udelay(1);
873 +
874 /* read chip information */
875 reg = snd_soc_read(codec, SGTL5000_CHIP_ID);
876 if (((reg & SGTL5000_PARTID_MASK) >> SGTL5000_PARTID_SHIFT) !=