linux-stable/arch/mips/kernel
Paul Burton fd0b19ed53 MIPS: Fix perf event init
Commit c311c79799 ("cpumask: make "nr_cpumask_bits" unsigned")
modified mipspmu_event_init() to cast the struct perf_event cpu field to
an unsigned integer before it is compared with nr_cpumask_bits (and
*ahem* did so without copying the linux-mips mailing list or any MIPS
developers...). This is broken because the cpu field may be -1 for
events which follow a process rather than being affine to a particular
CPU. When this is the case the cast to an unsigned int results in a
value equal to ULONG_MAX, which is always greater than nr_cpumask_bits
so we always fail mipspmu_event_init() and return -ENODEV.

The check against nr_cpumask_bits seems nonsensical anyway, so this
patch simply removes it. The cpu field is going to either be -1 or a
valid CPU number. Comparing it with nr_cpumask_bits is effectively
checking that it's a valid cpu number, but it seems safe to rely on the
core perf events code to ensure that's the case.

The end result is that this fixes use of perf on MIPS when not
constraining events to a particular CPU, and fixes the "perf list hw"
command which fails to list any events without this.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: c311c79799 ("cpumask: make "nr_cpumask_bits" unsigned")
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mips@linux-mips.org
Cc: stable <stable@vger.kernel.org> # v4.12+
Patchwork: https://patchwork.linux-mips.org/patch/17323/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-09-20 10:47:12 +02:00
..
.gitignore
8250-platform.c
asm-offsets.c
binfmt_elfn32.c
binfmt_elfo32.c
bmips_5xxx_init.S
bmips_vec.S
branch.c MIPS: Use pr_debug' for messages from __compute_return_epc_for_insn' 2017-06-29 02:42:27 +02:00
cacheinfo.c
cevt-bcm1480.c
cevt-ds1287.c
cevt-gt641xx.c
cevt-r4k.c
cevt-sb1250.c
cevt-txx9.c
cmpxchg.c MIPS: cmpxchg: Implement 1 byte & 2 byte cmpxchg() 2017-06-29 02:42:25 +02:00
cps-vec-ns16550.S
cps-vec.S MIPS: CPS: Use GlobalNumber macros rather than magic numbers 2017-08-30 00:57:26 +02:00
cpu-bugs64.c
cpu-probe.c MIPS: Add CPU cluster number accessors 2017-08-30 00:57:27 +02:00
crash.c
crash_dump.c
csrc-bcm1480.c
csrc-ioasic.c
csrc-r4k.c
csrc-sb1250.c
early_printk.c
early_printk_8250.c
elf.c fs: fix kernel_read prototype 2017-09-04 19:05:15 -04:00
entry.S MIPS: Fix IRQ tracing & lockdep when rescheduling 2017-06-30 04:40:18 +02:00
ftrace.c MIPS: ftrace: fix init functions tracing 2017-06-08 14:51:59 +02:00
genex.S MIPS: Add DWARF unwinding to assembly 2017-09-06 11:01:52 +02:00
gpio_txx9.c
head.S MIPS: head: Reorder instructions missing a delay slot 2017-06-27 23:35:21 +02:00
i8253.c
idle.c MIPS: Include linux/cpu.h for arch_cpu_idle() 2017-08-29 15:21:54 +02:00
irq-gt641xx.c
irq-msc01.c
irq-rm7000.c
irq.c
irq_txx9.c
jump_label.c jump_label: Reorder hotplug lock and jump_label_lock 2017-05-26 10:10:45 +02:00
kgdb.c
kprobes.c
linux32.c
machine_kexec.c
Makefile MIPS: Move r4k FP code from r4k_switch.S to r4k_fpu.S 2017-08-29 15:21:51 +02:00
mcount.S
mips-cm.c MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers 2017-08-30 00:57:27 +02:00
mips-cpc.c MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers 2017-08-30 00:57:27 +02:00
mips-mt-fpaff.c
mips-mt.c
mips-r2-to-r6-emul.c MIPS: Declare various variables & functions static 2017-08-29 15:21:55 +02:00
mips_machine.c
module.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2017-07-15 10:59:54 -07:00
octeon_switch.S MIPS: Move r4k FP code from r4k_switch.S to r4k_fpu.S 2017-08-29 15:21:51 +02:00
perf_event.c
perf_event_mipsxx.c MIPS: Fix perf event init 2017-09-20 10:47:12 +02:00
pm-cps.c MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers 2017-08-30 00:57:27 +02:00
pm.c
probes-common.h
proc.c MIPS: Abstract CPU core & VP(E) ID access through accessor functions 2017-08-30 00:57:26 +02:00
process.c MIPS: Refactor handling of stack pointer in get_frame_info 2017-09-06 13:21:44 +02:00
prom.c
ptrace.c MIPS: seccomp: Fix indirect syscall args 2017-08-29 15:42:44 +02:00
ptrace32.c
r4k_fpu.S MIPS: Move r4k FP code from r4k_switch.S to r4k_fpu.S 2017-08-29 15:21:51 +02:00
r4k_switch.S MIPS: Move r4k FP code from r4k_switch.S to r4k_fpu.S 2017-08-29 15:21:51 +02:00
r2300_fpu.S MIPS: Move r2300 FP code from r2300_switch.S to r2300_fpu.S 2017-08-29 15:21:51 +02:00
r2300_switch.S MIPS: Remove unused ST_OFF from r2300_switch.S 2017-08-29 15:21:51 +02:00
relocate.c
relocate_kernel.S
reset.c
rtlx-cmp.c
rtlx-mt.c
rtlx.c
scall32-o32.S MIPS: Remove pt_regs adjustments in indirect syscall handler 2017-08-29 15:48:34 +02:00
scall64-64.S MIPS: Save static registers before sysmips 2017-06-28 12:22:40 +02:00
scall64-n32.S MIPS: Save static registers before sysmips 2017-06-28 12:22:40 +02:00
scall64-o32.S MIPS: Remove pt_regs adjustments in indirect syscall handler 2017-08-29 15:48:34 +02:00
segment.c
setup.c MIPS: cmdline: Add support for 'memmap' parameter 2017-06-29 02:42:23 +02:00
signal-common.h
signal.c
signal32.c signal: Remove kernel interal si_code magic 2017-07-24 14:30:28 -05:00
signal_n32.c
signal_o32.c
smp-bmips.c MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
smp-cmp.c MIPS: Remove unnecessary inclusions of linux/irqchip/mips-gic.h 2017-09-04 13:53:14 +02:00
smp-cps.c MIPS: Remove unnecessary inclusions of linux/irqchip/mips-gic.h 2017-09-04 13:53:14 +02:00
smp-mt.c MIPS: Use mips_gic_present() in place of gic_present 2017-09-04 13:53:14 +02:00
smp-up.c MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
smp.c Merge branch '4.14-features' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2017-09-15 20:43:33 -07:00
spinlock_test.c
spram.c
stacktrace.c
sync-r4k.c
syscall.c MIPS: Branch straight to ll in mips_atomic_set() 2017-06-28 12:22:40 +02:00
sysrq.c
time.c MIPS: Remove plat_timer_setup() 2017-08-29 15:21:55 +02:00
topology.c
traps.c MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers 2017-08-30 00:57:27 +02:00
unaligned.c MIPS: Declare various variables & functions static 2017-08-29 15:21:55 +02:00
uprobes.c
vdso.c MIPS: VDSO: Drop gic_get_usm_range() usage 2017-09-04 13:53:14 +02:00
vmlinux.lds.S
vpe-cmp.c
vpe-mt.c
vpe.c
watch.c