Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2295 - genpatches-2.6/trunk/3.7
Date: Thu, 28 Feb 2013 20:11:41
Message-Id: 20130228201138.6E7582171D@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2013-02-28 20:10:34 +0000 (Thu, 28 Feb 2013)
3 New Revision: 2295
4
5 Added:
6 genpatches-2.6/trunk/3.7/1009_linux-3.7.10.patch
7 Modified:
8 genpatches-2.6/trunk/3.7/0000_README
9 Log:
10 Linux patch 3.7.10
11
12 Modified: genpatches-2.6/trunk/3.7/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/3.7/0000_README 2013-02-28 19:23:00 UTC (rev 2294)
15 +++ genpatches-2.6/trunk/3.7/0000_README 2013-02-28 20:10:34 UTC (rev 2295)
16 @@ -75,6 +75,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 3.7.9
19
20 +Patch: 1009_linux-3.7.10.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 3.7.10
23 +
24 Patch: 1700_enable-thinkpad-micled.patch
25 From: https://bugs.gentoo.org/show_bug.cgi?id=449248
26 Desc: Enable mic mute led in thinkpads
27
28 Added: genpatches-2.6/trunk/3.7/1009_linux-3.7.10.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/3.7/1009_linux-3.7.10.patch (rev 0)
31 +++ genpatches-2.6/trunk/3.7/1009_linux-3.7.10.patch 2013-02-28 20:10:34 UTC (rev 2295)
32 @@ -0,0 +1,2407 @@
33 +diff --git a/Makefile b/Makefile
34 +index 5634228..04428dc 100644
35 +--- a/Makefile
36 ++++ b/Makefile
37 +@@ -1,6 +1,6 @@
38 + VERSION = 3
39 + PATCHLEVEL = 7
40 +-SUBLEVEL = 9
41 ++SUBLEVEL = 10
42 + EXTRAVERSION =
43 + NAME = Terrified Chipmunk
44 +
45 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
46 +index 38883f0..051a35f 100644
47 +--- a/arch/s390/kvm/kvm-s390.c
48 ++++ b/arch/s390/kvm/kvm-s390.c
49 +@@ -763,6 +763,14 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
50 + } else
51 + prefix = 0;
52 +
53 ++ /*
54 ++ * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
55 ++ * copying in vcpu load/put. Lets update our copies before we save
56 ++ * it into the save area
57 ++ */
58 ++ save_fp_regs(&vcpu->arch.guest_fpregs);
59 ++ save_access_regs(vcpu->run->s.regs.acrs);
60 ++
61 + if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
62 + vcpu->arch.guest_fpregs.fprs, 128, prefix))
63 + return -EFAULT;
64 +diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
65 +index 9f2edb5..cb9c333 100644
66 +--- a/arch/sparc/Kconfig
67 ++++ b/arch/sparc/Kconfig
68 +@@ -61,6 +61,7 @@ config SPARC64
69 + select HAVE_MEMBLOCK
70 + select HAVE_MEMBLOCK_NODE_MAP
71 + select HAVE_SYSCALL_WRAPPERS
72 ++ select HAVE_ARCH_TRANSPARENT_HUGEPAGE
73 + select HAVE_DYNAMIC_FTRACE
74 + select HAVE_FTRACE_MCOUNT_RECORD
75 + select HAVE_SYSCALL_TRACEPOINTS
76 +diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h
77 +index 9661e9b..7eb57d2 100644
78 +--- a/arch/sparc/include/asm/hugetlb.h
79 ++++ b/arch/sparc/include/asm/hugetlb.h
80 +@@ -12,7 +12,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
81 +
82 + static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
83 + {
84 +- hugetlb_setup(mm);
85 + }
86 +
87 + static inline int is_hugepage_only_range(struct mm_struct *mm,
88 +diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
89 +index 4b39f74..e155388 100644
90 +--- a/arch/sparc/include/asm/page_64.h
91 ++++ b/arch/sparc/include/asm/page_64.h
92 +@@ -27,8 +27,8 @@
93 + #ifndef __ASSEMBLY__
94 +
95 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
96 +-struct mm_struct;
97 +-extern void hugetlb_setup(struct mm_struct *mm);
98 ++struct pt_regs;
99 ++extern void hugetlb_setup(struct pt_regs *regs);
100 + #endif
101 +
102 + #define WANT_PAGE_VIRTUAL
103 +diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
104 +index 95515f1..c07268d 100644
105 +--- a/arch/sparc/include/asm/pgtable_64.h
106 ++++ b/arch/sparc/include/asm/pgtable_64.h
107 +@@ -71,7 +71,6 @@
108 + #define PMD_PADDR _AC(0xfffffffe,UL)
109 + #define PMD_PADDR_SHIFT _AC(11,UL)
110 +
111 +-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
112 + #define PMD_ISHUGE _AC(0x00000001,UL)
113 +
114 + /* This is the PMD layout when PMD_ISHUGE is set. With 4MB huge
115 +@@ -86,7 +85,6 @@
116 + #define PMD_HUGE_ACCESSED _AC(0x00000080,UL)
117 + #define PMD_HUGE_EXEC _AC(0x00000040,UL)
118 + #define PMD_HUGE_SPLITTING _AC(0x00000020,UL)
119 +-#endif
120 +
121 + /* PGDs point to PMD tables which are 8K aligned. */
122 + #define PGD_PADDR _AC(0xfffffffc,UL)
123 +@@ -622,6 +620,12 @@ static inline unsigned long pte_special(pte_t pte)
124 + return pte_val(pte) & _PAGE_SPECIAL;
125 + }
126 +
127 ++static inline int pmd_large(pmd_t pmd)
128 ++{
129 ++ return (pmd_val(pmd) & (PMD_ISHUGE | PMD_HUGE_PRESENT)) ==
130 ++ (PMD_ISHUGE | PMD_HUGE_PRESENT);
131 ++}
132 ++
133 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE
134 + static inline int pmd_young(pmd_t pmd)
135 + {
136 +@@ -640,12 +644,6 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
137 + return val >> (PAGE_SHIFT - PMD_PADDR_SHIFT);
138 + }
139 +
140 +-static inline int pmd_large(pmd_t pmd)
141 +-{
142 +- return (pmd_val(pmd) & (PMD_ISHUGE | PMD_HUGE_PRESENT)) ==
143 +- (PMD_ISHUGE | PMD_HUGE_PRESENT);
144 +-}
145 +-
146 + static inline int pmd_trans_splitting(pmd_t pmd)
147 + {
148 + return (pmd_val(pmd) & (PMD_ISHUGE|PMD_HUGE_SPLITTING)) ==
149 +diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
150 +index b4c258d..e696432 100644
151 +--- a/arch/sparc/include/asm/tsb.h
152 ++++ b/arch/sparc/include/asm/tsb.h
153 +@@ -157,17 +157,26 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
154 + andn REG2, 0x7, REG2; \
155 + add REG1, REG2, REG1;
156 +
157 +- /* This macro exists only to make the PMD translator below easier
158 +- * to read. It hides the ELF section switch for the sun4v code
159 +- * patching.
160 ++ /* These macros exists only to make the PMD translator below
161 ++ * easier to read. It hides the ELF section switch for the
162 ++ * sun4v code patching.
163 + */
164 +-#define OR_PTE_BIT(REG, NAME) \
165 ++#define OR_PTE_BIT_1INSN(REG, NAME) \
166 + 661: or REG, _PAGE_##NAME##_4U, REG; \
167 + .section .sun4v_1insn_patch, "ax"; \
168 + .word 661b; \
169 + or REG, _PAGE_##NAME##_4V, REG; \
170 + .previous;
171 +
172 ++#define OR_PTE_BIT_2INSN(REG, TMP, NAME) \
173 ++661: sethi %hi(_PAGE_##NAME##_4U), TMP; \
174 ++ or REG, TMP, REG; \
175 ++ .section .sun4v_2insn_patch, "ax"; \
176 ++ .word 661b; \
177 ++ mov -1, TMP; \
178 ++ or REG, _PAGE_##NAME##_4V, REG; \
179 ++ .previous;
180 ++
181 + /* Load into REG the PTE value for VALID, CACHE, and SZHUGE. */
182 + #define BUILD_PTE_VALID_SZHUGE_CACHE(REG) \
183 + 661: sethi %uhi(_PAGE_VALID|_PAGE_SZHUGE_4U), REG; \
184 +@@ -214,12 +223,13 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
185 + andn REG1, PMD_HUGE_PROTBITS, REG2; \
186 + sllx REG2, PMD_PADDR_SHIFT, REG2; \
187 + /* REG2 now holds PFN << PAGE_SHIFT */ \
188 +- andcc REG1, PMD_HUGE_EXEC, %g0; \
189 +- bne,a,pt %xcc, 1f; \
190 +- OR_PTE_BIT(REG2, EXEC); \
191 +-1: andcc REG1, PMD_HUGE_WRITE, %g0; \
192 ++ andcc REG1, PMD_HUGE_WRITE, %g0; \
193 + bne,a,pt %xcc, 1f; \
194 +- OR_PTE_BIT(REG2, W); \
195 ++ OR_PTE_BIT_1INSN(REG2, W); \
196 ++1: andcc REG1, PMD_HUGE_EXEC, %g0; \
197 ++ be,pt %xcc, 1f; \
198 ++ nop; \
199 ++ OR_PTE_BIT_2INSN(REG2, REG1, EXEC); \
200 + /* REG1 can now be clobbered, build final PTE */ \
201 + 1: BUILD_PTE_VALID_SZHUGE_CACHE(REG1); \
202 + ba,pt %xcc, PTE_LABEL; \
203 +diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
204 +index d4bdc7a..a313e4a 100644
205 +--- a/arch/sparc/kernel/tsb.S
206 ++++ b/arch/sparc/kernel/tsb.S
207 +@@ -136,12 +136,43 @@ tsb_miss_page_table_walk_sun4v_fastpath:
208 + nop
209 +
210 + /* It is a huge page, use huge page TSB entry address we
211 +- * calculated above.
212 ++ * calculated above. If the huge page TSB has not been
213 ++ * allocated, setup a trap stack and call hugetlb_setup()
214 ++ * to do so, then return from the trap to replay the TLB
215 ++ * miss.
216 ++ *
217 ++ * This is necessary to handle the case of transparent huge
218 ++ * pages where we don't really have a non-atomic context
219 ++ * in which to allocate the hugepage TSB hash table. When
220 ++ * the 'mm' faults in the hugepage for the first time, we
221 ++ * thus handle it here. This also makes sure that we can
222 ++ * allocate the TSB hash table on the correct NUMA node.
223 + */
224 + TRAP_LOAD_TRAP_BLOCK(%g7, %g2)
225 +- ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g2
226 +- cmp %g2, -1
227 +- movne %xcc, %g2, %g1
228 ++ ldx [%g7 + TRAP_PER_CPU_TSB_HUGE_TEMP], %g1
229 ++ cmp %g1, -1
230 ++ bne,pt %xcc, 60f
231 ++ nop
232 ++
233 ++661: rdpr %pstate, %g5
234 ++ wrpr %g5, PSTATE_AG | PSTATE_MG, %pstate
235 ++ .section .sun4v_2insn_patch, "ax"
236 ++ .word 661b
237 ++ SET_GL(1)
238 ++ nop
239 ++ .previous
240 ++
241 ++ rdpr %tl, %g3
242 ++ cmp %g3, 1
243 ++ bne,pn %xcc, winfix_trampoline
244 ++ nop
245 ++ ba,pt %xcc, etrap
246 ++ rd %pc, %g7
247 ++ call hugetlb_setup
248 ++ add %sp, PTREGS_OFF, %o0
249 ++ ba,pt %xcc, rtrap
250 ++ nop
251 ++
252 + 60:
253 + #endif
254 +
255 +diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
256 +index 097aee7..5062ff3 100644
257 +--- a/arch/sparc/mm/fault_64.c
258 ++++ b/arch/sparc/mm/fault_64.c
259 +@@ -472,8 +472,13 @@ good_area:
260 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
261 + mm_rss = mm->context.huge_pte_count;
262 + if (unlikely(mm_rss >
263 +- mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit))
264 +- tsb_grow(mm, MM_TSB_HUGE, mm_rss);
265 ++ mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) {
266 ++ if (mm->context.tsb_block[MM_TSB_HUGE].tsb)
267 ++ tsb_grow(mm, MM_TSB_HUGE, mm_rss);
268 ++ else
269 ++ hugetlb_setup(regs);
270 ++
271 ++ }
272 + #endif
273 + return;
274 +
275 +diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
276 +index 42c55df..01ee23d 100644
277 +--- a/arch/sparc/mm/gup.c
278 ++++ b/arch/sparc/mm/gup.c
279 +@@ -66,6 +66,56 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
280 + return 1;
281 + }
282 +
283 ++static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
284 ++ unsigned long end, int write, struct page **pages,
285 ++ int *nr)
286 ++{
287 ++ struct page *head, *page, *tail;
288 ++ u32 mask;
289 ++ int refs;
290 ++
291 ++ mask = PMD_HUGE_PRESENT;
292 ++ if (write)
293 ++ mask |= PMD_HUGE_WRITE;
294 ++ if ((pmd_val(pmd) & mask) != mask)
295 ++ return 0;
296 ++
297 ++ refs = 0;
298 ++ head = pmd_page(pmd);
299 ++ page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
300 ++ tail = page;
301 ++ do {
302 ++ VM_BUG_ON(compound_head(page) != head);
303 ++ pages[*nr] = page;
304 ++ (*nr)++;
305 ++ page++;
306 ++ refs++;
307 ++ } while (addr += PAGE_SIZE, addr != end);
308 ++
309 ++ if (!page_cache_add_speculative(head, refs)) {
310 ++ *nr -= refs;
311 ++ return 0;
312 ++ }
313 ++
314 ++ if (unlikely(pmd_val(pmd) != pmd_val(*pmdp))) {
315 ++ *nr -= refs;
316 ++ while (refs--)
317 ++ put_page(head);
318 ++ return 0;
319 ++ }
320 ++
321 ++ /* Any tail page need their mapcount reference taken before we
322 ++ * return.
323 ++ */
324 ++ while (refs--) {
325 ++ if (PageTail(tail))
326 ++ get_huge_page_tail(tail);
327 ++ tail++;
328 ++ }
329 ++
330 ++ return 1;
331 ++}
332 ++
333 + static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
334 + int write, struct page **pages, int *nr)
335 + {
336 +@@ -77,9 +127,14 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
337 + pmd_t pmd = *pmdp;
338 +
339 + next = pmd_addr_end(addr, end);
340 +- if (pmd_none(pmd))
341 ++ if (pmd_none(pmd) || pmd_trans_splitting(pmd))
342 + return 0;
343 +- if (!gup_pte_range(pmd, addr, next, write, pages, nr))
344 ++ if (unlikely(pmd_large(pmd))) {
345 ++ if (!gup_huge_pmd(pmdp, pmd, addr, next,
346 ++ write, pages, nr))
347 ++ return 0;
348 ++ } else if (!gup_pte_range(pmd, addr, next, write,
349 ++ pages, nr))
350 + return 0;
351 + } while (pmdp++, addr = next, addr != end);
352 +
353 +diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
354 +index 9e28a11..c202a6c 100644
355 +--- a/arch/sparc/mm/init_64.c
356 ++++ b/arch/sparc/mm/init_64.c
357 +@@ -314,16 +314,31 @@ static void __update_mmu_tsb_insert(struct mm_struct *mm, unsigned long tsb_inde
358 + struct tsb *tsb = mm->context.tsb_block[tsb_index].tsb;
359 + unsigned long tag;
360 +
361 ++ if (unlikely(!tsb))
362 ++ return;
363 ++
364 + tsb += ((address >> tsb_hash_shift) &
365 + (mm->context.tsb_block[tsb_index].tsb_nentries - 1UL));
366 + tag = (address >> 22UL);
367 + tsb_insert(tsb, tag, tte);
368 + }
369 +
370 ++#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
371 ++static inline bool is_hugetlb_pte(pte_t pte)
372 ++{
373 ++ if ((tlb_type == hypervisor &&
374 ++ (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) ||
375 ++ (tlb_type != hypervisor &&
376 ++ (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U))
377 ++ return true;
378 ++ return false;
379 ++}
380 ++#endif
381 ++
382 + void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
383 + {
384 +- unsigned long tsb_index, tsb_hash_shift, flags;
385 + struct mm_struct *mm;
386 ++ unsigned long flags;
387 + pte_t pte = *ptep;
388 +
389 + if (tlb_type != hypervisor) {
390 +@@ -335,25 +350,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *
391 +
392 + mm = vma->vm_mm;
393 +
394 +- tsb_index = MM_TSB_BASE;
395 +- tsb_hash_shift = PAGE_SHIFT;
396 +-
397 + spin_lock_irqsave(&mm->context.lock, flags);
398 +
399 + #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
400 +- if (mm->context.tsb_block[MM_TSB_HUGE].tsb != NULL) {
401 +- if ((tlb_type == hypervisor &&
402 +- (pte_val(pte) & _PAGE_SZALL_4V) == _PAGE_SZHUGE_4V) ||
403 +- (tlb_type != hypervisor &&
404 +- (pte_val(pte) & _PAGE_SZALL_4U) == _PAGE_SZHUGE_4U)) {
405 +- tsb_index = MM_TSB_HUGE;
406 +- tsb_hash_shift = HPAGE_SHIFT;
407 +- }
408 +- }
409 ++ if (mm->context.huge_pte_count && is_hugetlb_pte(pte))
410 ++ __update_mmu_tsb_insert(mm, MM_TSB_HUGE, HPAGE_SHIFT,
411 ++ address, pte_val(pte));
412 ++ else
413 + #endif
414 +-
415 +- __update_mmu_tsb_insert(mm, tsb_index, tsb_hash_shift,
416 +- address, pte_val(pte));
417 ++ __update_mmu_tsb_insert(mm, MM_TSB_BASE, PAGE_SHIFT,
418 ++ address, pte_val(pte));
419 +
420 + spin_unlock_irqrestore(&mm->context.lock, flags);
421 + }
422 +@@ -2712,14 +2718,28 @@ static void context_reload(void *__data)
423 + load_secondary_context(mm);
424 + }
425 +
426 +-void hugetlb_setup(struct mm_struct *mm)
427 ++void hugetlb_setup(struct pt_regs *regs)
428 + {
429 +- struct tsb_config *tp = &mm->context.tsb_block[MM_TSB_HUGE];
430 ++ struct mm_struct *mm = current->mm;
431 ++ struct tsb_config *tp;
432 +
433 +- if (likely(tp->tsb != NULL))
434 +- return;
435 ++ if (in_atomic() || !mm) {
436 ++ const struct exception_table_entry *entry;
437 ++
438 ++ entry = search_exception_tables(regs->tpc);
439 ++ if (entry) {
440 ++ regs->tpc = entry->fixup;
441 ++ regs->tnpc = regs->tpc + 4;
442 ++ return;
443 ++ }
444 ++ pr_alert("Unexpected HugeTLB setup in atomic context.\n");
445 ++ die_if_kernel("HugeTSB in atomic", regs);
446 ++ }
447 ++
448 ++ tp = &mm->context.tsb_block[MM_TSB_HUGE];
449 ++ if (likely(tp->tsb == NULL))
450 ++ tsb_grow(mm, MM_TSB_HUGE, 0);
451 +
452 +- tsb_grow(mm, MM_TSB_HUGE, 0);
453 + tsb_context_switch(mm);
454 + smp_tsb_sync(mm);
455 +
456 +diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
457 +index 3e8fec3..ba6ae7f 100644
458 +--- a/arch/sparc/mm/tlb.c
459 ++++ b/arch/sparc/mm/tlb.c
460 +@@ -135,8 +135,15 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
461 + mm->context.huge_pte_count++;
462 + else
463 + mm->context.huge_pte_count--;
464 +- if (mm->context.huge_pte_count == 1)
465 +- hugetlb_setup(mm);
466 ++
467 ++ /* Do not try to allocate the TSB hash table if we
468 ++ * don't have one already. We have various locks held
469 ++ * and thus we'll end up doing a GFP_KERNEL allocation
470 ++ * in an atomic context.
471 ++ *
472 ++ * Instead, we let the first TLB miss on a hugepage
473 ++ * take care of this.
474 ++ */
475 + }
476 +
477 + if (!pmd_none(orig)) {
478 +diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
479 +index 7f64743..428982b 100644
480 +--- a/arch/sparc/mm/tsb.c
481 ++++ b/arch/sparc/mm/tsb.c
482 +@@ -314,7 +314,7 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
483 + retry_tsb_alloc:
484 + gfp_flags = GFP_KERNEL;
485 + if (new_size > (PAGE_SIZE * 2))
486 +- gfp_flags = __GFP_NOWARN | __GFP_NORETRY;
487 ++ gfp_flags |= __GFP_NOWARN | __GFP_NORETRY;
488 +
489 + new_tsb = kmem_cache_alloc_node(tsb_caches[new_cache_index],
490 + gfp_flags, numa_node_id());
491 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
492 +index 46c3bff..e957352 100644
493 +--- a/arch/x86/Kconfig
494 ++++ b/arch/x86/Kconfig
495 +@@ -1255,10 +1255,6 @@ config NODES_SHIFT
496 + Specify the maximum number of NUMA Nodes available on the target
497 + system. Increases memory reserved to accommodate various tables.
498 +
499 +-config HAVE_ARCH_ALLOC_REMAP
500 +- def_bool y
501 +- depends on X86_32 && NUMA
502 +-
503 + config ARCH_HAVE_MEMORY_PRESENT
504 + def_bool y
505 + depends on X86_32 && DISCONTIGMEM
506 +diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h
507 +index eb05fb3..8a9b3e2 100644
508 +--- a/arch/x86/include/asm/mmzone_32.h
509 ++++ b/arch/x86/include/asm/mmzone_32.h
510 +@@ -14,12 +14,6 @@ extern struct pglist_data *node_data[];
511 +
512 + #include <asm/numaq.h>
513 +
514 +-extern void resume_map_numa_kva(pgd_t *pgd);
515 +-
516 +-#else /* !CONFIG_NUMA */
517 +-
518 +-static inline void resume_map_numa_kva(pgd_t *pgd) {}
519 +-
520 + #endif /* CONFIG_NUMA */
521 +
522 + #ifdef CONFIG_DISCONTIGMEM
523 +diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
524 +index 0a630dd..646d192 100644
525 +--- a/arch/x86/kernel/cpu/mshyperv.c
526 ++++ b/arch/x86/kernel/cpu/mshyperv.c
527 +@@ -68,7 +68,8 @@ static void __init ms_hyperv_init_platform(void)
528 + printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
529 + ms_hyperv.features, ms_hyperv.hints);
530 +
531 +- clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
532 ++ if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
533 ++ clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
534 + }
535 +
536 + const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
537 +diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
538 +index 2d125be..8504f36 100644
539 +--- a/arch/x86/mm/numa.c
540 ++++ b/arch/x86/mm/numa.c
541 +@@ -193,7 +193,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end)
542 + static void __init setup_node_data(int nid, u64 start, u64 end)
543 + {
544 + const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE);
545 +- bool remapped = false;
546 + u64 nd_pa;
547 + void *nd;
548 + int tnid;
549 +@@ -205,37 +204,28 @@ static void __init setup_node_data(int nid, u64 start, u64 end)
550 + if (end && (end - start) < NODE_MIN_SIZE)
551 + return;
552 +
553 +- /* initialize remap allocator before aligning to ZONE_ALIGN */
554 +- init_alloc_remap(nid, start, end);
555 +-
556 + start = roundup(start, ZONE_ALIGN);
557 +
558 + printk(KERN_INFO "Initmem setup node %d [mem %#010Lx-%#010Lx]\n",
559 + nid, start, end - 1);
560 +
561 + /*
562 +- * Allocate node data. Try remap allocator first, node-local
563 +- * memory and then any node. Never allocate in DMA zone.
564 ++ * Allocate node data. Try node-local memory and then any node.
565 ++ * Never allocate in DMA zone.
566 + */
567 +- nd = alloc_remap(nid, nd_size);
568 +- if (nd) {
569 +- nd_pa = __pa(nd);
570 +- remapped = true;
571 +- } else {
572 +- nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
573 +- if (!nd_pa) {
574 +- pr_err("Cannot find %zu bytes in node %d\n",
575 +- nd_size, nid);
576 +- return;
577 +- }
578 +- nd = __va(nd_pa);
579 ++ nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
580 ++ if (!nd_pa) {
581 ++ pr_err("Cannot find %zu bytes in node %d\n",
582 ++ nd_size, nid);
583 ++ return;
584 + }
585 ++ nd = __va(nd_pa);
586 +
587 + /* report and initialize */
588 +- printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]%s\n",
589 +- nd_pa, nd_pa + nd_size - 1, remapped ? " (remapped)" : "");
590 ++ printk(KERN_INFO " NODE_DATA [mem %#010Lx-%#010Lx]\n",
591 ++ nd_pa, nd_pa + nd_size - 1);
592 + tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
593 +- if (!remapped && tnid != nid)
594 ++ if (tnid != nid)
595 + printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nid, tnid);
596 +
597 + node_data[nid] = nd;
598 +diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
599 +index 534255a..73a6d73 100644
600 +--- a/arch/x86/mm/numa_32.c
601 ++++ b/arch/x86/mm/numa_32.c
602 +@@ -73,167 +73,6 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
603 +
604 + extern unsigned long highend_pfn, highstart_pfn;
605 +
606 +-#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
607 +-
608 +-static void *node_remap_start_vaddr[MAX_NUMNODES];
609 +-void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
610 +-
611 +-/*
612 +- * Remap memory allocator
613 +- */
614 +-static unsigned long node_remap_start_pfn[MAX_NUMNODES];
615 +-static void *node_remap_end_vaddr[MAX_NUMNODES];
616 +-static void *node_remap_alloc_vaddr[MAX_NUMNODES];
617 +-
618 +-/**
619 +- * alloc_remap - Allocate remapped memory
620 +- * @nid: NUMA node to allocate memory from
621 +- * @size: The size of allocation
622 +- *
623 +- * Allocate @size bytes from the remap area of NUMA node @nid. The
624 +- * size of the remap area is predetermined by init_alloc_remap() and
625 +- * only the callers considered there should call this function. For
626 +- * more info, please read the comment on top of init_alloc_remap().
627 +- *
628 +- * The caller must be ready to handle allocation failure from this
629 +- * function and fall back to regular memory allocator in such cases.
630 +- *
631 +- * CONTEXT:
632 +- * Single CPU early boot context.
633 +- *
634 +- * RETURNS:
635 +- * Pointer to the allocated memory on success, %NULL on failure.
636 +- */
637 +-void *alloc_remap(int nid, unsigned long size)
638 +-{
639 +- void *allocation = node_remap_alloc_vaddr[nid];
640 +-
641 +- size = ALIGN(size, L1_CACHE_BYTES);
642 +-
643 +- if (!allocation || (allocation + size) > node_remap_end_vaddr[nid])
644 +- return NULL;
645 +-
646 +- node_remap_alloc_vaddr[nid] += size;
647 +- memset(allocation, 0, size);
648 +-
649 +- return allocation;
650 +-}
651 +-
652 +-#ifdef CONFIG_HIBERNATION
653 +-/**
654 +- * resume_map_numa_kva - add KVA mapping to the temporary page tables created
655 +- * during resume from hibernation
656 +- * @pgd_base - temporary resume page directory
657 +- */
658 +-void resume_map_numa_kva(pgd_t *pgd_base)
659 +-{
660 +- int node;
661 +-
662 +- for_each_online_node(node) {
663 +- unsigned long start_va, start_pfn, nr_pages, pfn;
664 +-
665 +- start_va = (unsigned long)node_remap_start_vaddr[node];
666 +- start_pfn = node_remap_start_pfn[node];
667 +- nr_pages = (node_remap_end_vaddr[node] -
668 +- node_remap_start_vaddr[node]) >> PAGE_SHIFT;
669 +-
670 +- printk(KERN_DEBUG "%s: node %d\n", __func__, node);
671 +-
672 +- for (pfn = 0; pfn < nr_pages; pfn += PTRS_PER_PTE) {
673 +- unsigned long vaddr = start_va + (pfn << PAGE_SHIFT);
674 +- pgd_t *pgd = pgd_base + pgd_index(vaddr);
675 +- pud_t *pud = pud_offset(pgd, vaddr);
676 +- pmd_t *pmd = pmd_offset(pud, vaddr);
677 +-
678 +- set_pmd(pmd, pfn_pmd(start_pfn + pfn,
679 +- PAGE_KERNEL_LARGE_EXEC));
680 +-
681 +- printk(KERN_DEBUG "%s: %08lx -> pfn %08lx\n",
682 +- __func__, vaddr, start_pfn + pfn);
683 +- }
684 +- }
685 +-}
686 +-#endif
687 +-
688 +-/**
689 +- * init_alloc_remap - Initialize remap allocator for a NUMA node
690 +- * @nid: NUMA node to initizlie remap allocator for
691 +- *
692 +- * NUMA nodes may end up without any lowmem. As allocating pgdat and
693 +- * memmap on a different node with lowmem is inefficient, a special
694 +- * remap allocator is implemented which can be used by alloc_remap().
695 +- *
696 +- * For each node, the amount of memory which will be necessary for
697 +- * pgdat and memmap is calculated and two memory areas of the size are
698 +- * allocated - one in the node and the other in lowmem; then, the area
699 +- * in the node is remapped to the lowmem area.
700 +- *
701 +- * As pgdat and memmap must be allocated in lowmem anyway, this
702 +- * doesn't waste lowmem address space; however, the actual lowmem
703 +- * which gets remapped over is wasted. The amount shouldn't be
704 +- * problematic on machines this feature will be used.
705 +- *
706 +- * Initialization failure isn't fatal. alloc_remap() is used
707 +- * opportunistically and the callers will fall back to other memory
708 +- * allocation mechanisms on failure.
709 +- */
710 +-void __init init_alloc_remap(int nid, u64 start, u64 end)
711 +-{
712 +- unsigned long start_pfn = start >> PAGE_SHIFT;
713 +- unsigned long end_pfn = end >> PAGE_SHIFT;
714 +- unsigned long size, pfn;
715 +- u64 node_pa, remap_pa;
716 +- void *remap_va;
717 +-
718 +- /*
719 +- * The acpi/srat node info can show hot-add memroy zones where
720 +- * memory could be added but not currently present.
721 +- */
722 +- printk(KERN_DEBUG "node %d pfn: [%lx - %lx]\n",
723 +- nid, start_pfn, end_pfn);
724 +-
725 +- /* calculate the necessary space aligned to large page size */
726 +- size = node_memmap_size_bytes(nid, start_pfn, end_pfn);
727 +- size += ALIGN(sizeof(pg_data_t), PAGE_SIZE);
728 +- size = ALIGN(size, LARGE_PAGE_BYTES);
729 +-
730 +- /* allocate node memory and the lowmem remap area */
731 +- node_pa = memblock_find_in_range(start, end, size, LARGE_PAGE_BYTES);
732 +- if (!node_pa) {
733 +- pr_warning("remap_alloc: failed to allocate %lu bytes for node %d\n",
734 +- size, nid);
735 +- return;
736 +- }
737 +- memblock_reserve(node_pa, size);
738 +-
739 +- remap_pa = memblock_find_in_range(min_low_pfn << PAGE_SHIFT,
740 +- max_low_pfn << PAGE_SHIFT,
741 +- size, LARGE_PAGE_BYTES);
742 +- if (!remap_pa) {
743 +- pr_warning("remap_alloc: failed to allocate %lu bytes remap area for node %d\n",
744 +- size, nid);
745 +- memblock_free(node_pa, size);
746 +- return;
747 +- }
748 +- memblock_reserve(remap_pa, size);
749 +- remap_va = phys_to_virt(remap_pa);
750 +-
751 +- /* perform actual remap */
752 +- for (pfn = 0; pfn < size >> PAGE_SHIFT; pfn += PTRS_PER_PTE)
753 +- set_pmd_pfn((unsigned long)remap_va + (pfn << PAGE_SHIFT),
754 +- (node_pa >> PAGE_SHIFT) + pfn,
755 +- PAGE_KERNEL_LARGE);
756 +-
757 +- /* initialize remap allocator parameters */
758 +- node_remap_start_pfn[nid] = node_pa >> PAGE_SHIFT;
759 +- node_remap_start_vaddr[nid] = remap_va;
760 +- node_remap_end_vaddr[nid] = remap_va + size;
761 +- node_remap_alloc_vaddr[nid] = remap_va;
762 +-
763 +- printk(KERN_DEBUG "remap_alloc: node %d [%08llx-%08llx) -> [%p-%p)\n",
764 +- nid, node_pa, node_pa + size, remap_va, remap_va + size);
765 +-}
766 +-
767 + void __init initmem_init(void)
768 + {
769 + x86_numa_init();
770 +diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h
771 +index 7178c3a..ad86ec9 100644
772 +--- a/arch/x86/mm/numa_internal.h
773 ++++ b/arch/x86/mm/numa_internal.h
774 +@@ -21,12 +21,6 @@ void __init numa_reset_distance(void);
775 +
776 + void __init x86_numa_init(void);
777 +
778 +-#ifdef CONFIG_X86_64
779 +-static inline void init_alloc_remap(int nid, u64 start, u64 end) { }
780 +-#else
781 +-void __init init_alloc_remap(int nid, u64 start, u64 end);
782 +-#endif
783 +-
784 + #ifdef CONFIG_NUMA_EMU
785 + void __init numa_emulation(struct numa_meminfo *numa_meminfo,
786 + int numa_dist_cnt);
787 +diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
788 +index 74202c1..7d28c88 100644
789 +--- a/arch/x86/power/hibernate_32.c
790 ++++ b/arch/x86/power/hibernate_32.c
791 +@@ -129,8 +129,6 @@ static int resume_physical_mapping_init(pgd_t *pgd_base)
792 + }
793 + }
794 +
795 +- resume_map_numa_kva(pgd_base);
796 +-
797 + return 0;
798 + }
799 +
800 +diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
801 +index 83e866d..f7a080e 100644
802 +--- a/arch/x86/xen/spinlock.c
803 ++++ b/arch/x86/xen/spinlock.c
804 +@@ -328,7 +328,6 @@ static noinline void xen_spin_unlock_slow(struct xen_spinlock *xl)
805 + if (per_cpu(lock_spinners, cpu) == xl) {
806 + ADD_STATS(released_slow_kicked, 1);
807 + xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
808 +- break;
809 + }
810 + }
811 + }
812 +diff --git a/drivers/base/bus.c b/drivers/base/bus.c
813 +index 181ed26..513a02d 100644
814 +--- a/drivers/base/bus.c
815 ++++ b/drivers/base/bus.c
816 +@@ -293,7 +293,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start,
817 + struct device *dev;
818 + int error = 0;
819 +
820 +- if (!bus)
821 ++ if (!bus || !bus->p)
822 + return -EINVAL;
823 +
824 + klist_iter_init_node(&bus->p->klist_devices, &i,
825 +@@ -327,7 +327,7 @@ struct device *bus_find_device(struct bus_type *bus,
826 + struct klist_iter i;
827 + struct device *dev;
828 +
829 +- if (!bus)
830 ++ if (!bus || !bus->p)
831 + return NULL;
832 +
833 + klist_iter_init_node(&bus->p->klist_devices, &i,
834 +diff --git a/drivers/base/dd.c b/drivers/base/dd.c
835 +index e3bbed8..61d3e1b 100644
836 +--- a/drivers/base/dd.c
837 ++++ b/drivers/base/dd.c
838 +@@ -172,6 +172,8 @@ static int deferred_probe_initcall(void)
839 +
840 + driver_deferred_probe_enable = true;
841 + driver_deferred_probe_trigger();
842 ++ /* Sort as many dependencies as possible before exiting initcalls */
843 ++ flush_workqueue(deferred_wq);
844 + return 0;
845 + }
846 + late_initcall(deferred_probe_initcall);
847 +diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
848 +index 9dcf76a..31dd451 100644
849 +--- a/drivers/block/sunvdc.c
850 ++++ b/drivers/block/sunvdc.c
851 +@@ -461,7 +461,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len)
852 + int op_len, err;
853 + void *req_buf;
854 +
855 +- if (!(((u64)1 << ((u64)op - 1)) & port->operations))
856 ++ if (!(((u64)1 << (u64)op) & port->operations))
857 + return -EOPNOTSUPP;
858 +
859 + switch (op) {
860 +diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
861 +index 4e6a2b2..313088f 100644
862 +--- a/drivers/gpu/drm/i915/intel_pm.c
863 ++++ b/drivers/gpu/drm/i915/intel_pm.c
864 +@@ -1474,7 +1474,7 @@ static void i9xx_update_wm(struct drm_device *dev)
865 +
866 + fifo_size = dev_priv->display.get_fifo_size(dev, 0);
867 + crtc = intel_get_crtc_for_plane(dev, 0);
868 +- if (crtc->enabled && crtc->fb) {
869 ++ if (intel_crtc_active(crtc)) {
870 + planea_wm = intel_calculate_wm(crtc->mode.clock,
871 + wm_info, fifo_size,
872 + crtc->fb->bits_per_pixel / 8,
873 +diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
874 +index 082c11b..77c67fc 100644
875 +--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
876 ++++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
877 +@@ -352,7 +352,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
878 + u64 mm_length = (offset + length) - mm_offset;
879 + int ret;
880 +
881 +- vm = *pvm = kzalloc(sizeof(*vm), GFP_KERNEL);
882 ++ vm = kzalloc(sizeof(*vm), GFP_KERNEL);
883 + if (!vm)
884 + return -ENOMEM;
885 +
886 +@@ -376,6 +376,8 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
887 + return ret;
888 + }
889 +
890 ++ *pvm = vm;
891 ++
892 + return 0;
893 + }
894 +
895 +diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
896 +index 315b96e..9fdd198 100644
897 +--- a/drivers/net/wireless/b43/dma.h
898 ++++ b/drivers/net/wireless/b43/dma.h
899 +@@ -169,7 +169,7 @@ struct b43_dmadesc_generic {
900 +
901 + /* DMA engine tuning knobs */
902 + #define B43_TXRING_SLOTS 256
903 +-#define B43_RXRING_SLOTS 64
904 ++#define B43_RXRING_SLOTS 256
905 + #define B43_DMA0_RX_FW598_BUFSIZE (B43_DMA0_RX_FW598_FO + IEEE80211_MAX_FRAME_LEN)
906 + #define B43_DMA0_RX_FW351_BUFSIZE (B43_DMA0_RX_FW351_FO + IEEE80211_MAX_FRAME_LEN)
907 +
908 +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
909 +index 4191294..3d4dd4d 100644
910 +--- a/drivers/net/wireless/p54/p54usb.c
911 ++++ b/drivers/net/wireless/p54/p54usb.c
912 +@@ -84,8 +84,8 @@ static struct usb_device_id p54u_table[] = {
913 + {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
914 + {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
915 + {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */
916 +- {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */
917 + {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
918 ++ {USB_DEVICE(0x083a, 0x4531)}, /* T-Com Sinus 154 data II */
919 + {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */
920 + {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */
921 + {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */
922 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
923 +index b7e6607..6395412 100644
924 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
925 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
926 +@@ -285,6 +285,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
927 + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)},
928 + /* RTL8188CUS-VL */
929 + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x818a, rtl92cu_hal_cfg)},
930 ++ {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x819a, rtl92cu_hal_cfg)},
931 + /* 8188 Combo for BC4 */
932 + {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)},
933 +
934 +diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
935 +index d1c3a7e..0253927 100644
936 +--- a/drivers/net/wireless/rtlwifi/usb.c
937 ++++ b/drivers/net/wireless/rtlwifi/usb.c
938 +@@ -42,8 +42,12 @@
939 +
940 + static void usbctrl_async_callback(struct urb *urb)
941 + {
942 +- if (urb)
943 +- kfree(urb->context);
944 ++ if (urb) {
945 ++ /* free dr */
946 ++ kfree(urb->setup_packet);
947 ++ /* free databuf */
948 ++ kfree(urb->transfer_buffer);
949 ++ }
950 + }
951 +
952 + static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
953 +@@ -55,39 +59,47 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
954 + u8 reqtype;
955 + struct usb_ctrlrequest *dr;
956 + struct urb *urb;
957 +- struct rtl819x_async_write_data {
958 +- u8 data[REALTEK_USB_VENQT_MAX_BUF_SIZE];
959 +- struct usb_ctrlrequest dr;
960 +- } *buf;
961 ++ const u16 databuf_maxlen = REALTEK_USB_VENQT_MAX_BUF_SIZE;
962 ++ u8 *databuf;
963 ++
964 ++ if (WARN_ON_ONCE(len > databuf_maxlen))
965 ++ len = databuf_maxlen;
966 +
967 + pipe = usb_sndctrlpipe(udev, 0); /* write_out */
968 + reqtype = REALTEK_USB_VENQT_WRITE;
969 +
970 +- buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
971 +- if (!buf)
972 ++ dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
973 ++ if (!dr)
974 + return -ENOMEM;
975 +
976 ++ databuf = kmalloc(databuf_maxlen, GFP_ATOMIC);
977 ++ if (!databuf) {
978 ++ kfree(dr);
979 ++ return -ENOMEM;
980 ++ }
981 ++
982 + urb = usb_alloc_urb(0, GFP_ATOMIC);
983 + if (!urb) {
984 +- kfree(buf);
985 ++ kfree(databuf);
986 ++ kfree(dr);
987 + return -ENOMEM;
988 + }
989 +
990 +- dr = &buf->dr;
991 +-
992 + dr->bRequestType = reqtype;
993 + dr->bRequest = request;
994 + dr->wValue = cpu_to_le16(value);
995 + dr->wIndex = cpu_to_le16(index);
996 + dr->wLength = cpu_to_le16(len);
997 + /* data are already in little-endian order */
998 +- memcpy(buf, pdata, len);
999 ++ memcpy(databuf, pdata, len);
1000 + usb_fill_control_urb(urb, udev, pipe,
1001 +- (unsigned char *)dr, buf, len,
1002 +- usbctrl_async_callback, buf);
1003 ++ (unsigned char *)dr, databuf, len,
1004 ++ usbctrl_async_callback, NULL);
1005 + rc = usb_submit_urb(urb, GFP_ATOMIC);
1006 +- if (rc < 0)
1007 +- kfree(buf);
1008 ++ if (rc < 0) {
1009 ++ kfree(databuf);
1010 ++ kfree(dr);
1011 ++ }
1012 + usb_free_urb(urb);
1013 + return rc;
1014 + }
1015 +diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
1016 +index 7dabef6..b846b6c 100644
1017 +--- a/drivers/s390/kvm/kvm_virtio.c
1018 ++++ b/drivers/s390/kvm/kvm_virtio.c
1019 +@@ -422,6 +422,26 @@ static void kvm_extint_handler(struct ext_code ext_code,
1020 + }
1021 +
1022 + /*
1023 ++ * For s390-virtio, we expect a page above main storage containing
1024 ++ * the virtio configuration. Try to actually load from this area
1025 ++ * in order to figure out if the host provides this page.
1026 ++ */
1027 ++static int __init test_devices_support(unsigned long addr)
1028 ++{
1029 ++ int ret = -EIO;
1030 ++
1031 ++ asm volatile(
1032 ++ "0: lura 0,%1\n"
1033 ++ "1: xgr %0,%0\n"
1034 ++ "2:\n"
1035 ++ EX_TABLE(0b,2b)
1036 ++ EX_TABLE(1b,2b)
1037 ++ : "+d" (ret)
1038 ++ : "a" (addr)
1039 ++ : "0", "cc");
1040 ++ return ret;
1041 ++}
1042 ++/*
1043 + * Init function for virtio
1044 + * devices are in a single page above top of "normal" mem
1045 + */
1046 +@@ -432,21 +452,23 @@ static int __init kvm_devices_init(void)
1047 + if (!MACHINE_IS_KVM)
1048 + return -ENODEV;
1049 +
1050 ++ if (test_devices_support(real_memory_size) < 0)
1051 ++ return -ENODEV;
1052 ++
1053 ++ rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
1054 ++ if (rc)
1055 ++ return rc;
1056 ++
1057 ++ kvm_devices = (void *) real_memory_size;
1058 ++
1059 + kvm_root = root_device_register("kvm_s390");
1060 + if (IS_ERR(kvm_root)) {
1061 + rc = PTR_ERR(kvm_root);
1062 + printk(KERN_ERR "Could not register kvm_s390 root device");
1063 ++ vmem_remove_mapping(real_memory_size, PAGE_SIZE);
1064 + return rc;
1065 + }
1066 +
1067 +- rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
1068 +- if (rc) {
1069 +- root_device_unregister(kvm_root);
1070 +- return rc;
1071 +- }
1072 +-
1073 +- kvm_devices = (void *) real_memory_size;
1074 +-
1075 + INIT_WORK(&hotplug_work, hotplug_devices);
1076 +
1077 + service_subclass_irq_register();
1078 +diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
1079 +index f2a73bd..071e058 100644
1080 +--- a/drivers/staging/zram/zram_drv.c
1081 ++++ b/drivers/staging/zram/zram_drv.c
1082 +@@ -228,11 +228,12 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
1083 + return 0;
1084 + }
1085 +
1086 +- user_mem = kmap_atomic(page);
1087 + if (is_partial_io(bvec))
1088 + /* Use a temporary buffer to decompress the page */
1089 +- uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL);
1090 +- else
1091 ++ uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
1092 ++
1093 ++ user_mem = kmap_atomic(page);
1094 ++ if (!is_partial_io(bvec))
1095 + uncmem = user_mem;
1096 +
1097 + if (!uncmem) {
1098 +@@ -279,7 +280,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
1099 + * This is a partial IO. We need to read the full page
1100 + * before to write the changes.
1101 + */
1102 +- uncmem = kmalloc(PAGE_SIZE, GFP_KERNEL);
1103 ++ uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
1104 + if (!uncmem) {
1105 + pr_info("Error allocating temp memory!\n");
1106 + ret = -ENOMEM;
1107 +diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
1108 +index 0943ff0..94fda90 100644
1109 +--- a/drivers/target/target_core_device.c
1110 ++++ b/drivers/target/target_core_device.c
1111 +@@ -1195,6 +1195,8 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth)
1112 +
1113 + int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors)
1114 + {
1115 ++ int block_size = dev->se_sub_dev->se_dev_attrib.block_size;
1116 ++
1117 + if (atomic_read(&dev->dev_export_obj.obj_access_count)) {
1118 + pr_err("dev[%p]: Unable to change SE Device"
1119 + " fabric_max_sectors while dev_export_obj: %d count exists\n",
1120 +@@ -1232,8 +1234,12 @@ int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors)
1121 + /*
1122 + * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks()
1123 + */
1124 ++ if (!block_size) {
1125 ++ block_size = 512;
1126 ++ pr_warn("Defaulting to 512 for zero block_size\n");
1127 ++ }
1128 + fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors,
1129 +- dev->se_sub_dev->se_dev_attrib.block_size);
1130 ++ block_size);
1131 +
1132 + dev->se_sub_dev->se_dev_attrib.fabric_max_sectors = fabric_max_sectors;
1133 + pr_debug("dev[%p]: SE Device max_sectors changed to %u\n",
1134 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
1135 +index 1e8e8ce..b94da78 100644
1136 +--- a/drivers/tty/n_gsm.c
1137 ++++ b/drivers/tty/n_gsm.c
1138 +@@ -1691,6 +1691,8 @@ static inline void dlci_put(struct gsm_dlci *dlci)
1139 + kref_put(&dlci->ref, gsm_dlci_free);
1140 + }
1141 +
1142 ++static void gsm_destroy_network(struct gsm_dlci *dlci);
1143 ++
1144 + /**
1145 + * gsm_dlci_release - release DLCI
1146 + * @dlci: DLCI to destroy
1147 +@@ -1704,9 +1706,19 @@ static void gsm_dlci_release(struct gsm_dlci *dlci)
1148 + {
1149 + struct tty_struct *tty = tty_port_tty_get(&dlci->port);
1150 + if (tty) {
1151 ++ mutex_lock(&dlci->mutex);
1152 ++ gsm_destroy_network(dlci);
1153 ++ mutex_unlock(&dlci->mutex);
1154 ++
1155 ++ /* tty_vhangup needs the tty_lock, so unlock and
1156 ++ relock after doing the hangup. */
1157 ++ tty_unlock(tty);
1158 + tty_vhangup(tty);
1159 ++ tty_lock(tty);
1160 ++ tty_port_tty_set(&dlci->port, NULL);
1161 + tty_kref_put(tty);
1162 + }
1163 ++ dlci->state = DLCI_CLOSED;
1164 + dlci_put(dlci);
1165 + }
1166 +
1167 +@@ -2948,6 +2960,8 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp)
1168 +
1169 + if (dlci == NULL)
1170 + return;
1171 ++ if (dlci->state == DLCI_CLOSED)
1172 ++ return;
1173 + mutex_lock(&dlci->mutex);
1174 + gsm_destroy_network(dlci);
1175 + mutex_unlock(&dlci->mutex);
1176 +@@ -2966,6 +2980,8 @@ out:
1177 + static void gsmtty_hangup(struct tty_struct *tty)
1178 + {
1179 + struct gsm_dlci *dlci = tty->driver_data;
1180 ++ if (dlci->state == DLCI_CLOSED)
1181 ++ return;
1182 + tty_port_hangup(&dlci->port);
1183 + gsm_dlci_begin_close(dlci);
1184 + }
1185 +@@ -2973,9 +2989,12 @@ static void gsmtty_hangup(struct tty_struct *tty)
1186 + static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
1187 + int len)
1188 + {
1189 ++ int sent;
1190 + struct gsm_dlci *dlci = tty->driver_data;
1191 ++ if (dlci->state == DLCI_CLOSED)
1192 ++ return -EINVAL;
1193 + /* Stuff the bytes into the fifo queue */
1194 +- int sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
1195 ++ sent = kfifo_in_locked(dlci->fifo, buf, len, &dlci->lock);
1196 + /* Need to kick the channel */
1197 + gsm_dlci_data_kick(dlci);
1198 + return sent;
1199 +@@ -2984,18 +3003,24 @@ static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
1200 + static int gsmtty_write_room(struct tty_struct *tty)
1201 + {
1202 + struct gsm_dlci *dlci = tty->driver_data;
1203 ++ if (dlci->state == DLCI_CLOSED)
1204 ++ return -EINVAL;
1205 + return TX_SIZE - kfifo_len(dlci->fifo);
1206 + }
1207 +
1208 + static int gsmtty_chars_in_buffer(struct tty_struct *tty)
1209 + {
1210 + struct gsm_dlci *dlci = tty->driver_data;
1211 ++ if (dlci->state == DLCI_CLOSED)
1212 ++ return -EINVAL;
1213 + return kfifo_len(dlci->fifo);
1214 + }
1215 +
1216 + static void gsmtty_flush_buffer(struct tty_struct *tty)
1217 + {
1218 + struct gsm_dlci *dlci = tty->driver_data;
1219 ++ if (dlci->state == DLCI_CLOSED)
1220 ++ return;
1221 + /* Caution needed: If we implement reliable transport classes
1222 + then the data being transmitted can't simply be junked once
1223 + it has first hit the stack. Until then we can just blow it
1224 +@@ -3014,6 +3039,8 @@ static void gsmtty_wait_until_sent(struct tty_struct *tty, int timeout)
1225 + static int gsmtty_tiocmget(struct tty_struct *tty)
1226 + {
1227 + struct gsm_dlci *dlci = tty->driver_data;
1228 ++ if (dlci->state == DLCI_CLOSED)
1229 ++ return -EINVAL;
1230 + return dlci->modem_rx;
1231 + }
1232 +
1233 +@@ -3023,6 +3050,8 @@ static int gsmtty_tiocmset(struct tty_struct *tty,
1234 + struct gsm_dlci *dlci = tty->driver_data;
1235 + unsigned int modem_tx = dlci->modem_tx;
1236 +
1237 ++ if (dlci->state == DLCI_CLOSED)
1238 ++ return -EINVAL;
1239 + modem_tx &= ~clear;
1240 + modem_tx |= set;
1241 +
1242 +@@ -3041,6 +3070,8 @@ static int gsmtty_ioctl(struct tty_struct *tty,
1243 + struct gsm_netconfig nc;
1244 + int index;
1245 +
1246 ++ if (dlci->state == DLCI_CLOSED)
1247 ++ return -EINVAL;
1248 + switch (cmd) {
1249 + case GSMIOC_ENABLE_NET:
1250 + if (copy_from_user(&nc, (void __user *)arg, sizeof(nc)))
1251 +@@ -3067,6 +3098,9 @@ static int gsmtty_ioctl(struct tty_struct *tty,
1252 +
1253 + static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old)
1254 + {
1255 ++ struct gsm_dlci *dlci = tty->driver_data;
1256 ++ if (dlci->state == DLCI_CLOSED)
1257 ++ return;
1258 + /* For the moment its fixed. In actual fact the speed information
1259 + for the virtual channel can be propogated in both directions by
1260 + the RPN control message. This however rapidly gets nasty as we
1261 +@@ -3078,6 +3112,8 @@ static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old)
1262 + static void gsmtty_throttle(struct tty_struct *tty)
1263 + {
1264 + struct gsm_dlci *dlci = tty->driver_data;
1265 ++ if (dlci->state == DLCI_CLOSED)
1266 ++ return;
1267 + if (tty->termios.c_cflag & CRTSCTS)
1268 + dlci->modem_tx &= ~TIOCM_DTR;
1269 + dlci->throttled = 1;
1270 +@@ -3088,6 +3124,8 @@ static void gsmtty_throttle(struct tty_struct *tty)
1271 + static void gsmtty_unthrottle(struct tty_struct *tty)
1272 + {
1273 + struct gsm_dlci *dlci = tty->driver_data;
1274 ++ if (dlci->state == DLCI_CLOSED)
1275 ++ return;
1276 + if (tty->termios.c_cflag & CRTSCTS)
1277 + dlci->modem_tx |= TIOCM_DTR;
1278 + dlci->throttled = 0;
1279 +@@ -3099,6 +3137,8 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state)
1280 + {
1281 + struct gsm_dlci *dlci = tty->driver_data;
1282 + int encode = 0; /* Off */
1283 ++ if (dlci->state == DLCI_CLOSED)
1284 ++ return -EINVAL;
1285 +
1286 + if (state == -1) /* "On indefinitely" - we can't encode this
1287 + properly */
1288 +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
1289 +index 5981912..5c110c8 100644
1290 +--- a/drivers/tty/serial/imx.c
1291 ++++ b/drivers/tty/serial/imx.c
1292 +@@ -1213,8 +1213,14 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1293 + struct imx_port_ucrs old_ucr;
1294 + unsigned int ucr1;
1295 + unsigned long flags;
1296 ++ int locked = 1;
1297 +
1298 +- spin_lock_irqsave(&sport->port.lock, flags);
1299 ++ if (sport->port.sysrq)
1300 ++ locked = 0;
1301 ++ else if (oops_in_progress)
1302 ++ locked = spin_trylock_irqsave(&sport->port.lock, flags);
1303 ++ else
1304 ++ spin_lock_irqsave(&sport->port.lock, flags);
1305 +
1306 + /*
1307 + * First, save UCR1/2/3 and then disable interrupts
1308 +@@ -1241,7 +1247,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1309 +
1310 + imx_port_ucrs_restore(&sport->port, &old_ucr);
1311 +
1312 +- spin_unlock_irqrestore(&sport->port.lock, flags);
1313 ++ if (locked)
1314 ++ spin_unlock_irqrestore(&sport->port.lock, flags);
1315 + }
1316 +
1317 + /*
1318 +diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
1319 +index 12b1fa0..f7d2e89 100644
1320 +--- a/drivers/tty/tty_ioctl.c
1321 ++++ b/drivers/tty/tty_ioctl.c
1322 +@@ -617,7 +617,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
1323 + if (opt & TERMIOS_WAIT) {
1324 + tty_wait_until_sent(tty, 0);
1325 + if (signal_pending(current))
1326 +- return -EINTR;
1327 ++ return -ERESTARTSYS;
1328 + }
1329 +
1330 + tty_set_termios(tty, &tmp_termios);
1331 +@@ -684,7 +684,7 @@ static int set_termiox(struct tty_struct *tty, void __user *arg, int opt)
1332 + if (opt & TERMIOS_WAIT) {
1333 + tty_wait_until_sent(tty, 0);
1334 + if (signal_pending(current))
1335 +- return -EINTR;
1336 ++ return -ERESTARTSYS;
1337 + }
1338 +
1339 + mutex_lock(&tty->termios_mutex);
1340 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
1341 +index 4e0d0c3..e94c11c 100644
1342 +--- a/drivers/tty/vt/vt.c
1343 ++++ b/drivers/tty/vt/vt.c
1344 +@@ -539,7 +539,7 @@ static void insert_char(struct vc_data *vc, unsigned int nr)
1345 + {
1346 + unsigned short *p = (unsigned short *) vc->vc_pos;
1347 +
1348 +- scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x) * 2);
1349 ++ scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2);
1350 + scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
1351 + vc->vc_need_wrap = 0;
1352 + if (DO_UPDATE(vc))
1353 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1354 +index b786b7d..50fbc30 100644
1355 +--- a/drivers/usb/serial/ftdi_sio.c
1356 ++++ b/drivers/usb/serial/ftdi_sio.c
1357 +@@ -1884,24 +1884,22 @@ static void ftdi_dtr_rts(struct usb_serial_port *port, int on)
1358 + {
1359 + struct ftdi_private *priv = usb_get_serial_port_data(port);
1360 +
1361 +- mutex_lock(&port->serial->disc_mutex);
1362 +- if (!port->serial->disconnected) {
1363 +- /* Disable flow control */
1364 +- if (!on && usb_control_msg(port->serial->dev,
1365 ++ /* Disable flow control */
1366 ++ if (!on) {
1367 ++ if (usb_control_msg(port->serial->dev,
1368 + usb_sndctrlpipe(port->serial->dev, 0),
1369 + FTDI_SIO_SET_FLOW_CTRL_REQUEST,
1370 + FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
1371 + 0, priv->interface, NULL, 0,
1372 + WDR_TIMEOUT) < 0) {
1373 +- dev_err(&port->dev, "error from flowcontrol urb\n");
1374 ++ dev_err(&port->dev, "error from flowcontrol urb\n");
1375 + }
1376 +- /* drop RTS and DTR */
1377 +- if (on)
1378 +- set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1379 +- else
1380 +- clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1381 + }
1382 +- mutex_unlock(&port->serial->disc_mutex);
1383 ++ /* drop RTS and DTR */
1384 ++ if (on)
1385 ++ set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1386 ++ else
1387 ++ clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1388 + }
1389 +
1390 + /*
1391 +diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
1392 +index 8a20810..6602059 100644
1393 +--- a/drivers/usb/serial/mct_u232.c
1394 ++++ b/drivers/usb/serial/mct_u232.c
1395 +@@ -503,19 +503,15 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on)
1396 + unsigned int control_state;
1397 + struct mct_u232_private *priv = usb_get_serial_port_data(port);
1398 +
1399 +- mutex_lock(&port->serial->disc_mutex);
1400 +- if (!port->serial->disconnected) {
1401 +- /* drop DTR and RTS */
1402 +- spin_lock_irq(&priv->lock);
1403 +- if (on)
1404 +- priv->control_state |= TIOCM_DTR | TIOCM_RTS;
1405 +- else
1406 +- priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
1407 +- control_state = priv->control_state;
1408 +- spin_unlock_irq(&priv->lock);
1409 +- mct_u232_set_modem_ctrl(port, control_state);
1410 +- }
1411 +- mutex_unlock(&port->serial->disc_mutex);
1412 ++ spin_lock_irq(&priv->lock);
1413 ++ if (on)
1414 ++ priv->control_state |= TIOCM_DTR | TIOCM_RTS;
1415 ++ else
1416 ++ priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
1417 ++ control_state = priv->control_state;
1418 ++ spin_unlock_irq(&priv->lock);
1419 ++
1420 ++ mct_u232_set_modem_ctrl(port, control_state);
1421 + }
1422 +
1423 + static void mct_u232_close(struct usb_serial_port *port)
1424 +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
1425 +index ffcfc96..0cba503 100644
1426 +--- a/drivers/usb/serial/quatech2.c
1427 ++++ b/drivers/usb/serial/quatech2.c
1428 +@@ -947,19 +947,17 @@ static void qt2_dtr_rts(struct usb_serial_port *port, int on)
1429 + struct usb_device *dev = port->serial->dev;
1430 + struct qt2_port_private *port_priv = usb_get_serial_port_data(port);
1431 +
1432 +- mutex_lock(&port->serial->disc_mutex);
1433 +- if (!port->serial->disconnected) {
1434 +- /* Disable flow control */
1435 +- if (!on && qt2_setregister(dev, port_priv->device_port,
1436 ++ /* Disable flow control */
1437 ++ if (!on) {
1438 ++ if (qt2_setregister(dev, port_priv->device_port,
1439 + UART_MCR, 0) < 0)
1440 + dev_warn(&port->dev, "error from flowcontrol urb\n");
1441 +- /* drop RTS and DTR */
1442 +- if (on)
1443 +- update_mctrl(port_priv, TIOCM_DTR | TIOCM_RTS, 0);
1444 +- else
1445 +- update_mctrl(port_priv, 0, TIOCM_DTR | TIOCM_RTS);
1446 + }
1447 +- mutex_unlock(&port->serial->disc_mutex);
1448 ++ /* drop RTS and DTR */
1449 ++ if (on)
1450 ++ update_mctrl(port_priv, TIOCM_DTR | TIOCM_RTS, 0);
1451 ++ else
1452 ++ update_mctrl(port_priv, 0, TIOCM_DTR | TIOCM_RTS);
1453 + }
1454 +
1455 + static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
1456 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
1457 +index 270860f..4eed702 100644
1458 +--- a/drivers/usb/serial/sierra.c
1459 ++++ b/drivers/usb/serial/sierra.c
1460 +@@ -861,19 +861,13 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port)
1461 +
1462 + static void sierra_dtr_rts(struct usb_serial_port *port, int on)
1463 + {
1464 +- struct usb_serial *serial = port->serial;
1465 + struct sierra_port_private *portdata;
1466 +
1467 + portdata = usb_get_serial_port_data(port);
1468 + portdata->rts_state = on;
1469 + portdata->dtr_state = on;
1470 +
1471 +- if (serial->dev) {
1472 +- mutex_lock(&serial->disc_mutex);
1473 +- if (!serial->disconnected)
1474 +- sierra_send_setup(port);
1475 +- mutex_unlock(&serial->disc_mutex);
1476 +- }
1477 ++ sierra_send_setup(port);
1478 + }
1479 +
1480 + static int sierra_startup(struct usb_serial *serial)
1481 +diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
1482 +index 868d1e6..5238bf8 100644
1483 +--- a/drivers/usb/serial/ssu100.c
1484 ++++ b/drivers/usb/serial/ssu100.c
1485 +@@ -508,19 +508,16 @@ static void ssu100_dtr_rts(struct usb_serial_port *port, int on)
1486 + {
1487 + struct usb_device *dev = port->serial->dev;
1488 +
1489 +- mutex_lock(&port->serial->disc_mutex);
1490 +- if (!port->serial->disconnected) {
1491 +- /* Disable flow control */
1492 +- if (!on &&
1493 +- ssu100_setregister(dev, 0, UART_MCR, 0) < 0)
1494 ++ /* Disable flow control */
1495 ++ if (!on) {
1496 ++ if (ssu100_setregister(dev, 0, UART_MCR, 0) < 0)
1497 + dev_err(&port->dev, "error from flowcontrol urb\n");
1498 +- /* drop RTS and DTR */
1499 +- if (on)
1500 +- set_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
1501 +- else
1502 +- clear_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
1503 + }
1504 +- mutex_unlock(&port->serial->disc_mutex);
1505 ++ /* drop RTS and DTR */
1506 ++ if (on)
1507 ++ set_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
1508 ++ else
1509 ++ clear_mctrl(dev, TIOCM_DTR | TIOCM_RTS);
1510 + }
1511 +
1512 + static void ssu100_update_msr(struct usb_serial_port *port, u8 msr)
1513 +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
1514 +index 73b8e05..f057f4d 100644
1515 +--- a/drivers/usb/serial/usb-serial.c
1516 ++++ b/drivers/usb/serial/usb-serial.c
1517 +@@ -687,10 +687,20 @@ static int serial_carrier_raised(struct tty_port *port)
1518 + static void serial_dtr_rts(struct tty_port *port, int on)
1519 + {
1520 + struct usb_serial_port *p = container_of(port, struct usb_serial_port, port);
1521 +- struct usb_serial_driver *drv = p->serial->type;
1522 ++ struct usb_serial *serial = p->serial;
1523 ++ struct usb_serial_driver *drv = serial->type;
1524 +
1525 +- if (drv->dtr_rts)
1526 ++ if (!drv->dtr_rts)
1527 ++ return;
1528 ++ /*
1529 ++ * Work-around bug in the tty-layer which can result in dtr_rts
1530 ++ * being called after a disconnect (and tty_unregister_device
1531 ++ * has returned). Remove once bug has been squashed.
1532 ++ */
1533 ++ mutex_lock(&serial->disc_mutex);
1534 ++ if (!serial->disconnected)
1535 + drv->dtr_rts(p, on);
1536 ++ mutex_unlock(&serial->disc_mutex);
1537 + }
1538 +
1539 + static const struct tty_port_operations serial_port_ops = {
1540 +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
1541 +index a3e9c09..2897859 100644
1542 +--- a/drivers/usb/serial/usb_wwan.c
1543 ++++ b/drivers/usb/serial/usb_wwan.c
1544 +@@ -39,7 +39,6 @@
1545 +
1546 + void usb_wwan_dtr_rts(struct usb_serial_port *port, int on)
1547 + {
1548 +- struct usb_serial *serial = port->serial;
1549 + struct usb_wwan_port_private *portdata;
1550 + struct usb_wwan_intf_private *intfdata;
1551 +
1552 +@@ -49,12 +48,11 @@ void usb_wwan_dtr_rts(struct usb_serial_port *port, int on)
1553 + return;
1554 +
1555 + portdata = usb_get_serial_port_data(port);
1556 +- mutex_lock(&serial->disc_mutex);
1557 ++ /* FIXME: locking */
1558 + portdata->rts_state = on;
1559 + portdata->dtr_state = on;
1560 +- if (serial->dev)
1561 +- intfdata->send_setup(port);
1562 +- mutex_unlock(&serial->disc_mutex);
1563 ++
1564 ++ intfdata->send_setup(port);
1565 + }
1566 + EXPORT_SYMBOL(usb_wwan_dtr_rts);
1567 +
1568 +diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
1569 +index 77d1fdb..716daaa 100644
1570 +--- a/drivers/video/backlight/adp8860_bl.c
1571 ++++ b/drivers/video/backlight/adp8860_bl.c
1572 +@@ -783,7 +783,7 @@ static int adp8860_i2c_suspend(struct i2c_client *client, pm_message_t message)
1573 +
1574 + static int adp8860_i2c_resume(struct i2c_client *client)
1575 + {
1576 +- adp8860_set_bits(client, ADP8860_MDCR, NSTBY);
1577 ++ adp8860_set_bits(client, ADP8860_MDCR, NSTBY | BLEN);
1578 +
1579 + return 0;
1580 + }
1581 +diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
1582 +index edf7f91..f58a189 100644
1583 +--- a/drivers/video/backlight/adp8870_bl.c
1584 ++++ b/drivers/video/backlight/adp8870_bl.c
1585 +@@ -957,7 +957,7 @@ static int adp8870_i2c_suspend(struct i2c_client *client, pm_message_t message)
1586 +
1587 + static int adp8870_i2c_resume(struct i2c_client *client)
1588 + {
1589 +- adp8870_set_bits(client, ADP8870_MDCR, NSTBY);
1590 ++ adp8870_set_bits(client, ADP8870_MDCR, NSTBY | BLEN);
1591 +
1592 + return 0;
1593 + }
1594 +diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
1595 +index b1f60a0..b2db77e 100644
1596 +--- a/drivers/xen/evtchn.c
1597 ++++ b/drivers/xen/evtchn.c
1598 +@@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port)
1599 + u->name, (void *)(unsigned long)port);
1600 + if (rc >= 0)
1601 + rc = evtchn_make_refcounted(port);
1602 ++ else {
1603 ++ /* bind failed, should close the port now */
1604 ++ struct evtchn_close close;
1605 ++ close.port = port;
1606 ++ if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
1607 ++ BUG();
1608 ++ set_port_user(port, NULL);
1609 ++ }
1610 +
1611 + return rc;
1612 + }
1613 +@@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port)
1614 + {
1615 + int irq = irq_from_evtchn(port);
1616 +
1617 ++ BUG_ON(irq < 0);
1618 ++
1619 + unbind_from_irqhandler(irq, (void *)(unsigned long)port);
1620 +
1621 + set_port_user(port, NULL);
1622 +diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
1623 +index 97f5d26..37c1f82 100644
1624 +--- a/drivers/xen/xen-pciback/pciback_ops.c
1625 ++++ b/drivers/xen/xen-pciback/pciback_ops.c
1626 +@@ -135,7 +135,6 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev,
1627 + struct pci_dev *dev, struct xen_pci_op *op)
1628 + {
1629 + struct xen_pcibk_dev_data *dev_data;
1630 +- int otherend = pdev->xdev->otherend_id;
1631 + int status;
1632 +
1633 + if (unlikely(verbose_request))
1634 +@@ -144,8 +143,9 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev,
1635 + status = pci_enable_msi(dev);
1636 +
1637 + if (status) {
1638 +- printk(KERN_ERR "error enable msi for guest %x status %x\n",
1639 +- otherend, status);
1640 ++ pr_warn_ratelimited(DRV_NAME ": %s: error enabling MSI for guest %u: err %d\n",
1641 ++ pci_name(dev), pdev->xdev->otherend_id,
1642 ++ status);
1643 + op->value = 0;
1644 + return XEN_PCI_ERR_op_failed;
1645 + }
1646 +@@ -223,10 +223,10 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
1647 + pci_name(dev), i,
1648 + op->msix_entries[i].vector);
1649 + }
1650 +- } else {
1651 +- printk(KERN_WARNING DRV_NAME ": %s: failed to enable MSI-X: err %d!\n",
1652 +- pci_name(dev), result);
1653 +- }
1654 ++ } else
1655 ++ pr_warn_ratelimited(DRV_NAME ": %s: error enabling MSI-X for guest %u: err %d!\n",
1656 ++ pci_name(dev), pdev->xdev->otherend_id,
1657 ++ result);
1658 + kfree(entries);
1659 +
1660 + op->value = result;
1661 +diff --git a/fs/block_dev.c b/fs/block_dev.c
1662 +index ab3a456..c42cd59 100644
1663 +--- a/fs/block_dev.c
1664 ++++ b/fs/block_dev.c
1665 +@@ -994,6 +994,7 @@ int revalidate_disk(struct gendisk *disk)
1666 +
1667 + mutex_lock(&bdev->bd_mutex);
1668 + check_disk_size_change(disk, bdev);
1669 ++ bdev->bd_invalidated = 0;
1670 + mutex_unlock(&bdev->bd_mutex);
1671 + bdput(bdev);
1672 + return ret;
1673 +diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
1674 +index 1fd3ae2..8f331e0 100644
1675 +--- a/fs/gfs2/bmap.c
1676 ++++ b/fs/gfs2/bmap.c
1677 +@@ -1240,6 +1240,10 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
1678 +
1679 + inode_dio_wait(inode);
1680 +
1681 ++ ret = gfs2_rs_alloc(GFS2_I(inode));
1682 ++ if (ret)
1683 ++ return ret;
1684 ++
1685 + oldsize = inode->i_size;
1686 + if (newsize >= oldsize)
1687 + return do_grow(inode, newsize);
1688 +diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
1689 +index 05d2912..a5657ff 100644
1690 +--- a/fs/lockd/clntproc.c
1691 ++++ b/fs/lockd/clntproc.c
1692 +@@ -551,6 +551,9 @@ again:
1693 + status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT);
1694 + if (status < 0)
1695 + break;
1696 ++ /* Resend the blocking lock request after a server reboot */
1697 ++ if (resp->status == nlm_lck_denied_grace_period)
1698 ++ continue;
1699 + if (resp->status != nlm_lck_blocked)
1700 + break;
1701 + }
1702 +diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
1703 +index f1027b0..1e481c5 100644
1704 +--- a/fs/nfs/blocklayout/blocklayout.c
1705 ++++ b/fs/nfs/blocklayout/blocklayout.c
1706 +@@ -1272,6 +1272,7 @@ static const struct nfs_pageio_ops bl_pg_write_ops = {
1707 + static struct pnfs_layoutdriver_type blocklayout_type = {
1708 + .id = LAYOUT_BLOCK_VOLUME,
1709 + .name = "LAYOUT_BLOCK_VOLUME",
1710 ++ .owner = THIS_MODULE,
1711 + .read_pagelist = bl_read_pagelist,
1712 + .write_pagelist = bl_write_pagelist,
1713 + .alloc_layout_hdr = bl_alloc_layout_hdr,
1714 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1715 +index 4432b2f..50bf31d 100644
1716 +--- a/fs/nfs/nfs4proc.c
1717 ++++ b/fs/nfs/nfs4proc.c
1718 +@@ -6517,7 +6517,8 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
1719 + status = nfs4_wait_for_completion_rpc_task(task);
1720 + if (status == 0)
1721 + status = task->tk_status;
1722 +- if (status == 0)
1723 ++ /* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */
1724 ++ if (status == 0 && lgp->res.layoutp->len)
1725 + lseg = pnfs_layout_process(lgp);
1726 + rpc_put_task(task);
1727 + dprintk("<-- %s status=%d\n", __func__, status);
1728 +diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
1729 +index c6f9906..88f9611 100644
1730 +--- a/fs/nfs/objlayout/objio_osd.c
1731 ++++ b/fs/nfs/objlayout/objio_osd.c
1732 +@@ -647,6 +647,7 @@ static struct pnfs_layoutdriver_type objlayout_type = {
1733 + .flags = PNFS_LAYOUTRET_ON_SETATTR |
1734 + PNFS_LAYOUTRET_ON_ERROR,
1735 +
1736 ++ .owner = THIS_MODULE,
1737 + .alloc_layout_hdr = objlayout_alloc_layout_hdr,
1738 + .free_layout_hdr = objlayout_free_layout_hdr,
1739 +
1740 +diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
1741 +index c311dda..448744c 100644
1742 +--- a/fs/notify/inotify/inotify_user.c
1743 ++++ b/fs/notify/inotify/inotify_user.c
1744 +@@ -579,8 +579,6 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
1745 +
1746 + /* don't allow invalid bits: we don't want flags set */
1747 + mask = inotify_arg_to_mask(arg);
1748 +- if (unlikely(!(mask & IN_ALL_EVENTS)))
1749 +- return -EINVAL;
1750 +
1751 + fsn_mark = fsnotify_find_inode_mark(group, inode);
1752 + if (!fsn_mark)
1753 +@@ -632,8 +630,6 @@ static int inotify_new_watch(struct fsnotify_group *group,
1754 +
1755 + /* don't allow invalid bits: we don't want flags set */
1756 + mask = inotify_arg_to_mask(arg);
1757 +- if (unlikely(!(mask & IN_ALL_EVENTS)))
1758 +- return -EINVAL;
1759 +
1760 + tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
1761 + if (unlikely(!tmp_i_mark))
1762 +diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
1763 +index 4f7795f..88577eb 100644
1764 +--- a/fs/ocfs2/dlmglue.c
1765 ++++ b/fs/ocfs2/dlmglue.c
1766 +@@ -2545,6 +2545,7 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
1767 + * everything is up to the caller :) */
1768 + status = ocfs2_should_refresh_lock_res(lockres);
1769 + if (status < 0) {
1770 ++ ocfs2_cluster_unlock(osb, lockres, level);
1771 + mlog_errno(status);
1772 + goto bail;
1773 + }
1774 +@@ -2553,8 +2554,10 @@ int ocfs2_super_lock(struct ocfs2_super *osb,
1775 +
1776 + ocfs2_complete_lock_res_refresh(lockres, status);
1777 +
1778 +- if (status < 0)
1779 ++ if (status < 0) {
1780 ++ ocfs2_cluster_unlock(osb, lockres, level);
1781 + mlog_errno(status);
1782 ++ }
1783 + ocfs2_track_lock_refresh(lockres);
1784 + }
1785 + bail:
1786 +diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
1787 +index dbb95db..ca2560c 100644
1788 +--- a/include/uapi/linux/serial_core.h
1789 ++++ b/include/uapi/linux/serial_core.h
1790 +@@ -50,7 +50,7 @@
1791 + #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
1792 + #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
1793 + #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
1794 +-#define PORT_BRCM_TRUMANAGE 24
1795 ++#define PORT_BRCM_TRUMANAGE 25
1796 + #define PORT_MAX_8250 25 /* max port ID */
1797 +
1798 + /*
1799 +diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
1800 +index ac90037..d2314be 100644
1801 +--- a/include/uapi/linux/usb/audio.h
1802 ++++ b/include/uapi/linux/usb/audio.h
1803 +@@ -384,14 +384,16 @@ static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_de
1804 + int protocol)
1805 + {
1806 + __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
1807 +- return desc->baSourceID[desc->bNrInPins + control_size];
1808 ++ return *(uac_processing_unit_bmControls(desc, protocol)
1809 ++ + control_size);
1810 + }
1811 +
1812 + static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
1813 + int protocol)
1814 + {
1815 + __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
1816 +- return &desc->baSourceID[desc->bNrInPins + control_size + 1];
1817 ++ return uac_processing_unit_bmControls(desc, protocol)
1818 ++ + control_size + 1;
1819 + }
1820 +
1821 + /* 4.5.2 Class-Specific AS Interface Descriptor */
1822 +diff --git a/kernel/futex.c b/kernel/futex.c
1823 +index 19eb089..8879430 100644
1824 +--- a/kernel/futex.c
1825 ++++ b/kernel/futex.c
1826 +@@ -2471,8 +2471,6 @@ SYSCALL_DEFINE3(get_robust_list, int, pid,
1827 + if (!futex_cmpxchg_enabled)
1828 + return -ENOSYS;
1829 +
1830 +- WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n");
1831 +-
1832 + rcu_read_lock();
1833 +
1834 + ret = -ESRCH;
1835 +diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
1836 +index 83e368b..a9642d5 100644
1837 +--- a/kernel/futex_compat.c
1838 ++++ b/kernel/futex_compat.c
1839 +@@ -142,8 +142,6 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
1840 + if (!futex_cmpxchg_enabled)
1841 + return -ENOSYS;
1842 +
1843 +- WARN_ONCE(1, "deprecated: get_robust_list will be deleted in 2013.\n");
1844 +-
1845 + rcu_read_lock();
1846 +
1847 + ret = -ESRCH;
1848 +diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
1849 +index 6db7a5e..cdd5607 100644
1850 +--- a/kernel/hrtimer.c
1851 ++++ b/kernel/hrtimer.c
1852 +@@ -640,21 +640,9 @@ static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base)
1853 + * and expiry check is done in the hrtimer_interrupt or in the softirq.
1854 + */
1855 + static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
1856 +- struct hrtimer_clock_base *base,
1857 +- int wakeup)
1858 ++ struct hrtimer_clock_base *base)
1859 + {
1860 +- if (base->cpu_base->hres_active && hrtimer_reprogram(timer, base)) {
1861 +- if (wakeup) {
1862 +- raw_spin_unlock(&base->cpu_base->lock);
1863 +- raise_softirq_irqoff(HRTIMER_SOFTIRQ);
1864 +- raw_spin_lock(&base->cpu_base->lock);
1865 +- } else
1866 +- __raise_softirq_irqoff(HRTIMER_SOFTIRQ);
1867 +-
1868 +- return 1;
1869 +- }
1870 +-
1871 +- return 0;
1872 ++ return base->cpu_base->hres_active && hrtimer_reprogram(timer, base);
1873 + }
1874 +
1875 + static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
1876 +@@ -735,8 +723,7 @@ static inline int hrtimer_switch_to_hres(void) { return 0; }
1877 + static inline void
1878 + hrtimer_force_reprogram(struct hrtimer_cpu_base *base, int skip_equal) { }
1879 + static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
1880 +- struct hrtimer_clock_base *base,
1881 +- int wakeup)
1882 ++ struct hrtimer_clock_base *base)
1883 + {
1884 + return 0;
1885 + }
1886 +@@ -995,8 +982,21 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
1887 + *
1888 + * XXX send_remote_softirq() ?
1889 + */
1890 +- if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases))
1891 +- hrtimer_enqueue_reprogram(timer, new_base, wakeup);
1892 ++ if (leftmost && new_base->cpu_base == &__get_cpu_var(hrtimer_bases)
1893 ++ && hrtimer_enqueue_reprogram(timer, new_base)) {
1894 ++ if (wakeup) {
1895 ++ /*
1896 ++ * We need to drop cpu_base->lock to avoid a
1897 ++ * lock ordering issue vs. rq->lock.
1898 ++ */
1899 ++ raw_spin_unlock(&new_base->cpu_base->lock);
1900 ++ raise_softirq_irqoff(HRTIMER_SOFTIRQ);
1901 ++ local_irq_restore(flags);
1902 ++ return ret;
1903 ++ } else {
1904 ++ __raise_softirq_irqoff(HRTIMER_SOFTIRQ);
1905 ++ }
1906 ++ }
1907 +
1908 + unlock_hrtimer_base(timer, &flags);
1909 +
1910 +diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
1911 +index 611cd60..7b5f012 100644
1912 +--- a/kernel/irq/spurious.c
1913 ++++ b/kernel/irq/spurious.c
1914 +@@ -80,13 +80,11 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
1915 +
1916 + /*
1917 + * All handlers must agree on IRQF_SHARED, so we test just the
1918 +- * first. Check for action->next as well.
1919 ++ * first.
1920 + */
1921 + action = desc->action;
1922 + if (!action || !(action->flags & IRQF_SHARED) ||
1923 +- (action->flags & __IRQF_TIMER) ||
1924 +- (action->handler(irq, action->dev_id) == IRQ_HANDLED) ||
1925 +- !action->next)
1926 ++ (action->flags & __IRQF_TIMER))
1927 + goto out;
1928 +
1929 + /* Already running on another processor */
1930 +@@ -104,6 +102,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
1931 + do {
1932 + if (handle_irq_event(desc) == IRQ_HANDLED)
1933 + ret = IRQ_HANDLED;
1934 ++ /* Make sure that there is still a valid action */
1935 + action = desc->action;
1936 + } while ((desc->istate & IRQS_PENDING) && action);
1937 + desc->istate &= ~IRQS_POLL_INPROGRESS;
1938 +diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
1939 +index 125cb67..acbb79c 100644
1940 +--- a/kernel/posix-cpu-timers.c
1941 ++++ b/kernel/posix-cpu-timers.c
1942 +@@ -1422,8 +1422,10 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
1943 + while (!signal_pending(current)) {
1944 + if (timer.it.cpu.expires.sched == 0) {
1945 + /*
1946 +- * Our timer fired and was reset.
1947 ++ * Our timer fired and was reset, below
1948 ++ * deletion can not fail.
1949 + */
1950 ++ posix_cpu_timer_del(&timer);
1951 + spin_unlock_irq(&timer.it_lock);
1952 + return 0;
1953 + }
1954 +@@ -1441,9 +1443,26 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
1955 + * We were interrupted by a signal.
1956 + */
1957 + sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp);
1958 +- posix_cpu_timer_set(&timer, 0, &zero_it, it);
1959 ++ error = posix_cpu_timer_set(&timer, 0, &zero_it, it);
1960 ++ if (!error) {
1961 ++ /*
1962 ++ * Timer is now unarmed, deletion can not fail.
1963 ++ */
1964 ++ posix_cpu_timer_del(&timer);
1965 ++ }
1966 + spin_unlock_irq(&timer.it_lock);
1967 +
1968 ++ while (error == TIMER_RETRY) {
1969 ++ /*
1970 ++ * We need to handle case when timer was or is in the
1971 ++ * middle of firing. In other cases we already freed
1972 ++ * resources.
1973 ++ */
1974 ++ spin_lock_irq(&timer.it_lock);
1975 ++ error = posix_cpu_timer_del(&timer);
1976 ++ spin_unlock_irq(&timer.it_lock);
1977 ++ }
1978 ++
1979 + if ((it->it_value.tv_sec | it->it_value.tv_nsec) == 0) {
1980 + /*
1981 + * It actually did fire already.
1982 +diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
1983 +index eb51d76..3f42652 100644
1984 +--- a/kernel/timeconst.pl
1985 ++++ b/kernel/timeconst.pl
1986 +@@ -369,10 +369,8 @@ if ($hz eq '--can') {
1987 + die "Usage: $0 HZ\n";
1988 + }
1989 +
1990 +- @val = @{$canned_values{$hz}};
1991 +- if (!defined(@val)) {
1992 +- @val = compute_values($hz);
1993 +- }
1994 ++ $cv = $canned_values{$hz};
1995 ++ @val = defined($cv) ? @$cv : compute_values($hz);
1996 + output($hz, @val);
1997 + }
1998 + exit 0;
1999 +diff --git a/kernel/workqueue.c b/kernel/workqueue.c
2000 +index 1dae900..bb05784 100644
2001 +--- a/kernel/workqueue.c
2002 ++++ b/kernel/workqueue.c
2003 +@@ -1350,7 +1350,7 @@ void delayed_work_timer_fn(unsigned long __data)
2004 + /* should have been called from irqsafe timer with irq already off */
2005 + __queue_work(dwork->cpu, cwq->wq, &dwork->work);
2006 + }
2007 +-EXPORT_SYMBOL_GPL(delayed_work_timer_fn);
2008 ++EXPORT_SYMBOL(delayed_work_timer_fn);
2009 +
2010 + static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
2011 + struct delayed_work *dwork, unsigned long delay)
2012 +diff --git a/mm/fadvise.c b/mm/fadvise.c
2013 +index a47f0f5..909ec55 100644
2014 +--- a/mm/fadvise.c
2015 ++++ b/mm/fadvise.c
2016 +@@ -17,6 +17,7 @@
2017 + #include <linux/fadvise.h>
2018 + #include <linux/writeback.h>
2019 + #include <linux/syscalls.h>
2020 ++#include <linux/swap.h>
2021 +
2022 + #include <asm/unistd.h>
2023 +
2024 +@@ -120,9 +121,22 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
2025 + start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;
2026 + end_index = (endbyte >> PAGE_CACHE_SHIFT);
2027 +
2028 +- if (end_index >= start_index)
2029 +- invalidate_mapping_pages(mapping, start_index,
2030 ++ if (end_index >= start_index) {
2031 ++ unsigned long count = invalidate_mapping_pages(mapping,
2032 ++ start_index, end_index);
2033 ++
2034 ++ /*
2035 ++ * If fewer pages were invalidated than expected then
2036 ++ * it is possible that some of the pages were on
2037 ++ * a per-cpu pagevec for a remote CPU. Drain all
2038 ++ * pagevecs and try again.
2039 ++ */
2040 ++ if (count < (end_index - start_index + 1)) {
2041 ++ lru_add_drain_all();
2042 ++ invalidate_mapping_pages(mapping, start_index,
2043 + end_index);
2044 ++ }
2045 ++ }
2046 + break;
2047 + default:
2048 + ret = -EINVAL;
2049 +diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
2050 +index 8a5ac8c..f5c3d96 100644
2051 +--- a/mm/mmu_notifier.c
2052 ++++ b/mm/mmu_notifier.c
2053 +@@ -37,49 +37,51 @@ static struct srcu_struct srcu;
2054 + void __mmu_notifier_release(struct mm_struct *mm)
2055 + {
2056 + struct mmu_notifier *mn;
2057 +- struct hlist_node *n;
2058 + int id;
2059 +
2060 + /*
2061 +- * SRCU here will block mmu_notifier_unregister until
2062 +- * ->release returns.
2063 ++ * srcu_read_lock() here will block synchronize_srcu() in
2064 ++ * mmu_notifier_unregister() until all registered
2065 ++ * ->release() callouts this function makes have
2066 ++ * returned.
2067 + */
2068 + id = srcu_read_lock(&srcu);
2069 +- hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist)
2070 +- /*
2071 +- * if ->release runs before mmu_notifier_unregister it
2072 +- * must be handled as it's the only way for the driver
2073 +- * to flush all existing sptes and stop the driver
2074 +- * from establishing any more sptes before all the
2075 +- * pages in the mm are freed.
2076 +- */
2077 +- if (mn->ops->release)
2078 +- mn->ops->release(mn, mm);
2079 +- srcu_read_unlock(&srcu, id);
2080 +-
2081 + spin_lock(&mm->mmu_notifier_mm->lock);
2082 + while (unlikely(!hlist_empty(&mm->mmu_notifier_mm->list))) {
2083 + mn = hlist_entry(mm->mmu_notifier_mm->list.first,
2084 + struct mmu_notifier,
2085 + hlist);
2086 ++
2087 + /*
2088 +- * We arrived before mmu_notifier_unregister so
2089 +- * mmu_notifier_unregister will do nothing other than
2090 +- * to wait ->release to finish and
2091 +- * mmu_notifier_unregister to return.
2092 ++ * Unlink. This will prevent mmu_notifier_unregister()
2093 ++ * from also making the ->release() callout.
2094 + */
2095 + hlist_del_init_rcu(&mn->hlist);
2096 ++ spin_unlock(&mm->mmu_notifier_mm->lock);
2097 ++
2098 ++ /*
2099 ++ * Clear sptes. (see 'release' description in mmu_notifier.h)
2100 ++ */
2101 ++ if (mn->ops->release)
2102 ++ mn->ops->release(mn, mm);
2103 ++
2104 ++ spin_lock(&mm->mmu_notifier_mm->lock);
2105 + }
2106 + spin_unlock(&mm->mmu_notifier_mm->lock);
2107 +
2108 + /*
2109 +- * synchronize_srcu here prevents mmu_notifier_release to
2110 +- * return to exit_mmap (which would proceed freeing all pages
2111 +- * in the mm) until the ->release method returns, if it was
2112 +- * invoked by mmu_notifier_unregister.
2113 +- *
2114 +- * The mmu_notifier_mm can't go away from under us because one
2115 +- * mm_count is hold by exit_mmap.
2116 ++ * All callouts to ->release() which we have done are complete.
2117 ++ * Allow synchronize_srcu() in mmu_notifier_unregister() to complete
2118 ++ */
2119 ++ srcu_read_unlock(&srcu, id);
2120 ++
2121 ++ /*
2122 ++ * mmu_notifier_unregister() may have unlinked a notifier and may
2123 ++ * still be calling out to it. Additionally, other notifiers
2124 ++ * may have been active via vmtruncate() et. al. Block here
2125 ++ * to ensure that all notifier callouts for this mm have been
2126 ++ * completed and the sptes are really cleaned up before returning
2127 ++ * to exit_mmap().
2128 + */
2129 + synchronize_srcu(&srcu);
2130 + }
2131 +@@ -294,31 +296,31 @@ void mmu_notifier_unregister(struct mmu_notifier *mn, struct mm_struct *mm)
2132 + {
2133 + BUG_ON(atomic_read(&mm->mm_count) <= 0);
2134 +
2135 ++ spin_lock(&mm->mmu_notifier_mm->lock);
2136 + if (!hlist_unhashed(&mn->hlist)) {
2137 +- /*
2138 +- * SRCU here will force exit_mmap to wait ->release to finish
2139 +- * before freeing the pages.
2140 +- */
2141 + int id;
2142 +
2143 +- id = srcu_read_lock(&srcu);
2144 + /*
2145 +- * exit_mmap will block in mmu_notifier_release to
2146 +- * guarantee ->release is called before freeing the
2147 +- * pages.
2148 ++ * Ensure we synchronize up with __mmu_notifier_release().
2149 + */
2150 ++ id = srcu_read_lock(&srcu);
2151 ++
2152 ++ hlist_del_rcu(&mn->hlist);
2153 ++ spin_unlock(&mm->mmu_notifier_mm->lock);
2154 ++
2155 + if (mn->ops->release)
2156 + mn->ops->release(mn, mm);
2157 +- srcu_read_unlock(&srcu, id);
2158 +
2159 +- spin_lock(&mm->mmu_notifier_mm->lock);
2160 +- hlist_del_rcu(&mn->hlist);
2161 ++ /*
2162 ++ * Allow __mmu_notifier_release() to complete.
2163 ++ */
2164 ++ srcu_read_unlock(&srcu, id);
2165 ++ } else
2166 + spin_unlock(&mm->mmu_notifier_mm->lock);
2167 +- }
2168 +
2169 + /*
2170 +- * Wait any running method to finish, of course including
2171 +- * ->release if it was run by mmu_notifier_relase instead of us.
2172 ++ * Wait for any running method to finish, including ->release() if it
2173 ++ * was run by __mmu_notifier_release() instead of us.
2174 + */
2175 + synchronize_srcu(&srcu);
2176 +
2177 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
2178 +index ceb4168..2238a14 100644
2179 +--- a/mm/page_alloc.c
2180 ++++ b/mm/page_alloc.c
2181 +@@ -4351,10 +4351,11 @@ static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
2182 + * round what is now in bits to nearest long in bits, then return it in
2183 + * bytes.
2184 + */
2185 +-static unsigned long __init usemap_size(unsigned long zonesize)
2186 ++static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned long zonesize)
2187 + {
2188 + unsigned long usemapsize;
2189 +
2190 ++ zonesize += zone_start_pfn & (pageblock_nr_pages-1);
2191 + usemapsize = roundup(zonesize, pageblock_nr_pages);
2192 + usemapsize = usemapsize >> pageblock_order;
2193 + usemapsize *= NR_PAGEBLOCK_BITS;
2194 +@@ -4364,17 +4365,19 @@ static unsigned long __init usemap_size(unsigned long zonesize)
2195 + }
2196 +
2197 + static void __init setup_usemap(struct pglist_data *pgdat,
2198 +- struct zone *zone, unsigned long zonesize)
2199 ++ struct zone *zone,
2200 ++ unsigned long zone_start_pfn,
2201 ++ unsigned long zonesize)
2202 + {
2203 +- unsigned long usemapsize = usemap_size(zonesize);
2204 ++ unsigned long usemapsize = usemap_size(zone_start_pfn, zonesize);
2205 + zone->pageblock_flags = NULL;
2206 + if (usemapsize)
2207 + zone->pageblock_flags = alloc_bootmem_node_nopanic(pgdat,
2208 + usemapsize);
2209 + }
2210 + #else
2211 +-static inline void setup_usemap(struct pglist_data *pgdat,
2212 +- struct zone *zone, unsigned long zonesize) {}
2213 ++static inline void setup_usemap(struct pglist_data *pgdat, struct zone *zone,
2214 ++ unsigned long zone_start_pfn, unsigned long zonesize) {}
2215 + #endif /* CONFIG_SPARSEMEM */
2216 +
2217 + #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
2218 +@@ -4492,7 +4495,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
2219 + continue;
2220 +
2221 + set_pageblock_order();
2222 +- setup_usemap(pgdat, zone, size);
2223 ++ setup_usemap(pgdat, zone, zone_start_pfn, size);
2224 + ret = init_currently_empty_zone(zone, zone_start_pfn,
2225 + size, MEMMAP_EARLY);
2226 + BUG_ON(ret);
2227 +diff --git a/mm/shmem.c b/mm/shmem.c
2228 +index 50c5b8f..74d8fb7 100644
2229 +--- a/mm/shmem.c
2230 ++++ b/mm/shmem.c
2231 +@@ -2397,6 +2397,7 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
2232 + unsigned long inodes;
2233 + int error = -EINVAL;
2234 +
2235 ++ config.mpol = NULL;
2236 + if (shmem_parse_options(data, &config, true))
2237 + return error;
2238 +
2239 +@@ -2421,8 +2422,13 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
2240 + sbinfo->max_inodes = config.max_inodes;
2241 + sbinfo->free_inodes = config.max_inodes - inodes;
2242 +
2243 +- mpol_put(sbinfo->mpol);
2244 +- sbinfo->mpol = config.mpol; /* transfers initial ref */
2245 ++ /*
2246 ++ * Preserve previous mempolicy unless mpol remount option was specified.
2247 ++ */
2248 ++ if (config.mpol) {
2249 ++ mpol_put(sbinfo->mpol);
2250 ++ sbinfo->mpol = config.mpol; /* transfers initial ref */
2251 ++ }
2252 + out:
2253 + spin_unlock(&sbinfo->stat_lock);
2254 + return error;
2255 +diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
2256 +index 602cd63..750f44f 100644
2257 +--- a/net/core/sock_diag.c
2258 ++++ b/net/core/sock_diag.c
2259 +@@ -121,6 +121,9 @@ static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
2260 + if (nlmsg_len(nlh) < sizeof(*req))
2261 + return -EINVAL;
2262 +
2263 ++ if (req->sdiag_family >= AF_MAX)
2264 ++ return -EINVAL;
2265 ++
2266 + hndl = sock_diag_lock_handler(req->sdiag_family);
2267 + if (hndl == NULL)
2268 + err = -ENOENT;
2269 +diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
2270 +index c7e3c53..57d0187 100644
2271 +--- a/sound/pci/ali5451/ali5451.c
2272 ++++ b/sound/pci/ali5451/ali5451.c
2273 +@@ -1435,7 +1435,7 @@ static snd_pcm_uframes_t snd_ali_pointer(struct snd_pcm_substream *substream)
2274 +
2275 + spin_lock(&codec->reg_lock);
2276 + if (!pvoice->running) {
2277 +- spin_unlock_irq(&codec->reg_lock);
2278 ++ spin_unlock(&codec->reg_lock);
2279 + return 0;
2280 + }
2281 + outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
2282 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
2283 +index a95e198..206626d 100644
2284 +--- a/sound/pci/hda/patch_hdmi.c
2285 ++++ b/sound/pci/hda/patch_hdmi.c
2286 +@@ -714,9 +714,10 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca)
2287 +
2288 + static void hdmi_setup_channel_mapping(struct hda_codec *codec,
2289 + hda_nid_t pin_nid, bool non_pcm, int ca,
2290 +- int channels, unsigned char *map)
2291 ++ int channels, unsigned char *map,
2292 ++ bool chmap_set)
2293 + {
2294 +- if (!non_pcm && map) {
2295 ++ if (!non_pcm && chmap_set) {
2296 + hdmi_manual_setup_channel_mapping(codec, pin_nid,
2297 + channels, map);
2298 + } else {
2299 +@@ -905,7 +906,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
2300 + pin_nid,
2301 + channels);
2302 + hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
2303 +- channels, per_pin->chmap);
2304 ++ channels, per_pin->chmap,
2305 ++ per_pin->chmap_set);
2306 + hdmi_stop_infoframe_trans(codec, pin_nid);
2307 + hdmi_fill_audio_infoframe(codec, pin_nid,
2308 + ai.bytes, sizeof(ai));
2309 +@@ -915,7 +917,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
2310 + * accordingly */
2311 + if (per_pin->non_pcm != non_pcm)
2312 + hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
2313 +- channels, per_pin->chmap);
2314 ++ channels, per_pin->chmap,
2315 ++ per_pin->chmap_set);
2316 + }
2317 +
2318 + per_pin->non_pcm = non_pcm;
2319 +@@ -1100,8 +1103,12 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
2320 + if (!static_hdmi_pcm && eld->eld_valid) {
2321 + snd_hdmi_eld_update_pcm_info(eld, hinfo);
2322 + if (hinfo->channels_min > hinfo->channels_max ||
2323 +- !hinfo->rates || !hinfo->formats)
2324 ++ !hinfo->rates || !hinfo->formats) {
2325 ++ per_cvt->assigned = 0;
2326 ++ hinfo->nid = 0;
2327 ++ snd_hda_spdif_ctls_unassign(codec, pin_idx);
2328 + return -ENODEV;
2329 ++ }
2330 + }
2331 +
2332 + /* Store the updated parameters */
2333 +@@ -1165,6 +1172,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
2334 + "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
2335 + codec->addr, pin_nid, eld->monitor_present, eld_valid);
2336 +
2337 ++ eld->eld_valid = false;
2338 + if (eld_valid) {
2339 + if (!snd_hdmi_get_eld(eld, codec, pin_nid))
2340 + snd_hdmi_show_eld(eld);
2341 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2342 +index c98cb89..38a893f 100644
2343 +--- a/sound/pci/hda/patch_realtek.c
2344 ++++ b/sound/pci/hda/patch_realtek.c
2345 +@@ -5388,6 +5388,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2346 + SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2347 + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2348 + SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2349 ++ SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2350 +
2351 + /* All Apple entries are in codec SSIDs */
2352 + SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2353 +diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
2354 +index 46b3629..f1dec07 100644
2355 +--- a/sound/pci/rme32.c
2356 ++++ b/sound/pci/rme32.c
2357 +@@ -1017,7 +1017,7 @@ static int snd_rme32_capture_close(struct snd_pcm_substream *substream)
2358 + spin_lock_irq(&rme32->lock);
2359 + rme32->capture_substream = NULL;
2360 + rme32->capture_periodsize = 0;
2361 +- spin_unlock(&rme32->lock);
2362 ++ spin_unlock_irq(&rme32->lock);
2363 + return 0;
2364 + }
2365 +
2366 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
2367 +index 88d8ceb..b666c6b 100644
2368 +--- a/sound/usb/quirks-table.h
2369 ++++ b/sound/usb/quirks-table.h
2370 +@@ -1658,7 +1658,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2371 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2372 + /* .vendor_name = "Roland", */
2373 + /* .product_name = "A-PRO", */
2374 +- .ifnum = 1,
2375 ++ .ifnum = 0,
2376 + .type = QUIRK_MIDI_FIXED_ENDPOINT,
2377 + .data = & (const struct snd_usb_midi_endpoint_info) {
2378 + .out_cables = 0x0003,
2379 +diff --git a/tools/perf/Makefile b/tools/perf/Makefile
2380 +index 627849f..c3e02b3 100644
2381 +--- a/tools/perf/Makefile
2382 ++++ b/tools/perf/Makefile
2383 +@@ -268,13 +268,13 @@ $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-event
2384 + $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
2385 +
2386 + $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
2387 +- $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c
2388 ++ $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
2389 +
2390 + $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
2391 + $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
2392 +
2393 + $(OUTPUT)util/pmu-bison.c: util/pmu.y
2394 +- $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
2395 ++ $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
2396 +
2397 + $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
2398 + $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
2399 +diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
2400 +index f5a1e4f..947e20a 100644
2401 +--- a/tools/perf/ui/hist.c
2402 ++++ b/tools/perf/ui/hist.c
2403 +@@ -363,11 +363,15 @@ int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
2404 + if (!perf_hpp__format[i].cond)
2405 + continue;
2406 +
2407 ++ /*
2408 ++ * If there's no field_sep, we still need
2409 ++ * to display initial ' '.
2410 ++ */
2411 + if (!sep || !first) {
2412 + ret = scnprintf(hpp->buf, hpp->size, "%s", sep ?: " ");
2413 + advance_hpp(hpp, ret);
2414 ++ } else
2415 + first = false;
2416 +- }
2417 +
2418 + if (color && perf_hpp__format[i].color)
2419 + ret = perf_hpp__format[i].color(hpp, he);
2420 +diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
2421 +index cd88209..85cdaed 100644
2422 +--- a/tools/perf/util/parse-events.y
2423 ++++ b/tools/perf/util/parse-events.y
2424 +@@ -1,5 +1,4 @@
2425 + %pure-parser
2426 +-%name-prefix "parse_events_"
2427 + %parse-param {void *_data}
2428 + %parse-param {void *scanner}
2429 + %lex-param {void* scanner}
2430 +diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
2431 +index ec89804..bfd7e85 100644
2432 +--- a/tools/perf/util/pmu.y
2433 ++++ b/tools/perf/util/pmu.y
2434 +@@ -1,5 +1,4 @@
2435 +
2436 +-%name-prefix "perf_pmu_"
2437 + %parse-param {struct list_head *format}
2438 + %parse-param {char *name}
2439 +