linux/arch/mips/include/asm
Ralf Baechle cf5b2d23a7 MIPS: oprofile: Fix BUG due to smp_processor_id() in preemptible code.
current_cpu_type() is not preemption-safe.
If CONFIG_PREEMPT is enabled then mipsxx_reg_setup() can be called from preemptible state.
Added get_cpu()/put_cpu() pair to make it preemption-safe.

This was found while testing oprofile with CONFIG_DEBUG_PREEMPT enable.

/usr/zntestsuite # opcontrol --init
/usr/zntestsuite # opcontrol --setup --event=L2_CACHE_ACCESSES:500 --event=L2_CACHE_MISSES:500 --no-vmlinux
/usr/zntestsuite # opcontrol --start
Using 2.6+ OProfile kernel interface.
BUG: using smp_processor_id() in preemptible [00000000] code: oprofiled/1362
caller is mipsxx_reg_setup+0x11c/0x164
CPU: 0 PID: 1362 Comm: oprofiled Not tainted 3.10.4 #18
Stack : 00000006 70757465 00000000 00000000 00000000 00000000 80b173f6 00000037
          80b10000 00000000 80b21614 88f5a220 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 89c49c00 89c49c2c 80721254 807b7927 8012c1d0
          80b10000 80721254 00000000 00000552 88f5a220 80b1335c 807b78e6 89c49ba8
          ...
Call Trace:
[<801099a4>] show_stack+0x64/0x7c
[<80665520>] dump_stack+0x20/0x2c
[<803a2250>] debug_smp_processor_id+0xe0/0xf0
[<8052df24>] mipsxx_reg_setup+0x11c/0x164
[<8052cd70>] op_mips_setup+0x24/0x4c
[<80529cfc>] oprofile_setup+0x5c/0x12c
[<8052b9f8>] event_buffer_open+0x78/0xf8
[<801c3150>] do_dentry_open.isra.15+0x2b8/0x3b0
[<801c3270>] finish_open+0x28/0x4c
[<801d49b8>] do_last.isra.41+0x2cc/0xd00
[<801d54a0>] path_openat+0xb4/0x4c4
[<801d5c44>] do_filp_open+0x3c/0xac
[<801c4744>] do_sys_open+0x110/0x1f4
[<8010f47c>] stack_done+0x20/0x44

Bug reported and original patch by Jerin Jacob <jerinjacobk@gmail.com>.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Jerin Jacob <jerinjacobk@gmail.com>
2013-08-05 13:34:22 +02:00
..
dec
emma
fw MIPS: sibyte: Declare the cfe_write() buffer as constant 2013-06-21 18:07:02 +02:00
ip32
lasat
mach-ar7 Revert "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET" 2013-07-01 15:10:58 +02:00
mach-ath79
mach-au1x00
mach-bcm47xx
mach-bcm63xx Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-07-13 14:52:21 -07:00
mach-cavium-octeon Merge branch '3.10-fixes' into mips-for-linux-next 2013-07-12 18:11:43 +02:00
mach-cobalt
mach-db1x00
mach-dec
mach-emma2rh
mach-generic MIPS: Fix multiple definitions of UNCAC_BASE. 2013-07-30 18:40:40 +02:00
mach-ip22
mach-ip27 MIPS: IP27: Fix build error with CONFIG_MAPPED_KERNEL 2013-06-21 18:07:00 +02:00
mach-ip28 Revert "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET" 2013-07-01 15:10:58 +02:00
mach-ip32
mach-jazz
mach-jz4740 MIPS: jz4740: Remove custom DMA API 2013-07-05 11:40:52 +05:30
mach-lantiq
mach-lasat
mach-loongson
mach-loongson1
mach-malta
mach-netlogic
mach-pmcs-msp71xx MIPS: MSP71xx: Remove gpio drivers 2013-06-18 00:31:31 +02:00
mach-pnx833x
mach-powertv
mach-ralink
mach-rc32434
mach-rm
mach-sead3 MIPS: microMIPS: Disable LL/SC and fix linker bug. 2013-05-09 17:55:19 +02:00
mach-sibyte
mach-tx39xx
mach-tx49xx
mach-vr41xx
mips-boards MIPS: malta: Remove software reset defines from generic header. 2013-06-21 18:07:01 +02:00
netlogic MIPS: Netlogic: Fix sign extension in PIC write 2013-06-13 17:46:42 +02:00
octeon MIPS: Octeon: Enable interfaces on EdgeRouter Lite 2013-07-01 15:10:56 +02:00
pci
sgi
sibyte
sn
txx9
vr41xx
xtalk MIPS: IP27: Fix build errors with CONFIG_PCI disabled. 2013-06-21 18:07:00 +02:00
abi.h
addrspace.h
amon.h
arch_hweight.h
asm-offsets.h
asm.h MIPS: microMIPS: Optimise 'memset' core library function. 2013-05-09 17:55:19 +02:00
asmmacro-32.h
asmmacro-64.h
asmmacro.h
atomic.h
barrier.h
bcache.h
bitops.h
bmips.h
bootinfo.h
branch.h MIPS: MIPS16e: Support handling of delay slots. 2013-05-09 17:55:20 +02:00
break.h
bug.h
bugs.h
cache.h
cacheflush.h
cacheops.h
cevt-r4k.h
checksum.h
clkdev.h
clock.h MIPS: clock.h: Remove declaration of cpu_wait. 2013-05-22 01:34:25 +02:00
cmp.h
cmpxchg.h
compat-signal.h
compat.h
compiler.h
cop2.h MIPS: Netlogic: COP2 save/restore code 2013-06-13 17:46:41 +02:00
cpu-features.h MIPS: oprofile: Fix BUG due to smp_processor_id() in preemptible code. 2013-08-05 13:34:22 +02:00
cpu-info.h
cpu.h MIPS: Get rid of MIPS I flag and test macros. 2013-07-01 15:10:56 +02:00
cputime.h
current.h
debug.h
delay.h
device.h
div64.h
dma-coherence.h
dma-mapping.h
dma.h
ds1287.h
dsp.h
edac.h
elf.h
emergency-restart.h
errno.h
exec.h
fb.h
fixmap.h
floppy.h
fpregdef.h
fpu.h
fpu_emulator.h MIPS: microMIPS: Floating point support. 2013-05-09 17:55:18 +02:00
ftrace.h
futex.h
gcmpregs.h
gic.h MIPS: Fix typos and cleanup comment 2013-07-01 15:10:57 +02:00
gio_device.h
gpio.h
gt64120.h
hardirq.h
hazards.h
highmem.h
hugetlb.h
hw_irq.h
i8259.h
ide.h
idle.h MIPS: Idle: Break r4k_wait into two functions and fix it. 2013-05-22 01:34:28 +02:00
inst.h MIPS: MIPS16e: Support handling of delay slots. 2013-05-09 17:55:20 +02:00
io.h MIPS: define write{b,w,l,q}_relaxed 2013-07-01 15:10:59 +02:00
irq.h
irq_cpu.h
irq_gt641xx.h
irq_regs.h
irqflags.h
isadep.h
jazz.h
jazzdma.h
jump_label.h
Kbuild
kdebug.h
kexec.h
kgdb.h
kmap_types.h
kprobes.h
kvm_host.h mips/kvm: Fix ABI by moving manipulation of CP0 registers to KVM_{G,S}ET_ONE_REG 2013-06-03 10:58:54 +03:00
linkage.h
local.h
local64.h
m48t37.h
mc146818-time.h
mc146818rtc.h
mips_machine.h
mips_mt.h
mipsmtregs.h
mipsprom.h
mipsregs.h MIPS: microMIPS: Fix improper definition of ISA exception bit. 2013-07-01 15:10:58 +02:00
mmu.h
mmu_context.h Merge branch '3.10-fixes' into mips-for-linux-next 2013-07-12 18:11:43 +02:00
mmzone.h
module.h
msc01_ic.h
mutex.h
nile4.h
paccess.h
page.h Revert "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET" 2013-07-01 15:10:58 +02:00
parport.h
pci.h MIPS: remove alloc_pci_controller prototype 2013-07-01 15:10:52 +02:00
percpu.h
perf_event.h
pgalloc.h
pgtable-32.h
pgtable-64.h
pgtable-bits.h
pgtable.h consolidate io_remap_pfn_range definitions 2013-06-29 12:46:35 +04:00
pmon.h
prefetch.h
processor.h MIPS: Cleanup indentation and whitespace 2013-07-01 15:10:57 +02:00
prom.h
ptrace.h MIPS: Quit exposing Kconfig symbols in uapi headers. 2013-05-23 10:19:04 +02:00
r4k-timer.h
r4kcache.h
reboot.h
reg.h
regdef.h
rm9k-ocd.h
rtlx.h
scatterlist.h
seccomp.h
sections.h
segment.h
serial.h
setup.h
sgialib.h
sgiarcs.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
sim.h
smp-ops.h
smp.h
smtc.h
smtc_ipi.h
smtc_proc.h
sni.h
socket.h
sparsemem.h
spinlock.h
spinlock_types.h
spram.h
stackframe.h MIPS: Don't save/restore OCTEON wide multiplier state on syscalls. 2013-07-01 15:10:56 +02:00
stackprotector.h MIPS: initial stack protector support 2013-07-01 15:10:48 +02:00
stacktrace.h
string.h
suspend.h
switch_to.h MIPS: Move cop2 save/restore to switch_to() 2013-06-13 17:46:41 +02:00
termios.h
thread_info.h MIPS: Implement HAVE_CONTEXT_TRACKING. 2013-06-10 18:02:30 +02:00
time.h MIPS: Add new GIC clockevent driver. 2013-05-09 17:55:21 +02:00
timex.h
tlb.h
tlbdebug.h
tlbflush.h
tlbmisc.h
topology.h
traps.h
txx9irq.h
txx9pio.h
txx9tmr.h
types.h
uaccess.h Merge branch 'mti-next' of git://git.linux-mips.org/pub/scm/sjhill/linux-sjhill into mips-for-linux-next 2013-05-09 17:57:30 +02:00
uasm.h MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
ucontext.h
unaligned.h
unistd.h
user.h
vdso.h
vga.h
vpe.h
war.h
watch.h
wbflush.h
xor.h