Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'core/urgent' into sched/core

Merge in asm goto fix, to be able to apply the asm/rmwcc.h fix.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+457 -203
+7 -2
arch/arm/Makefile
··· 296 296 # Convert bzImage to zImage 297 297 bzImage: zImage 298 298 299 - zImage Image xipImage bootpImage uImage: vmlinux 299 + BOOT_TARGETS = zImage Image xipImage bootpImage uImage 300 + INSTALL_TARGETS = zinstall uinstall install 301 + 302 + PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) 303 + 304 + $(BOOT_TARGETS): vmlinux 300 305 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 301 306 302 - zinstall uinstall install: vmlinux 307 + $(INSTALL_TARGETS): 303 308 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 304 309 305 310 %.dtb: | scripts
+8 -8
arch/arm/boot/Makefile
··· 95 95 @test "$(INITRD)" != "" || \ 96 96 (echo You must specify INITRD; exit -1) 97 97 98 - install: $(obj)/Image 99 - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 98 + install: 99 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ 100 100 $(obj)/Image System.map "$(INSTALL_PATH)" 101 101 102 - zinstall: $(obj)/zImage 103 - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 102 + zinstall: 103 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ 104 104 $(obj)/zImage System.map "$(INSTALL_PATH)" 105 105 106 - uinstall: $(obj)/uImage 107 - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 106 + uinstall: 107 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ 108 108 $(obj)/uImage System.map "$(INSTALL_PATH)" 109 109 110 110 zi: 111 - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 111 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ 112 112 $(obj)/zImage System.map "$(INSTALL_PATH)" 113 113 114 114 i: 115 - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 115 + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ 116 116 $(obj)/Image System.map "$(INSTALL_PATH)" 117 117 118 118 subdir- := bootp compressed dts
+14
arch/arm/boot/install.sh
··· 20 20 # $4 - default install path (blank if root directory) 21 21 # 22 22 23 + verify () { 24 + if [ ! -f "$1" ]; then 25 + echo "" 1>&2 26 + echo " *** Missing file: $1" 1>&2 27 + echo ' *** You need to run "make" before "make install".' 1>&2 28 + echo "" 1>&2 29 + exit 1 30 + fi 31 + } 32 + 33 + # Make sure the files actually exist 34 + verify "$2" 35 + verify "$3" 36 + 23 37 # User may have a custom install script 24 38 if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 25 39 if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+1 -1
arch/arm/include/asm/jump_label.h
··· 16 16 17 17 static __always_inline bool arch_static_branch(struct static_key *key) 18 18 { 19 - asm goto("1:\n\t" 19 + asm_volatile_goto("1:\n\t" 20 20 JUMP_LABEL_NOP "\n\t" 21 21 ".pushsection __jump_table, \"aw\"\n\t" 22 22 ".word 1b, %l[l_yes], %c0\n\t"
+1 -1
arch/mips/include/asm/jump_label.h
··· 22 22 23 23 static __always_inline bool arch_static_branch(struct static_key *key) 24 24 { 25 - asm goto("1:\tnop\n\t" 25 + asm_volatile_goto("1:\tnop\n\t" 26 26 "nop\n\t" 27 27 ".pushsection __jump_table, \"aw\"\n\t" 28 28 WORD_INSN " 1b, %l[l_yes], %0\n\t"
+1 -1
arch/powerpc/include/asm/jump_label.h
··· 19 19 20 20 static __always_inline bool arch_static_branch(struct static_key *key) 21 21 { 22 - asm goto("1:\n\t" 22 + asm_volatile_goto("1:\n\t" 23 23 "nop\n\t" 24 24 ".pushsection __jump_table, \"aw\"\n\t" 25 25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
+3 -2
arch/powerpc/kernel/irq.c
··· 495 495 void do_IRQ(struct pt_regs *regs) 496 496 { 497 497 struct pt_regs *old_regs = set_irq_regs(regs); 498 - struct thread_info *curtp, *irqtp; 498 + struct thread_info *curtp, *irqtp, *sirqtp; 499 499 500 500 /* Switch to the irq stack to handle this */ 501 501 curtp = current_thread_info(); 502 502 irqtp = hardirq_ctx[raw_smp_processor_id()]; 503 + sirqtp = softirq_ctx[raw_smp_processor_id()]; 503 504 504 505 /* Already there ? */ 505 - if (unlikely(curtp == irqtp)) { 506 + if (unlikely(curtp == irqtp || curtp == sirqtp)) { 506 507 __do_irq(regs); 507 508 set_irq_regs(old_regs); 508 509 return;
+1 -1
arch/powerpc/kvm/book3s_hv_rmhandlers.S
··· 1066 1066 BEGIN_FTR_SECTION 1067 1067 mfspr r8, SPRN_DSCR 1068 1068 ld r7, HSTATE_DSCR(r13) 1069 - std r8, VCPU_DSCR(r7) 1069 + std r8, VCPU_DSCR(r9) 1070 1070 mtspr SPRN_DSCR, r7 1071 1071 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 1072 1072
+17 -1
arch/powerpc/kvm/e500_mmu_host.c
··· 332 332 unsigned long hva; 333 333 int pfnmap = 0; 334 334 int tsize = BOOK3E_PAGESZ_4K; 335 + int ret = 0; 336 + unsigned long mmu_seq; 337 + struct kvm *kvm = vcpu_e500->vcpu.kvm; 338 + 339 + /* used to check for invalidations in progress */ 340 + mmu_seq = kvm->mmu_notifier_seq; 341 + smp_rmb(); 335 342 336 343 /* 337 344 * Translate guest physical to true physical, acquiring ··· 456 449 gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1); 457 450 } 458 451 452 + spin_lock(&kvm->mmu_lock); 453 + if (mmu_notifier_retry(kvm, mmu_seq)) { 454 + ret = -EAGAIN; 455 + goto out; 456 + } 457 + 459 458 kvmppc_e500_ref_setup(ref, gtlbe, pfn); 460 459 461 460 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize, ··· 470 457 /* Clear i-cache for new pages */ 471 458 kvmppc_mmu_flush_icache(pfn); 472 459 460 + out: 461 + spin_unlock(&kvm->mmu_lock); 462 + 473 463 /* Drop refcount on page, so that mmu notifiers can clear it */ 474 464 kvm_release_pfn_clean(pfn); 475 465 476 - return 0; 466 + return ret; 477 467 } 478 468 479 469 /* XXX only map the one-one case, for now use TLB0 */
+1 -1
arch/s390/include/asm/jump_label.h
··· 15 15 16 16 static __always_inline bool arch_static_branch(struct static_key *key) 17 17 { 18 - asm goto("0: brcl 0,0\n" 18 + asm_volatile_goto("0: brcl 0,0\n" 19 19 ".pushsection __jump_table, \"aw\"\n" 20 20 ASM_ALIGN "\n" 21 21 ASM_PTR " 0b, %l[label], %0\n"
+20 -22
arch/s390/kernel/crash_dump.c
··· 40 40 } 41 41 42 42 /* 43 - * Copy up to one page to vmalloc or real memory 43 + * Copy real to virtual or real memory 44 44 */ 45 - static ssize_t copy_page_real(void *buf, void *src, size_t csize) 45 + static int copy_from_realmem(void *dest, void *src, size_t count) 46 46 { 47 - size_t size; 47 + unsigned long size; 48 + int rc; 48 49 49 - if (is_vmalloc_addr(buf)) { 50 - BUG_ON(csize >= PAGE_SIZE); 51 - /* If buf is not page aligned, copy first part */ 52 - size = min(roundup(__pa(buf), PAGE_SIZE) - __pa(buf), csize); 53 - if (size) { 54 - if (memcpy_real(load_real_addr(buf), src, size)) 55 - return -EFAULT; 56 - buf += size; 57 - src += size; 58 - } 59 - /* Copy second part */ 60 - size = csize - size; 61 - return (size) ? memcpy_real(load_real_addr(buf), src, size) : 0; 62 - } else { 63 - return memcpy_real(buf, src, csize); 64 - } 50 + if (!count) 51 + return 0; 52 + if (!is_vmalloc_or_module_addr(dest)) 53 + return memcpy_real(dest, src, count); 54 + do { 55 + size = min(count, PAGE_SIZE - (__pa(dest) & ~PAGE_MASK)); 56 + if (memcpy_real(load_real_addr(dest), src, size)) 57 + return -EFAULT; 58 + count -= size; 59 + dest += size; 60 + src += size; 61 + } while (count); 62 + return 0; 65 63 } 66 64 67 65 /* ··· 112 114 rc = copy_to_user_real((void __force __user *) buf, 113 115 (void *) src, csize); 114 116 else 115 - rc = copy_page_real(buf, (void *) src, csize); 117 + rc = copy_from_realmem(buf, (void *) src, csize); 116 118 return (rc == 0) ? rc : csize; 117 119 } 118 120 ··· 208 210 if (OLDMEM_BASE) { 209 211 if ((unsigned long) src < OLDMEM_SIZE) { 210 212 copied = min(count, OLDMEM_SIZE - (unsigned long) src); 211 - rc = memcpy_real(dest, src + OLDMEM_BASE, copied); 213 + rc = copy_from_realmem(dest, src + OLDMEM_BASE, copied); 212 214 if (rc) 213 215 return rc; 214 216 } ··· 221 223 return rc; 222 224 } 223 225 } 224 - return memcpy_real(dest + copied, src + copied, count - copied); 226 + return copy_from_realmem(dest + copied, src + copied, count - copied); 225 227 } 226 228 227 229 /*
+1
arch/s390/kernel/entry.S
··· 266 266 tm __TI_flags+3(%r12),_TIF_SYSCALL 267 267 jno sysc_return 268 268 lm %r2,%r7,__PT_R2(%r11) # load svc arguments 269 + l %r10,__TI_sysc_table(%r12) # 31 bit system call table 269 270 xr %r8,%r8 # svc 0 returns -ENOSYS 270 271 clc __PT_INT_CODE+2(2,%r11),BASED(.Lnr_syscalls+2) 271 272 jnl sysc_nr_ok # invalid svc number -> do svc 0
+1
arch/s390/kernel/entry64.S
··· 297 297 tm __TI_flags+7(%r12),_TIF_SYSCALL 298 298 jno sysc_return 299 299 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments 300 + lg %r10,__TI_sysc_table(%r12) # address of system call table 300 301 lghi %r8,0 # svc 0 returns -ENOSYS 301 302 llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number 302 303 cghi %r1,NR_syscalls
+5 -1
arch/s390/kernel/kprobes.c
··· 67 67 case 0xac: /* stnsm */ 68 68 case 0xad: /* stosm */ 69 69 return -EINVAL; 70 + case 0xc6: 71 + switch (insn[0] & 0x0f) { 72 + case 0x00: /* exrl */ 73 + return -EINVAL; 74 + } 70 75 } 71 76 switch (insn[0]) { 72 77 case 0x0101: /* pr */ ··· 185 180 break; 186 181 case 0xc6: 187 182 switch (insn[0] & 0x0f) { 188 - case 0x00: /* exrl */ 189 183 case 0x02: /* pfdrl */ 190 184 case 0x04: /* cghrl */ 191 185 case 0x05: /* chrl */
+1 -1
arch/sparc/include/asm/jump_label.h
··· 9 9 10 10 static __always_inline bool arch_static_branch(struct static_key *key) 11 11 { 12 - asm goto("1:\n\t" 12 + asm_volatile_goto("1:\n\t" 13 13 "nop\n\t" 14 14 "nop\n\t" 15 15 ".pushsection __jump_table, \"aw\"\n\t"
+3 -2
arch/tile/include/asm/atomic.h
··· 166 166 * 167 167 * Atomically sets @v to @i and returns old @v 168 168 */ 169 - static inline u64 atomic64_xchg(atomic64_t *v, u64 n) 169 + static inline long long atomic64_xchg(atomic64_t *v, long long n) 170 170 { 171 171 return xchg64(&v->counter, n); 172 172 } ··· 180 180 * Atomically checks if @v holds @o and replaces it with @n if so. 181 181 * Returns the old value at @v. 182 182 */ 183 - static inline u64 atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n) 183 + static inline long long atomic64_cmpxchg(atomic64_t *v, long long o, 184 + long long n) 184 185 { 185 186 return cmpxchg64(&v->counter, o, n); 186 187 }
+15 -12
arch/tile/include/asm/atomic_32.h
··· 80 80 /* A 64bit atomic type */ 81 81 82 82 typedef struct { 83 - u64 __aligned(8) counter; 83 + long long counter; 84 84 } atomic64_t; 85 85 86 86 #define ATOMIC64_INIT(val) { (val) } ··· 91 91 * 92 92 * Atomically reads the value of @v. 93 93 */ 94 - static inline u64 atomic64_read(const atomic64_t *v) 94 + static inline long long atomic64_read(const atomic64_t *v) 95 95 { 96 96 /* 97 97 * Requires an atomic op to read both 32-bit parts consistently. 98 98 * Casting away const is safe since the atomic support routines 99 99 * do not write to memory if the value has not been modified. 100 100 */ 101 - return _atomic64_xchg_add((u64 *)&v->counter, 0); 101 + return _atomic64_xchg_add((long long *)&v->counter, 0); 102 102 } 103 103 104 104 /** ··· 108 108 * 109 109 * Atomically adds @i to @v. 110 110 */ 111 - static inline void atomic64_add(u64 i, atomic64_t *v) 111 + static inline void atomic64_add(long long i, atomic64_t *v) 112 112 { 113 113 _atomic64_xchg_add(&v->counter, i); 114 114 } ··· 120 120 * 121 121 * Atomically adds @i to @v and returns @i + @v 122 122 */ 123 - static inline u64 atomic64_add_return(u64 i, atomic64_t *v) 123 + static inline long long atomic64_add_return(long long i, atomic64_t *v) 124 124 { 125 125 smp_mb(); /* barrier for proper semantics */ 126 126 return _atomic64_xchg_add(&v->counter, i) + i; ··· 135 135 * Atomically adds @a to @v, so long as @v was not already @u. 136 136 * Returns non-zero if @v was not @u, and zero otherwise. 137 137 */ 138 - static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u) 138 + static inline long long atomic64_add_unless(atomic64_t *v, long long a, 139 + long long u) 139 140 { 140 141 smp_mb(); /* barrier for proper semantics */ 141 142 return _atomic64_xchg_add_unless(&v->counter, a, u) != u; ··· 152 151 * atomic64_set() can't be just a raw store, since it would be lost if it 153 152 * fell between the load and store of one of the other atomic ops. 154 153 */ 155 - static inline void atomic64_set(atomic64_t *v, u64 n) 154 + static inline void atomic64_set(atomic64_t *v, long long n) 156 155 { 157 156 _atomic64_xchg(&v->counter, n); 158 157 } ··· 237 236 extern struct __get_user __atomic_or(volatile int *p, int *lock, int n); 238 237 extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n); 239 238 extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n); 240 - extern u64 __atomic64_cmpxchg(volatile u64 *p, int *lock, u64 o, u64 n); 241 - extern u64 __atomic64_xchg(volatile u64 *p, int *lock, u64 n); 242 - extern u64 __atomic64_xchg_add(volatile u64 *p, int *lock, u64 n); 243 - extern u64 __atomic64_xchg_add_unless(volatile u64 *p, 244 - int *lock, u64 o, u64 n); 239 + extern long long __atomic64_cmpxchg(volatile long long *p, int *lock, 240 + long long o, long long n); 241 + extern long long __atomic64_xchg(volatile long long *p, int *lock, long long n); 242 + extern long long __atomic64_xchg_add(volatile long long *p, int *lock, 243 + long long n); 244 + extern long long __atomic64_xchg_add_unless(volatile long long *p, 245 + int *lock, long long o, long long n); 245 246 246 247 /* Return failure from the atomic wrappers. */ 247 248 struct __get_user __atomic_bad_address(int __user *addr);
+17 -11
arch/tile/include/asm/cmpxchg.h
··· 35 35 int _atomic_xchg_add(int *v, int i); 36 36 int _atomic_xchg_add_unless(int *v, int a, int u); 37 37 int _atomic_cmpxchg(int *ptr, int o, int n); 38 - u64 _atomic64_xchg(u64 *v, u64 n); 39 - u64 _atomic64_xchg_add(u64 *v, u64 i); 40 - u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u); 41 - u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n); 38 + long long _atomic64_xchg(long long *v, long long n); 39 + long long _atomic64_xchg_add(long long *v, long long i); 40 + long long _atomic64_xchg_add_unless(long long *v, long long a, long long u); 41 + long long _atomic64_cmpxchg(long long *v, long long o, long long n); 42 42 43 43 #define xchg(ptr, n) \ 44 44 ({ \ ··· 53 53 if (sizeof(*(ptr)) != 4) \ 54 54 __cmpxchg_called_with_bad_pointer(); \ 55 55 smp_mb(); \ 56 - (typeof(*(ptr)))_atomic_cmpxchg((int *)ptr, (int)o, (int)n); \ 56 + (typeof(*(ptr)))_atomic_cmpxchg((int *)ptr, (int)o, \ 57 + (int)n); \ 57 58 }) 58 59 59 60 #define xchg64(ptr, n) \ ··· 62 61 if (sizeof(*(ptr)) != 8) \ 63 62 __xchg_called_with_bad_pointer(); \ 64 63 smp_mb(); \ 65 - (typeof(*(ptr)))_atomic64_xchg((u64 *)(ptr), (u64)(n)); \ 64 + (typeof(*(ptr)))_atomic64_xchg((long long *)(ptr), \ 65 + (long long)(n)); \ 66 66 }) 67 67 68 68 #define cmpxchg64(ptr, o, n) \ ··· 71 69 if (sizeof(*(ptr)) != 8) \ 72 70 __cmpxchg_called_with_bad_pointer(); \ 73 71 smp_mb(); \ 74 - (typeof(*(ptr)))_atomic64_cmpxchg((u64 *)ptr, (u64)o, (u64)n); \ 72 + (typeof(*(ptr)))_atomic64_cmpxchg((long long *)ptr, \ 73 + (long long)o, (long long)n); \ 75 74 }) 76 75 77 76 #else ··· 84 81 switch (sizeof(*(ptr))) { \ 85 82 case 4: \ 86 83 __x = (typeof(__x))(unsigned long) \ 87 - __insn_exch4((ptr), (u32)(unsigned long)(n)); \ 84 + __insn_exch4((ptr), \ 85 + (u32)(unsigned long)(n)); \ 88 86 break; \ 89 87 case 8: \ 90 - __x = (typeof(__x)) \ 88 + __x = (typeof(__x)) \ 91 89 __insn_exch((ptr), (unsigned long)(n)); \ 92 90 break; \ 93 91 default: \ ··· 107 103 switch (sizeof(*(ptr))) { \ 108 104 case 4: \ 109 105 __x = (typeof(__x))(unsigned long) \ 110 - __insn_cmpexch4((ptr), (u32)(unsigned long)(n)); \ 106 + __insn_cmpexch4((ptr), \ 107 + (u32)(unsigned long)(n)); \ 111 108 break; \ 112 109 case 8: \ 113 - __x = (typeof(__x))__insn_cmpexch((ptr), (u64)(n)); \ 110 + __x = (typeof(__x))__insn_cmpexch((ptr), \ 111 + (long long)(n)); \ 114 112 break; \ 115 113 default: \ 116 114 __cmpxchg_called_with_bad_pointer(); \
+31 -3
arch/tile/include/asm/percpu.h
··· 15 15 #ifndef _ASM_TILE_PERCPU_H 16 16 #define _ASM_TILE_PERCPU_H 17 17 18 - register unsigned long __my_cpu_offset __asm__("tp"); 19 - #define __my_cpu_offset __my_cpu_offset 20 - #define set_my_cpu_offset(tp) (__my_cpu_offset = (tp)) 18 + register unsigned long my_cpu_offset_reg asm("tp"); 19 + 20 + #ifdef CONFIG_PREEMPT 21 + /* 22 + * For full preemption, we can't just use the register variable 23 + * directly, since we need barrier() to hazard against it, causing the 24 + * compiler to reload anything computed from a previous "tp" value. 25 + * But we also don't want to use volatile asm, since we'd like the 26 + * compiler to be able to cache the value across multiple percpu reads. 27 + * So we use a fake stack read as a hazard against barrier(). 28 + * The 'U' constraint is like 'm' but disallows postincrement. 29 + */ 30 + static inline unsigned long __my_cpu_offset(void) 31 + { 32 + unsigned long tp; 33 + register unsigned long *sp asm("sp"); 34 + asm("move %0, tp" : "=r" (tp) : "U" (*sp)); 35 + return tp; 36 + } 37 + #define __my_cpu_offset __my_cpu_offset() 38 + #else 39 + /* 40 + * We don't need to hazard against barrier() since "tp" doesn't ever 41 + * change with PREEMPT_NONE, and with PREEMPT_VOLUNTARY it only 42 + * changes at function call points, at which we are already re-reading 43 + * the value of "tp" due to "my_cpu_offset_reg" being a global variable. 44 + */ 45 + #define __my_cpu_offset my_cpu_offset_reg 46 + #endif 47 + 48 + #define set_my_cpu_offset(tp) (my_cpu_offset_reg = (tp)) 21 49 22 50 #include <asm-generic/percpu.h> 23 51
+3 -3
arch/tile/kernel/hardwall.c
··· 66 66 0, 67 67 "udn", 68 68 LIST_HEAD_INIT(hardwall_types[HARDWALL_UDN].list), 69 - __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_UDN].lock), 69 + __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_UDN].lock), 70 70 NULL 71 71 }, 72 72 #ifndef __tilepro__ ··· 77 77 1, /* disabled pending hypervisor support */ 78 78 "idn", 79 79 LIST_HEAD_INIT(hardwall_types[HARDWALL_IDN].list), 80 - __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_IDN].lock), 80 + __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_IDN].lock), 81 81 NULL 82 82 }, 83 83 { /* access to user-space IPI */ ··· 87 87 0, 88 88 "ipi", 89 89 LIST_HEAD_INIT(hardwall_types[HARDWALL_IPI].list), 90 - __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_IPI].lock), 90 + __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_IPI].lock), 91 91 NULL 92 92 }, 93 93 #endif
+3
arch/tile/kernel/intvec_32.S
··· 815 815 } 816 816 bzt r28, 1f 817 817 bnz r29, 1f 818 + /* Disable interrupts explicitly for preemption. */ 819 + IRQ_DISABLE(r20,r21) 820 + TRACE_IRQS_OFF 818 821 jal preempt_schedule_irq 819 822 FEEDBACK_REENTER(interrupt_return) 820 823 1:
+3
arch/tile/kernel/intvec_64.S
··· 841 841 } 842 842 beqzt r28, 1f 843 843 bnez r29, 1f 844 + /* Disable interrupts explicitly for preemption. */ 845 + IRQ_DISABLE(r20,r21) 846 + TRACE_IRQS_OFF 844 847 jal preempt_schedule_irq 845 848 FEEDBACK_REENTER(interrupt_return) 846 849 1:
+5 -7
arch/tile/kernel/stack.c
··· 23 23 #include <linux/mmzone.h> 24 24 #include <linux/dcache.h> 25 25 #include <linux/fs.h> 26 + #include <linux/string.h> 26 27 #include <asm/backtrace.h> 27 28 #include <asm/page.h> 28 29 #include <asm/ucontext.h> ··· 333 332 } 334 333 335 334 if (vma->vm_file) { 336 - char *s; 337 335 p = d_path(&vma->vm_file->f_path, buf, bufsize); 338 336 if (IS_ERR(p)) 339 337 p = "?"; 340 - s = strrchr(p, '/'); 341 - if (s) 342 - p = s+1; 338 + name = kbasename(p); 343 339 } else { 344 - p = "anon"; 340 + name = "anon"; 345 341 } 346 342 347 343 /* Generate a string description of the vma info. */ 348 - namelen = strlen(p); 344 + namelen = strlen(name); 349 345 remaining = (bufsize - 1) - namelen; 350 - memmove(buf, p, namelen); 346 + memmove(buf, name, namelen); 351 347 snprintf(buf + namelen, remaining, "[%lx+%lx] ", 352 348 vma->vm_start, vma->vm_end - vma->vm_start); 353 349 }
+4 -4
arch/tile/lib/atomic_32.c
··· 107 107 EXPORT_SYMBOL(_atomic_xor); 108 108 109 109 110 - u64 _atomic64_xchg(u64 *v, u64 n) 110 + long long _atomic64_xchg(long long *v, long long n) 111 111 { 112 112 return __atomic64_xchg(v, __atomic_setup(v), n); 113 113 } 114 114 EXPORT_SYMBOL(_atomic64_xchg); 115 115 116 - u64 _atomic64_xchg_add(u64 *v, u64 i) 116 + long long _atomic64_xchg_add(long long *v, long long i) 117 117 { 118 118 return __atomic64_xchg_add(v, __atomic_setup(v), i); 119 119 } 120 120 EXPORT_SYMBOL(_atomic64_xchg_add); 121 121 122 - u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u) 122 + long long _atomic64_xchg_add_unless(long long *v, long long a, long long u) 123 123 { 124 124 /* 125 125 * Note: argument order is switched here since it is easier ··· 130 130 } 131 131 EXPORT_SYMBOL(_atomic64_xchg_add_unless); 132 132 133 - u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n) 133 + long long _atomic64_cmpxchg(long long *v, long long o, long long n) 134 134 { 135 135 return __atomic64_cmpxchg(v, __atomic_setup(v), o, n); 136 136 }
+3 -3
arch/x86/include/asm/cpufeature.h
··· 374 374 * Catch too early usage of this before alternatives 375 375 * have run. 376 376 */ 377 - asm goto("1: jmp %l[t_warn]\n" 377 + asm_volatile_goto("1: jmp %l[t_warn]\n" 378 378 "2:\n" 379 379 ".section .altinstructions,\"a\"\n" 380 380 " .long 1b - .\n" ··· 388 388 389 389 #endif 390 390 391 - asm goto("1: jmp %l[t_no]\n" 391 + asm_volatile_goto("1: jmp %l[t_no]\n" 392 392 "2:\n" 393 393 ".section .altinstructions,\"a\"\n" 394 394 " .long 1b - .\n" ··· 453 453 * have. Thus, we force the jump to the widest, 4-byte, signed relative 454 454 * offset even though the last would often fit in less bytes. 455 455 */ 456 - asm goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n" 456 + asm_volatile_goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n" 457 457 "2:\n" 458 458 ".section .altinstructions,\"a\"\n" 459 459 " .long 1b - .\n" /* src offset */
+1 -1
arch/x86/include/asm/jump_label.h
··· 18 18 19 19 static __always_inline bool arch_static_branch(struct static_key *key) 20 20 { 21 - asm goto("1:" 21 + asm_volatile_goto("1:" 22 22 ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" 23 23 ".pushsection __jump_table, \"aw\" \n\t" 24 24 _ASM_ALIGN "\n\t"
+2 -2
arch/x86/include/asm/mutex_64.h
··· 20 20 static inline void __mutex_fastpath_lock(atomic_t *v, 21 21 void (*fail_fn)(atomic_t *)) 22 22 { 23 - asm volatile goto(LOCK_PREFIX " decl %0\n" 23 + asm_volatile_goto(LOCK_PREFIX " decl %0\n" 24 24 " jns %l[exit]\n" 25 25 : : "m" (v->counter) 26 26 : "memory", "cc" ··· 75 75 static inline void __mutex_fastpath_unlock(atomic_t *v, 76 76 void (*fail_fn)(atomic_t *)) 77 77 { 78 - asm volatile goto(LOCK_PREFIX " incl %0\n" 78 + asm_volatile_goto(LOCK_PREFIX " incl %0\n" 79 79 " jg %l[exit]\n" 80 80 : : "m" (v->counter) 81 81 : "memory", "cc"
+3 -8
arch/x86/kernel/cpu/perf_event.c
··· 1888 1888 userpg->cap_user_rdpmc = x86_pmu.attr_rdpmc; 1889 1889 userpg->pmc_width = x86_pmu.cntval_bits; 1890 1890 1891 - if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) 1892 - return; 1893 - 1894 - if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 1891 + if (!sched_clock_stable) 1895 1892 return; 1896 1893 1897 1894 userpg->cap_user_time = 1; ··· 1896 1899 userpg->time_shift = CYC2NS_SCALE_FACTOR; 1897 1900 userpg->time_offset = this_cpu_read(cyc2ns_offset) - now; 1898 1901 1899 - if (sched_clock_stable && !check_tsc_disabled()) { 1900 - userpg->cap_user_time_zero = 1; 1901 - userpg->time_zero = this_cpu_read(cyc2ns_offset); 1902 - } 1902 + userpg->cap_user_time_zero = 1; 1903 + userpg->time_zero = this_cpu_read(cyc2ns_offset); 1903 1904 } 1904 1905 1905 1906 /*
+12 -12
arch/x86/kvm/vmx.c
··· 3255 3255 3256 3256 static void ept_load_pdptrs(struct kvm_vcpu *vcpu) 3257 3257 { 3258 + struct kvm_mmu *mmu = vcpu->arch.walk_mmu; 3259 + 3258 3260 if (!test_bit(VCPU_EXREG_PDPTR, 3259 3261 (unsigned long *)&vcpu->arch.regs_dirty)) 3260 3262 return; 3261 3263 3262 3264 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { 3263 - vmcs_write64(GUEST_PDPTR0, vcpu->arch.mmu.pdptrs[0]); 3264 - vmcs_write64(GUEST_PDPTR1, vcpu->arch.mmu.pdptrs[1]); 3265 - vmcs_write64(GUEST_PDPTR2, vcpu->arch.mmu.pdptrs[2]); 3266 - vmcs_write64(GUEST_PDPTR3, vcpu->arch.mmu.pdptrs[3]); 3265 + vmcs_write64(GUEST_PDPTR0, mmu->pdptrs[0]); 3266 + vmcs_write64(GUEST_PDPTR1, mmu->pdptrs[1]); 3267 + vmcs_write64(GUEST_PDPTR2, mmu->pdptrs[2]); 3268 + vmcs_write64(GUEST_PDPTR3, mmu->pdptrs[3]); 3267 3269 } 3268 3270 } 3269 3271 3270 3272 static void ept_save_pdptrs(struct kvm_vcpu *vcpu) 3271 3273 { 3274 + struct kvm_mmu *mmu = vcpu->arch.walk_mmu; 3275 + 3272 3276 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { 3273 - vcpu->arch.mmu.pdptrs[0] = vmcs_read64(GUEST_PDPTR0); 3274 - vcpu->arch.mmu.pdptrs[1] = vmcs_read64(GUEST_PDPTR1); 3275 - vcpu->arch.mmu.pdptrs[2] = vmcs_read64(GUEST_PDPTR2); 3276 - vcpu->arch.mmu.pdptrs[3] = vmcs_read64(GUEST_PDPTR3); 3277 + mmu->pdptrs[0] = vmcs_read64(GUEST_PDPTR0); 3278 + mmu->pdptrs[1] = vmcs_read64(GUEST_PDPTR1); 3279 + mmu->pdptrs[2] = vmcs_read64(GUEST_PDPTR2); 3280 + mmu->pdptrs[3] = vmcs_read64(GUEST_PDPTR3); 3277 3281 } 3278 3282 3279 3283 __set_bit(VCPU_EXREG_PDPTR, ··· 7781 7777 vmcs_write64(GUEST_PDPTR1, vmcs12->guest_pdptr1); 7782 7778 vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2); 7783 7779 vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3); 7784 - __clear_bit(VCPU_EXREG_PDPTR, 7785 - (unsigned long *)&vcpu->arch.regs_avail); 7786 - __clear_bit(VCPU_EXREG_PDPTR, 7787 - (unsigned long *)&vcpu->arch.regs_dirty); 7788 7780 } 7789 7781 7790 7782 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->guest_rsp);
+5 -6
drivers/char/random.c
··· 640 640 */ 641 641 void add_device_randomness(const void *buf, unsigned int size) 642 642 { 643 - unsigned long time = get_cycles() ^ jiffies; 643 + unsigned long time = random_get_entropy() ^ jiffies; 644 644 645 645 mix_pool_bytes(&input_pool, buf, size, NULL); 646 646 mix_pool_bytes(&input_pool, &time, sizeof(time), NULL); ··· 677 677 goto out; 678 678 679 679 sample.jiffies = jiffies; 680 - sample.cycles = get_cycles(); 680 + sample.cycles = random_get_entropy(); 681 681 sample.num = num; 682 682 mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL); 683 683 ··· 744 744 struct fast_pool *fast_pool = &__get_cpu_var(irq_randomness); 745 745 struct pt_regs *regs = get_irq_regs(); 746 746 unsigned long now = jiffies; 747 - __u32 input[4], cycles = get_cycles(); 747 + __u32 input[4], cycles = random_get_entropy(); 748 748 749 749 input[0] = cycles ^ jiffies; 750 750 input[1] = irq; ··· 1459 1459 1460 1460 static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned; 1461 1461 1462 - static int __init random_int_secret_init(void) 1462 + int random_int_secret_init(void) 1463 1463 { 1464 1464 get_random_bytes(random_int_secret, sizeof(random_int_secret)); 1465 1465 return 0; 1466 1466 } 1467 - late_initcall(random_int_secret_init); 1468 1467 1469 1468 /* 1470 1469 * Get a random word for internal kernel use only. Similar to urandom but ··· 1482 1483 1483 1484 hash = get_cpu_var(get_random_int_hash); 1484 1485 1485 - hash[0] += current->pid + jiffies + get_cycles(); 1486 + hash[0] += current->pid + jiffies + random_get_entropy(); 1486 1487 md5_transform(hash, random_int_secret); 1487 1488 ret = hash[0]; 1488 1489 put_cpu_var(get_random_int_hash);
+1
drivers/hid/Kconfig
··· 241 241 - Sharkoon Drakonia / Perixx MX-2000 gaming mice 242 242 - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / 243 243 Zalman ZM-GM1 244 + - SHARKOON DarkGlider Gaming mouse 244 245 245 246 config HOLTEK_FF 246 247 bool "Holtek On Line Grip force feedback support"
+1
drivers/hid/hid-core.c
··· 1715 1715 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, 1716 1716 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, 1717 1717 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, 1718 + { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, 1718 1719 { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) }, 1719 1720 { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, 1720 1721 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
+4
drivers/hid/hid-holtek-mouse.c
··· 27 27 * - USB ID 04d9:a067, sold as Sharkoon Drakonia and Perixx MX-2000 28 28 * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200 29 29 * and Zalman ZM-GM1 30 + * - USB ID 04d9:a081, sold as SHARKOON DarkGlider Gaming mouse 30 31 */ 31 32 32 33 static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, ··· 47 46 } 48 47 break; 49 48 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A: 49 + case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081: 50 50 if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f 51 51 && rdesc[111] == 0xff && rdesc[112] == 0x7f) { 52 52 hid_info(hdev, "Fixing up report descriptor\n"); ··· 65 63 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, 66 64 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, 67 65 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, 66 + { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, 67 + USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, 68 68 { } 69 69 }; 70 70 MODULE_DEVICE_TABLE(hid, holtek_mouse_devices);
+1
drivers/hid/hid-ids.h
··· 450 450 #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 451 451 #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 452 452 #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a 453 + #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 453 454 454 455 #define USB_VENDOR_ID_IMATION 0x0718 455 456 #define USB_DEVICE_ID_DISC_STAKKA 0xd000
+1 -1
drivers/hid/hid-roccat-kone.c
··· 382 382 } 383 383 #define PROFILE_ATTR(number) \ 384 384 static struct bin_attribute bin_attr_profile##number = { \ 385 - .attr = { .name = "profile##number", .mode = 0660 }, \ 385 + .attr = { .name = "profile" #number, .mode = 0660 }, \ 386 386 .size = sizeof(struct kone_profile), \ 387 387 .read = kone_sysfs_read_profilex, \ 388 388 .write = kone_sysfs_write_profilex, \
+2 -2
drivers/hid/hid-roccat-koneplus.c
··· 229 229 230 230 #define PROFILE_ATTR(number) \ 231 231 static struct bin_attribute bin_attr_profile##number##_settings = { \ 232 - .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ 232 + .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ 233 233 .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \ 234 234 .read = koneplus_sysfs_read_profilex_settings, \ 235 235 .private = &profile_numbers[number-1], \ 236 236 }; \ 237 237 static struct bin_attribute bin_attr_profile##number##_buttons = { \ 238 - .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ 238 + .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ 239 239 .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \ 240 240 .read = koneplus_sysfs_read_profilex_buttons, \ 241 241 .private = &profile_numbers[number-1], \
+2 -2
drivers/hid/hid-roccat-kovaplus.c
··· 257 257 258 258 #define PROFILE_ATTR(number) \ 259 259 static struct bin_attribute bin_attr_profile##number##_settings = { \ 260 - .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ 260 + .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ 261 261 .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \ 262 262 .read = kovaplus_sysfs_read_profilex_settings, \ 263 263 .private = &profile_numbers[number-1], \ 264 264 }; \ 265 265 static struct bin_attribute bin_attr_profile##number##_buttons = { \ 266 - .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ 266 + .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ 267 267 .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \ 268 268 .read = kovaplus_sysfs_read_profilex_buttons, \ 269 269 .private = &profile_numbers[number-1], \
+2 -2
drivers/hid/hid-roccat-pyra.c
··· 225 225 226 226 #define PROFILE_ATTR(number) \ 227 227 static struct bin_attribute bin_attr_profile##number##_settings = { \ 228 - .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ 228 + .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ 229 229 .size = PYRA_SIZE_PROFILE_SETTINGS, \ 230 230 .read = pyra_sysfs_read_profilex_settings, \ 231 231 .private = &profile_numbers[number-1], \ 232 232 }; \ 233 233 static struct bin_attribute bin_attr_profile##number##_buttons = { \ 234 - .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ 234 + .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ 235 235 .size = PYRA_SIZE_PROFILE_BUTTONS, \ 236 236 .read = pyra_sysfs_read_profilex_buttons, \ 237 237 .private = &profile_numbers[number-1], \
+29 -11
drivers/hid/hid-wiimote-modules.c
··· 119 119 * the rumble motor, this flag shouldn't be set. 120 120 */ 121 121 122 + /* used by wiimod_rumble and wiipro_rumble */ 123 + static void wiimod_rumble_worker(struct work_struct *work) 124 + { 125 + struct wiimote_data *wdata = container_of(work, struct wiimote_data, 126 + rumble_worker); 127 + 128 + spin_lock_irq(&wdata->state.lock); 129 + wiiproto_req_rumble(wdata, wdata->state.cache_rumble); 130 + spin_unlock_irq(&wdata->state.lock); 131 + } 132 + 122 133 static int wiimod_rumble_play(struct input_dev *dev, void *data, 123 134 struct ff_effect *eff) 124 135 { 125 136 struct wiimote_data *wdata = input_get_drvdata(dev); 126 137 __u8 value; 127 - unsigned long flags; 128 138 129 139 /* 130 140 * The wiimote supports only a single rumble motor so if any magnitude ··· 147 137 else 148 138 value = 0; 149 139 150 - spin_lock_irqsave(&wdata->state.lock, flags); 151 - wiiproto_req_rumble(wdata, value); 152 - spin_unlock_irqrestore(&wdata->state.lock, flags); 140 + /* Locking state.lock here might deadlock with input_event() calls. 141 + * schedule_work acts as barrier. Merging multiple changes is fine. */ 142 + wdata->state.cache_rumble = value; 143 + schedule_work(&wdata->rumble_worker); 153 144 154 145 return 0; 155 146 } ··· 158 147 static int wiimod_rumble_probe(const struct wiimod_ops *ops, 159 148 struct wiimote_data *wdata) 160 149 { 150 + INIT_WORK(&wdata->rumble_worker, wiimod_rumble_worker); 151 + 161 152 set_bit(FF_RUMBLE, wdata->input->ffbit); 162 153 if (input_ff_create_memless(wdata->input, NULL, wiimod_rumble_play)) 163 154 return -ENOMEM; ··· 171 158 struct wiimote_data *wdata) 172 159 { 173 160 unsigned long flags; 161 + 162 + cancel_work_sync(&wdata->rumble_worker); 174 163 175 164 spin_lock_irqsave(&wdata->state.lock, flags); 176 165 wiiproto_req_rumble(wdata, 0); ··· 1746 1731 { 1747 1732 struct wiimote_data *wdata = input_get_drvdata(dev); 1748 1733 __u8 value; 1749 - unsigned long flags; 1750 1734 1751 1735 /* 1752 1736 * The wiimote supports only a single rumble motor so if any magnitude ··· 1758 1744 else 1759 1745 value = 0; 1760 1746 1761 - spin_lock_irqsave(&wdata->state.lock, flags); 1762 - wiiproto_req_rumble(wdata, value); 1763 - spin_unlock_irqrestore(&wdata->state.lock, flags); 1747 + /* Locking state.lock here might deadlock with input_event() calls. 1748 + * schedule_work acts as barrier. Merging multiple changes is fine. */ 1749 + wdata->state.cache_rumble = value; 1750 + schedule_work(&wdata->rumble_worker); 1764 1751 1765 1752 return 0; 1766 1753 } ··· 1770 1755 struct wiimote_data *wdata) 1771 1756 { 1772 1757 int ret, i; 1758 + 1759 + INIT_WORK(&wdata->rumble_worker, wiimod_rumble_worker); 1773 1760 1774 1761 wdata->extension.input = input_allocate_device(); 1775 1762 if (!wdata->extension.input) ··· 1834 1817 if (!wdata->extension.input) 1835 1818 return; 1836 1819 1820 + input_unregister_device(wdata->extension.input); 1821 + wdata->extension.input = NULL; 1822 + cancel_work_sync(&wdata->rumble_worker); 1823 + 1837 1824 spin_lock_irqsave(&wdata->state.lock, flags); 1838 1825 wiiproto_req_rumble(wdata, 0); 1839 1826 spin_unlock_irqrestore(&wdata->state.lock, flags); 1840 - 1841 - input_unregister_device(wdata->extension.input); 1842 - wdata->extension.input = NULL; 1843 1827 } 1844 1828 1845 1829 static const struct wiimod_ops wiimod_pro = {
+3 -1
drivers/hid/hid-wiimote.h
··· 133 133 __u8 *cmd_read_buf; 134 134 __u8 cmd_read_size; 135 135 136 - /* calibration data */ 136 + /* calibration/cache data */ 137 137 __u16 calib_bboard[4][3]; 138 + __u8 cache_rumble; 138 139 }; 139 140 140 141 struct wiimote_data { 141 142 struct hid_device *hdev; 142 143 struct input_dev *input; 144 + struct work_struct rumble_worker; 143 145 struct led_classdev *leds[4]; 144 146 struct input_dev *accel; 145 147 struct input_dev *ir;
+14 -7
drivers/hid/hidraw.c
··· 308 308 static void drop_ref(struct hidraw *hidraw, int exists_bit) 309 309 { 310 310 if (exists_bit) { 311 - hid_hw_close(hidraw->hid); 312 311 hidraw->exist = 0; 313 - if (hidraw->open) 312 + if (hidraw->open) { 313 + hid_hw_close(hidraw->hid); 314 314 wake_up_interruptible(&hidraw->wait); 315 + } 315 316 } else { 316 317 --hidraw->open; 317 318 } 318 - 319 - if (!hidraw->open && !hidraw->exist) { 320 - device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); 321 - hidraw_table[hidraw->minor] = NULL; 322 - kfree(hidraw); 319 + if (!hidraw->open) { 320 + if (!hidraw->exist) { 321 + device_destroy(hidraw_class, 322 + MKDEV(hidraw_major, hidraw->minor)); 323 + hidraw_table[hidraw->minor] = NULL; 324 + kfree(hidraw); 325 + } else { 326 + /* close device for last reader */ 327 + hid_hw_power(hidraw->hid, PM_HINT_NORMAL); 328 + hid_hw_close(hidraw->hid); 329 + } 323 330 } 324 331 } 325 332
+2 -1
drivers/hid/uhid.c
··· 615 615 616 616 static struct miscdevice uhid_misc = { 617 617 .fops = &uhid_fops, 618 - .minor = MISC_DYNAMIC_MINOR, 618 + .minor = UHID_MINOR, 619 619 .name = UHID_NAME, 620 620 }; 621 621 ··· 634 634 MODULE_LICENSE("GPL"); 635 635 MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>"); 636 636 MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem"); 637 + MODULE_ALIAS_MISCDEV(UHID_MINOR); 637 638 MODULE_ALIAS("devname:" UHID_NAME);
+13
drivers/hwmon/applesmc.c
··· 230 230 231 231 static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) 232 232 { 233 + u8 status, data = 0; 233 234 int i; 234 235 235 236 if (send_command(cmd) || send_argument(key)) { ··· 238 237 return -EIO; 239 238 } 240 239 240 + /* This has no effect on newer (2012) SMCs */ 241 241 if (send_byte(len, APPLESMC_DATA_PORT)) { 242 242 pr_warn("%.4s: read len fail\n", key); 243 243 return -EIO; ··· 251 249 } 252 250 buffer[i] = inb(APPLESMC_DATA_PORT); 253 251 } 252 + 253 + /* Read the data port until bit0 is cleared */ 254 + for (i = 0; i < 16; i++) { 255 + udelay(APPLESMC_MIN_WAIT); 256 + status = inb(APPLESMC_CMD_PORT); 257 + if (!(status & 0x01)) 258 + break; 259 + data = inb(APPLESMC_DATA_PORT); 260 + } 261 + if (i) 262 + pr_warn("flushed %d bytes, last value is: %d\n", i, data); 254 263 255 264 return 0; 256 265 }
+1 -2
drivers/md/bcache/request.c
··· 996 996 closure_bio_submit(bio, cl, s->d); 997 997 } else { 998 998 bch_writeback_add(dc); 999 + s->op.cache_bio = bio; 999 1000 1000 1001 if (bio->bi_rw & REQ_FLUSH) { 1001 1002 /* Also need to send a flush to the backing device */ ··· 1009 1008 flush->bi_private = cl; 1010 1009 1011 1010 closure_bio_submit(flush, cl, s->d); 1012 - } else { 1013 - s->op.cache_bio = bio; 1014 1011 } 1015 1012 } 1016 1013 out:
+15 -2
drivers/mtd/devices/m25p80.c
··· 168 168 */ 169 169 static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) 170 170 { 171 + int status; 172 + bool need_wren = false; 173 + 171 174 switch (JEDEC_MFR(jedec_id)) { 172 - case CFI_MFR_MACRONIX: 173 175 case CFI_MFR_ST: /* Micron, actually */ 176 + /* Some Micron need WREN command; all will accept it */ 177 + need_wren = true; 178 + case CFI_MFR_MACRONIX: 174 179 case 0xEF /* winbond */: 180 + if (need_wren) 181 + write_enable(flash); 182 + 175 183 flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; 176 - return spi_write(flash->spi, flash->command, 1); 184 + status = spi_write(flash->spi, flash->command, 1); 185 + 186 + if (need_wren) 187 + write_disable(flash); 188 + 189 + return status; 177 190 default: 178 191 /* Spansion style */ 179 192 flash->command[0] = OPCODE_BRWR;
+3 -5
drivers/mtd/nand/nand_base.c
··· 2869 2869 2870 2870 len = le16_to_cpu(p->ext_param_page_length) * 16; 2871 2871 ep = kmalloc(len, GFP_KERNEL); 2872 - if (!ep) { 2873 - ret = -ENOMEM; 2874 - goto ext_out; 2875 - } 2872 + if (!ep) 2873 + return -ENOMEM; 2876 2874 2877 2875 /* Send our own NAND_CMD_PARAM. */ 2878 2876 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); ··· 2918 2920 } 2919 2921 2920 2922 pr_info("ONFI extended param page detected.\n"); 2921 - return 0; 2923 + ret = 0; 2922 2924 2923 2925 ext_out: 2924 2926 kfree(ep);
+5 -3
drivers/s390/char/sclp_cmd.c
··· 145 145 146 146 if (sccb->header.response_code != 0x20) 147 147 return 0; 148 - if (sccb->sclp_send_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)) 149 - return 1; 150 - return 0; 148 + if (!(sccb->sclp_send_mask & (EVTYP_OPCMD_MASK | EVTYP_PMSGCMD_MASK))) 149 + return 0; 150 + if (!(sccb->sclp_receive_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK))) 151 + return 0; 152 + return 1; 151 153 } 152 154 153 155 bool __init sclp_has_vt220(void)
+1 -1
drivers/s390/char/tty3270.c
··· 810 810 struct winsize ws; 811 811 812 812 screen = tty3270_alloc_screen(tp->n_rows, tp->n_cols); 813 - if (!screen) 813 + if (IS_ERR(screen)) 814 814 return; 815 815 /* Switch to new output size */ 816 816 spin_lock_bh(&tp->view.lock);
+2 -1
drivers/spi/spi-atmel.c
··· 1583 1583 /* Initialize the hardware */ 1584 1584 ret = clk_prepare_enable(clk); 1585 1585 if (ret) 1586 - goto out_unmap_regs; 1586 + goto out_free_irq; 1587 1587 spi_writel(as, CR, SPI_BIT(SWRST)); 1588 1588 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ 1589 1589 if (as->caps.has_wdrbt) { ··· 1614 1614 spi_writel(as, CR, SPI_BIT(SWRST)); 1615 1615 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ 1616 1616 clk_disable_unprepare(clk); 1617 + out_free_irq: 1617 1618 free_irq(irq, master); 1618 1619 out_unmap_regs: 1619 1620 iounmap(as->regs);
-3
drivers/spi/spi-clps711x.c
··· 226 226 dev_name(&pdev->dev), hw); 227 227 if (ret) { 228 228 dev_err(&pdev->dev, "Can't request IRQ\n"); 229 - clk_put(hw->spi_clk); 230 229 goto clk_out; 231 230 } 232 231 ··· 246 247 gpio_free(hw->chipselect[i]); 247 248 248 249 spi_master_put(master); 249 - kfree(master); 250 250 251 251 return ret; 252 252 } ··· 261 263 gpio_free(hw->chipselect[i]); 262 264 263 265 spi_unregister_master(master); 264 - kfree(master); 265 266 266 267 return 0; 267 268 }
+2 -8
drivers/spi/spi-fsl-dspi.c
··· 476 476 master->bus_num = bus_num; 477 477 478 478 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 479 - if (!res) { 480 - dev_err(&pdev->dev, "can't get platform resource\n"); 481 - ret = -EINVAL; 482 - goto out_master_put; 483 - } 484 - 485 479 dspi->base = devm_ioremap_resource(&pdev->dev, res); 486 - if (!dspi->base) { 487 - ret = -EINVAL; 480 + if (IS_ERR(dspi->base)) { 481 + ret = PTR_ERR(dspi->base); 488 482 goto out_master_put; 489 483 } 490 484
+3 -1
drivers/spi/spi-mpc512x-psc.c
··· 522 522 psc_num = master->bus_num; 523 523 snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); 524 524 clk = devm_clk_get(dev, clk_name); 525 - if (IS_ERR(clk)) 525 + if (IS_ERR(clk)) { 526 + ret = PTR_ERR(clk); 526 527 goto free_irq; 528 + } 527 529 ret = clk_prepare_enable(clk); 528 530 if (ret) 529 531 goto free_irq;
+10 -1
drivers/spi/spi-pxa2xx.c
··· 546 546 if (pm_runtime_suspended(&drv_data->pdev->dev)) 547 547 return IRQ_NONE; 548 548 549 - sccr1_reg = read_SSCR1(reg); 549 + /* 550 + * If the device is not yet in RPM suspended state and we get an 551 + * interrupt that is meant for another device, check if status bits 552 + * are all set to one. That means that the device is already 553 + * powered off. 554 + */ 550 555 status = read_SSSR(reg); 556 + if (status == ~0) 557 + return IRQ_NONE; 558 + 559 + sccr1_reg = read_SSCR1(reg); 551 560 552 561 /* Ignore possible writes if we don't need to write */ 553 562 if (!(sccr1_reg & SSCR1_TIE))
+2 -2
drivers/spi/spi-s3c64xx.c
··· 1428 1428 S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, 1429 1429 sdd->regs + S3C64XX_SPI_INT_EN); 1430 1430 1431 + pm_runtime_enable(&pdev->dev); 1432 + 1431 1433 if (spi_register_master(master)) { 1432 1434 dev_err(&pdev->dev, "cannot register SPI master\n"); 1433 1435 ret = -EBUSY; ··· 1441 1439 dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tDMA=[Rx-%d, Tx-%d]\n", 1442 1440 mem_res, 1443 1441 sdd->rx_dma.dmach, sdd->tx_dma.dmach); 1444 - 1445 - pm_runtime_enable(&pdev->dev); 1446 1442 1447 1443 return 0; 1448 1444
+2 -2
drivers/spi/spi-sh-hspi.c
··· 296 296 goto error1; 297 297 } 298 298 299 + pm_runtime_enable(&pdev->dev); 300 + 299 301 master->num_chipselect = 1; 300 302 master->bus_num = pdev->id; 301 303 master->setup = hspi_setup; ··· 310 308 dev_err(&pdev->dev, "spi_register_master error.\n"); 311 309 goto error1; 312 310 } 313 - 314 - pm_runtime_enable(&pdev->dev); 315 311 316 312 return 0; 317 313
+6
drivers/watchdog/hpwdt.c
··· 802 802 return -ENODEV; 803 803 } 804 804 805 + /* 806 + * Ignore all auxilary iLO devices with the following PCI ID 807 + */ 808 + if (dev->subsystem_device == 0x1979) 809 + return -ENODEV; 810 + 805 811 if (pci_enable_device(dev)) { 806 812 dev_warn(&dev->dev, 807 813 "Not possible to enable PCI Device: 0x%x:0x%x.\n",
+15
include/linux/compiler-gcc4.h
··· 65 65 #define __visible __attribute__((externally_visible)) 66 66 #endif 67 67 68 + /* 69 + * GCC 'asm goto' miscompiles certain code sequences: 70 + * 71 + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 72 + * 73 + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. 74 + * Fixed in GCC 4.8.2 and later versions. 75 + * 76 + * (asm goto is automatically volatile - the naming reflects this.) 77 + */ 78 + #if GCC_VERSION <= 40801 79 + # define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) 80 + #else 81 + # define asm_volatile_goto(x...) do { asm goto(x); } while (0) 82 + #endif 68 83 69 84 #ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 70 85 #if GCC_VERSION >= 40400
+1
include/linux/miscdevice.h
··· 45 45 #define MAPPER_CTRL_MINOR 236 46 46 #define LOOP_CTRL_MINOR 237 47 47 #define VHOST_NET_MINOR 238 48 + #define UHID_MINOR 239 48 49 #define MISC_DYNAMIC_MINOR 255 49 50 50 51 struct device;
+23 -1
include/linux/perf_event.h
··· 294 294 */ 295 295 struct perf_event { 296 296 #ifdef CONFIG_PERF_EVENTS 297 - struct list_head group_entry; 297 + /* 298 + * entry onto perf_event_context::event_list; 299 + * modifications require ctx->lock 300 + * RCU safe iterations. 301 + */ 298 302 struct list_head event_entry; 303 + 304 + /* 305 + * XXX: group_entry and sibling_list should be mutually exclusive; 306 + * either you're a sibling on a group, or you're the group leader. 307 + * Rework the code to always use the same list element. 308 + * 309 + * Locked for modification by both ctx->mutex and ctx->lock; holding 310 + * either sufficies for read. 311 + */ 312 + struct list_head group_entry; 299 313 struct list_head sibling_list; 314 + 315 + /* 316 + * We need storage to track the entries in perf_pmu_migrate_context; we 317 + * cannot use the event_entry because of RCU and we want to keep the 318 + * group in tact which avoids us using the other two entries. 319 + */ 320 + struct list_head migrate_entry; 321 + 300 322 struct hlist_node hlist_entry; 301 323 int nr_siblings; 302 324 int group_flags;
+1
include/linux/random.h
··· 17 17 extern void get_random_bytes(void *buf, int nbytes); 18 18 extern void get_random_bytes_arch(void *buf, int nbytes); 19 19 void generate_random_uuid(unsigned char uuid_out[16]); 20 + extern int random_int_secret_init(void); 20 21 21 22 #ifndef MODULE 22 23 extern const struct file_operations random_fops, urandom_fops;
+14
include/linux/timex.h
··· 64 64 65 65 #include <asm/timex.h> 66 66 67 + #ifndef random_get_entropy 68 + /* 69 + * The random_get_entropy() function is used by the /dev/random driver 70 + * in order to extract entropy via the relative unpredictability of 71 + * when an interrupt takes places versus a high speed, fine-grained 72 + * timing source or cycle counter. Since it will be occurred on every 73 + * single interrupt, it must have a very low cost/overhead. 74 + * 75 + * By default we use get_cycles() for this purpose, but individual 76 + * architectures may override this in their asm/timex.h header file. 77 + */ 78 + #define random_get_entropy() get_cycles() 79 + #endif 80 + 67 81 /* 68 82 * SHIFT_PLL is used as a dampening factor to define how much we 69 83 * adjust the frequency correction for a given offset in PLL mode.
+2
init/main.c
··· 76 76 #include <linux/elevator.h> 77 77 #include <linux/sched_clock.h> 78 78 #include <linux/context_tracking.h> 79 + #include <linux/random.h> 79 80 80 81 #include <asm/io.h> 81 82 #include <asm/bugs.h> ··· 781 780 do_ctors(); 782 781 usermodehelper_enable(); 783 782 do_initcalls(); 783 + random_int_secret_init(); 784 784 } 785 785 786 786 static void __init do_pre_smp_initcalls(void)
+3 -3
kernel/events/core.c
··· 7234 7234 perf_remove_from_context(event); 7235 7235 unaccount_event_cpu(event, src_cpu); 7236 7236 put_ctx(src_ctx); 7237 - list_add(&event->event_entry, &events); 7237 + list_add(&event->migrate_entry, &events); 7238 7238 } 7239 7239 mutex_unlock(&src_ctx->mutex); 7240 7240 7241 7241 synchronize_rcu(); 7242 7242 7243 7243 mutex_lock(&dst_ctx->mutex); 7244 - list_for_each_entry_safe(event, tmp, &events, event_entry) { 7245 - list_del(&event->event_entry); 7244 + list_for_each_entry_safe(event, tmp, &events, migrate_entry) { 7245 + list_del(&event->migrate_entry); 7246 7246 if (event->state >= PERF_EVENT_STATE_OFF) 7247 7247 event->state = PERF_EVENT_STATE_INACTIVE; 7248 7248 account_event_cpu(event, dst_cpu);
+1 -1
lib/kobject.c
··· 592 592 { 593 593 struct kobject *kobj = container_of(kref, struct kobject, kref); 594 594 #ifdef CONFIG_DEBUG_KOBJECT_RELEASE 595 - pr_debug("kobject: '%s' (%p): %s, parent %p (delayed)\n", 595 + pr_info("kobject: '%s' (%p): %s, parent %p (delayed)\n", 596 596 kobject_name(kobj), kobj, __func__, kobj->parent); 597 597 INIT_DELAYED_WORK(&kobj->release, kobject_delayed_cleanup); 598 598 schedule_delayed_work(&kobj->release, HZ);
+1
tools/perf/Makefile
··· 770 770 install-bin: all 771 771 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' 772 772 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' 773 + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 773 774 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 774 775 ifndef NO_LIBPERL 775 776 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+1
tools/perf/builtin-stat.c
··· 457 457 perror("failed to prepare workload"); 458 458 return -1; 459 459 } 460 + child_pid = evsel_list->workload.pid; 460 461 } 461 462 462 463 if (group)
+1 -1
tools/perf/config/feature-tests.mak
··· 219 219 220 220 int main(void) 221 221 { 222 - printf(\"error message: %s\n\", audit_errno_to_name(0)); 222 + printf(\"error message: %s\", audit_errno_to_name(0)); 223 223 return audit_open(); 224 224 } 225 225 endef
+22 -5
tools/perf/util/dwarf-aux.c
··· 426 426 * @die_mem: a buffer for result DIE 427 427 * 428 428 * Search a non-inlined function DIE which includes @addr. Stores the 429 - * DIE to @die_mem and returns it if found. Returns NULl if failed. 429 + * DIE to @die_mem and returns it if found. Returns NULL if failed. 430 430 */ 431 431 Dwarf_Die *die_find_realfunc(Dwarf_Die *cu_die, Dwarf_Addr addr, 432 432 Dwarf_Die *die_mem) ··· 454 454 } 455 455 456 456 /** 457 - * die_find_inlinefunc - Search an inlined function at given address 458 - * @cu_die: a CU DIE which including @addr 457 + * die_find_top_inlinefunc - Search the top inlined function at given address 458 + * @sp_die: a subprogram DIE which including @addr 459 459 * @addr: target address 460 460 * @die_mem: a buffer for result DIE 461 461 * 462 462 * Search an inlined function DIE which includes @addr. Stores the 463 - * DIE to @die_mem and returns it if found. Returns NULl if failed. 463 + * DIE to @die_mem and returns it if found. Returns NULL if failed. 464 + * Even if several inlined functions are expanded recursively, this 465 + * doesn't trace it down, and returns the topmost one. 466 + */ 467 + Dwarf_Die *die_find_top_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr, 468 + Dwarf_Die *die_mem) 469 + { 470 + return die_find_child(sp_die, __die_find_inline_cb, &addr, die_mem); 471 + } 472 + 473 + /** 474 + * die_find_inlinefunc - Search an inlined function at given address 475 + * @sp_die: a subprogram DIE which including @addr 476 + * @addr: target address 477 + * @die_mem: a buffer for result DIE 478 + * 479 + * Search an inlined function DIE which includes @addr. Stores the 480 + * DIE to @die_mem and returns it if found. Returns NULL if failed. 464 481 * If several inlined functions are expanded recursively, this trace 465 - * it and returns deepest one. 482 + * it down and returns deepest one. 466 483 */ 467 484 Dwarf_Die *die_find_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr, 468 485 Dwarf_Die *die_mem)
+5 -1
tools/perf/util/dwarf-aux.h
··· 79 79 extern Dwarf_Die *die_find_realfunc(Dwarf_Die *cu_die, Dwarf_Addr addr, 80 80 Dwarf_Die *die_mem); 81 81 82 - /* Search an inlined function including given address */ 82 + /* Search the top inlined function including given address */ 83 + extern Dwarf_Die *die_find_top_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr, 84 + Dwarf_Die *die_mem); 85 + 86 + /* Search the deepest inlined function including given address */ 83 87 extern Dwarf_Die *die_find_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr, 84 88 Dwarf_Die *die_mem); 85 89
+12
tools/perf/util/header.c
··· 2768 2768 if (perf_file_header__read(&f_header, header, fd) < 0) 2769 2769 return -EINVAL; 2770 2770 2771 + /* 2772 + * Sanity check that perf.data was written cleanly; data size is 2773 + * initialized to 0 and updated only if the on_exit function is run. 2774 + * If data size is still 0 then the file contains only partial 2775 + * information. Just warn user and process it as much as it can. 2776 + */ 2777 + if (f_header.data.size == 0) { 2778 + pr_warning("WARNING: The %s file's data size field is 0 which is unexpected.\n" 2779 + "Was the 'perf record' command properly terminated?\n", 2780 + session->filename); 2781 + } 2782 + 2771 2783 nr_attrs = f_header.attrs.size / f_header.attr_size; 2772 2784 lseek(fd, f_header.attrs.offset, SEEK_SET); 2773 2785
+33 -16
tools/perf/util/probe-finder.c
··· 1327 1327 struct perf_probe_point *ppt) 1328 1328 { 1329 1329 Dwarf_Die cudie, spdie, indie; 1330 - Dwarf_Addr _addr, baseaddr; 1331 - const char *fname = NULL, *func = NULL, *tmp; 1330 + Dwarf_Addr _addr = 0, baseaddr = 0; 1331 + const char *fname = NULL, *func = NULL, *basefunc = NULL, *tmp; 1332 1332 int baseline = 0, lineno = 0, ret = 0; 1333 1333 1334 1334 /* Adjust address with bias */ ··· 1349 1349 /* Find a corresponding function (name, baseline and baseaddr) */ 1350 1350 if (die_find_realfunc(&cudie, (Dwarf_Addr)addr, &spdie)) { 1351 1351 /* Get function entry information */ 1352 - tmp = dwarf_diename(&spdie); 1353 - if (!tmp || 1352 + func = basefunc = dwarf_diename(&spdie); 1353 + if (!func || 1354 1354 dwarf_entrypc(&spdie, &baseaddr) != 0 || 1355 - dwarf_decl_line(&spdie, &baseline) != 0) 1355 + dwarf_decl_line(&spdie, &baseline) != 0) { 1356 + lineno = 0; 1356 1357 goto post; 1357 - func = tmp; 1358 + } 1358 1359 1359 - if (addr == (unsigned long)baseaddr) 1360 + if (addr == (unsigned long)baseaddr) { 1360 1361 /* Function entry - Relative line number is 0 */ 1361 1362 lineno = baseline; 1362 - else if (die_find_inlinefunc(&spdie, (Dwarf_Addr)addr, 1363 - &indie)) { 1363 + fname = dwarf_decl_file(&spdie); 1364 + goto post; 1365 + } 1366 + 1367 + /* Track down the inline functions step by step */ 1368 + while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr, 1369 + &indie)) { 1370 + /* There is an inline function */ 1364 1371 if (dwarf_entrypc(&indie, &_addr) == 0 && 1365 - _addr == addr) 1372 + _addr == addr) { 1366 1373 /* 1367 1374 * addr is at an inline function entry. 1368 1375 * In this case, lineno should be the call-site 1369 - * line number. 1376 + * line number. (overwrite lineinfo) 1370 1377 */ 1371 1378 lineno = die_get_call_lineno(&indie); 1372 - else { 1379 + fname = die_get_call_file(&indie); 1380 + break; 1381 + } else { 1373 1382 /* 1374 1383 * addr is in an inline function body. 1375 1384 * Since lineno points one of the lines ··· 1386 1377 * be the entry line of the inline function. 1387 1378 */ 1388 1379 tmp = dwarf_diename(&indie); 1389 - if (tmp && 1390 - dwarf_decl_line(&spdie, &baseline) == 0) 1391 - func = tmp; 1380 + if (!tmp || 1381 + dwarf_decl_line(&indie, &baseline) != 0) 1382 + break; 1383 + func = tmp; 1384 + spdie = indie; 1392 1385 } 1393 1386 } 1387 + /* Verify the lineno and baseline are in a same file */ 1388 + tmp = dwarf_decl_file(&spdie); 1389 + if (!tmp || strcmp(tmp, fname) != 0) 1390 + lineno = 0; 1394 1391 } 1395 1392 1396 1393 post: 1397 1394 /* Make a relative line number or an offset */ 1398 1395 if (lineno) 1399 1396 ppt->line = lineno - baseline; 1400 - else if (func) 1397 + else if (basefunc) { 1401 1398 ppt->offset = addr - (unsigned long)baseaddr; 1399 + func = basefunc; 1400 + } 1402 1401 1403 1402 /* Duplicate strings */ 1404 1403 if (func) {
+3 -1
tools/perf/util/session.c
··· 256 256 tool->sample = process_event_sample_stub; 257 257 if (tool->mmap == NULL) 258 258 tool->mmap = process_event_stub; 259 + if (tool->mmap2 == NULL) 260 + tool->mmap2 = process_event_stub; 259 261 if (tool->comm == NULL) 260 262 tool->comm = process_event_stub; 261 263 if (tool->fork == NULL) ··· 1312 1310 file_offset = page_offset; 1313 1311 head = data_offset - page_offset; 1314 1312 1315 - if (data_offset + data_size < file_size) 1313 + if (data_size && (data_offset + data_size < file_size)) 1316 1314 file_size = data_offset + data_size; 1317 1315 1318 1316 progress_next = file_size / 16;