2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-29 15:43:59 +08:00
linux-next/arch/sparc/include/asm
Rob Gardner fc290a114f sparc64: Prevent perf from running during super critical sections
This fixes another cause of random segfaults and bus errors that may
occur while running perf with the callgraph option.

Critical sections beginning with spin_lock_irqsave() raise the interrupt
level to PIL_NORMAL_MAX (14) and intentionally do not block performance
counter interrupts, which arrive at PIL_NMI (15).

But some sections of code are "super critical" with respect to perf
because the perf_callchain_user() path accesses user space and may cause
TLB activity as well as faults as it unwinds the user stack.

One particular critical section occurs in switch_mm:

        spin_lock_irqsave(&mm->context.lock, flags);
        ...
        load_secondary_context(mm);
        tsb_context_switch(mm);
        ...
        spin_unlock_irqrestore(&mm->context.lock, flags);

If a perf interrupt arrives in between load_secondary_context() and
tsb_context_switch(), then perf_callchain_user() could execute with
the context ID of one process, but with an active TSB for a different
process. When the user stack is accessed, it is very likely to
incur a TLB miss, since the h/w context ID has been changed. The TLB
will then be reloaded with a translation from the TSB for one process,
but using a context ID for another process. This exposes memory from
one process to another, and since it is a mapping for stack memory,
this usually causes the new process to crash quickly.

This super critical section needs more protection than is provided
by spin_lock_irqsave() since perf interrupts must not be allowed in.

Since __tsb_context_switch already goes through the trouble of
disabling interrupts completely, we fix this by moving the secondary
context load down into this better protected region.

Orabug: 25577560

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-07-18 11:25:52 -07:00
..
agp.h agp: kill phys_to_gart() and gart_to_phys() 2009-08-03 09:05:00 +01:00
apb.h
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
asm-prototypes.h Adding asm-prototypes.h for genksyms to generate crc 2017-06-19 11:13:05 -07:00
asm.h sparc: Add asm/asm.h 2008-12-09 00:50:13 -08:00
asmmacro.h sparc32: add support for run-time patching of leon/sun single instructions 2012-05-27 23:52:43 -07:00
atomic_32.h locking/atomic: Remove linux/atomic.h:atomic_fetch_or() 2016-06-16 10:48:32 +02:00
atomic_64.h locking/atomic, arch/sparc: Implement atomic{,64}_fetch_{add,sub,and,or,xor}() 2016-06-16 10:48:30 +02:00
atomic.h locking/atomic: Remove linux/atomic.h:atomic_fetch_or() 2016-06-16 10:48:32 +02:00
auxio_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
auxio_64.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
auxio.h sparc32: fix sparse warnings in auxio_32.c 2014-04-29 01:12:26 -04:00
backoff.h sparc64: Improvde documentation and readability of atomic backoff code. 2012-10-28 13:04:47 -07:00
barrier_32.h sparc: reuse asm-generic/barrier.h 2016-01-12 20:46:49 +02:00
barrier_64.h sparc: define __smp_xxx 2016-01-12 20:46:57 +02:00
barrier.h Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
bbc.h
bitext.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
bitops_32.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next 2014-06-19 07:50:07 -10:00
bitops_64.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next 2014-06-19 07:50:07 -10:00
bitops.h
btext.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
bug.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
bugs.h sparc64: Implement SSTATE purely using notifiers and initcalls. 2008-09-02 00:49:38 -07:00
cache.h sparc32: Remove completely unused code from asm/cache.h 2012-05-19 21:15:37 -07:00
cacheflush_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
cacheflush_64.h mm/debug_pagealloc: fix build failure on ppc and some other archs 2015-02-05 13:35:30 -08:00
cacheflush.h sparc32: use flushi when run-time patching in per_cpu_patch 2012-05-20 13:33:36 -07:00
cachetlb_32.h sparc32: Move cache and TLB flushes over to method ops. 2012-05-13 20:49:31 -07:00
chafsr.h
checksum_32.h Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
checksum_64.h Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
checksum.h
chmctrl.h
clock.h
cmpxchg_32.h arch: Remove __ARCH_HAVE_CMPXCHG 2015-05-13 10:55:42 +02:00
cmpxchg_64.h arch/sparc: Introduce xchg16 for SPARC 2017-05-25 12:06:51 -07:00
cmpxchg.h Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
compat_signal.h sparc: Convert naked unsigned uses to unsigned int 2016-03-20 21:28:58 -07:00
compat.h sparc/compat: provide an accurate in_compat_syscall implementation 2016-03-22 15:36:02 -07:00
contregs.h sparc32: Remove sun4{,c} control reg definitions from contregs.h. 2012-05-11 21:29:17 -07:00
cpu_type.h sparc32: Remove sun4 and sun4c from enum sparc_cpu. 2012-05-12 00:23:23 -07:00
cpudata_32.h sparc: Replace __get_cpu_var uses 2014-08-26 13:45:55 -04:00
cpudata_64.h sparc64: Setup a scheduling domain for highest level cache. 2016-10-24 11:04:17 -07:00
cpudata.h sparc: fix sparse warnings in cpu.c 2014-04-29 01:12:25 -04:00
current.h
dcr.h
dcu.h
delay_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
delay_64.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
delay.h
device.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
dma-mapping.h sparc: remove arch specific dma_supported implementations 2017-06-28 06:54:39 -07:00
dma.h sparc32: Convert mmu_* interfaces from btfixup to method ops. 2012-05-13 13:57:05 -07:00
ebus_dma.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
ecc.h
eeprom.h
elf_32.h default SET_PERSONALITY() in linux/elf.h 2013-02-26 02:46:08 -05:00
elf_64.h sparc64: separate extable_64.h, switch elf_64.h to it 2016-10-05 18:38:40 -04:00
elf.h
estate.h
extable_64.h sparc64: separate extable_64.h, switch elf_64.h to it 2016-10-05 18:38:40 -04:00
fb.h sparc: Really fix "console=" for serial consoles. 2010-08-16 12:26:09 -07:00
fbio.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
fhc.h sparc64: Rewrite central driver. 2008-08-31 20:56:15 -07:00
floppy_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
floppy_64.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
floppy.h
fpumacro.h
ftrace.h ftrace: Remove CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST from config 2016-08-24 12:15:13 +02:00
futex_32.h
futex_64.h Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
futex.h
hardirq_32.h hardirq: Make hardirq bits generic 2013-11-13 20:21:46 +01:00
hardirq_64.h hardirq: Make hardirq bits generic 2013-11-13 20:21:46 +01:00
hardirq.h
head_32.h sparc32: drop hardcoding trap_level in kgdb_trap 2016-05-20 17:55:41 -07:00
head_64.h sparc64: Fix return from trap window fill crashes. 2016-05-29 18:55:54 -07:00
head.h
hibernate.h sparc64: Hibernation support 2013-03-20 11:06:54 -07:00
highmem.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
hugetlb.h sparc64: Fix mapping of 64k pages with MAP_FIXED 2017-05-17 12:07:01 -07:00
hvtramp.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
hw_irq.h
hypervisor.h sparc64: Enable sun4v dma ops to use IOMMU v2 APIs 2016-11-18 11:17:00 -08:00
ide.h
idprom.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
intr_queue.h
io_32.h sparc32: remove stale RTC_PORT definition 2016-06-04 15:43:15 +02:00
io_64.h arch/*/io.h: Add ioremap_wt() to all architectures 2015-06-07 15:28:57 +02:00
io-unit.h sparc32: fix sparse warning in io-unit.c 2014-05-18 19:01:26 -07:00
io.h sparc: io: remove duplicate relaxed accessors on sparc32 2014-11-19 10:19:45 +01:00
ioctls.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
iommu_32.h sparc32: fix sparse warning in iommu.c 2014-05-18 19:01:26 -07:00
iommu_64.h sparc64: Initialize iommu_map_table and iommu_pool 2016-11-18 11:16:59 -08:00
iommu.h
irq_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
irq_64.h nmi_backtrace: add more trigger_*_cpu_backtrace() methods 2016-10-07 18:46:30 -07:00
irq.h
irqflags_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
irqflags_64.h sparc/irqs: Do not trace arch_local_{*,irq_*} functions 2011-07-06 08:00:29 -07:00
irqflags.h
jump_label.h locking/static_keys: Add a new static_key interface 2015-08-03 11:34:15 +02:00
Kbuild sparc: move generic-y of exported headers to uapi/asm/Kbuild 2017-07-11 21:33:52 +09:00
kdebug_32.h sparc32: kernel/trace/trace.c wants DIE_OOPS 2008-11-01 21:44:01 -07:00
kdebug_64.h sparc64:Support User Probes for sparc 2016-12-11 18:01:51 -08:00
kdebug.h
kgdb.h sparc32: drop hardcoding trap_level in kgdb_trap 2016-05-20 17:55:41 -07:00
kmap_types.h kmap_types: make most arches use generic header file 2009-06-16 19:47:51 -07:00
kprobes.h kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
ldc.h sparc64: expand LDC interface 2017-06-10 14:10:54 -07:00
leon_amba.h sparc32, leon: Remove separate "ticker" timer for SMP 2013-06-19 02:10:29 -07:00
leon_pci.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
leon.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
lsu.h
machines.h sparc32: Trivial removal of sun4c references in comments. 2012-05-12 00:35:45 -07:00
mbus.h sparc32: Remove cypress cpu support. 2012-05-15 10:22:00 -07:00
mc146818rtc_32.h
mc146818rtc_64.h sparc64: Use generic CMOS driver. 2008-08-29 14:16:48 -07:00
mc146818rtc.h sparc32: fix sparse warnings in time_32.c 2014-05-18 19:01:27 -07:00
mdesc.h sparc64: add MDESC node name property to VIO device metadata 2017-06-25 13:43:13 -07:00
memctrl.h sparc64: Add generic interface for registering a dimm printing handler. 2008-08-24 22:08:34 -07:00
mman.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
mmu_32.h sparc32: add irq + smp declarations to headers 2011-03-16 18:19:08 -07:00
mmu_64.h sparc64: redefine first version 2017-06-06 13:45:28 -07:00
mmu_context_32.h sparc32: centralize all mmu context handling in srmmu.c 2012-07-26 16:46:16 -07:00
mmu_context_64.h sparc64: Prevent perf from running during super critical sections 2017-07-18 11:25:52 -07:00
mmu_context.h
mmu.h
mmzone.h Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
msi.h
mxcc.h
nmi.h kernel/watchdog: introduce arch_touch_nmi_watchdog() 2017-07-12 16:26:02 -07:00
ns87303.h Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
obio.h sparc: Convert naked unsigned uses to unsigned int 2016-03-20 21:28:58 -07:00
openprom.h sparc: Convert naked unsigned uses to unsigned int 2016-03-20 21:28:58 -07:00
oplib_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
oplib_64.h sparc64: Fix register corruption in top-most kernel stack frame during boot. 2014-10-24 09:52:49 -07:00
oplib.h
page_32.h sparc32: fix build with STRICT_MM_TYPECHECKS 2016-05-20 17:55:42 -07:00
page_64.h sparc64: Add support for 2G hugepages 2017-03-27 21:20:23 -07:00
page.h sparc: move page_to_phys to page.h 2014-05-02 01:30:20 -04:00
parport.h sparc: include: asm: drop owner assignment from platform_drivers 2014-10-20 16:20:14 +02:00
pbm.h
pci_32.h PCI: Remove unused pci_dma_burst_advice() 2015-06-08 07:56:43 -05:00
pci_64.h PCI: Add arch_can_pci_mmap_io() on architectures which can mmap() I/O space 2017-04-18 13:02:26 -05:00
pci.h PCI: Move pci_dma_* helpers to common code 2016-03-07 10:40:02 -06:00
pcic.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
pcr.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
percpu_32.h
percpu_64.h sparc64: Get rid of real_setup_per_cpu_areas(). 2009-06-16 04:56:23 -07:00
percpu.h
perf_event.h perf, arch: Cleanup perf-pmu init vs lockup-detector 2010-11-26 15:14:56 +01:00
pgalloc_32.h sparc32: drop superfluous cast in calls to __nocache_pa() 2016-05-20 17:55:42 -07:00
pgalloc_64.h sparc: get rid of superfluous __GFP_REPEAT 2016-06-24 17:23:52 -07:00
pgalloc.h
pgtable_32.h sparc: Fix -Wstringop-overflow warning 2017-05-17 12:07:46 -07:00
pgtable_64.h sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write() 2017-04-06 12:03:29 -07:00
pgtable.h
pgtsrmmu.h sparc: drop pte_file()-related helpers 2015-02-10 14:30:33 -08:00
pil.h sparc64: delete old wrap code 2017-06-06 13:45:29 -07:00
processor_32.h arch: remove unused macro/function thread_saved_pc() 2017-06-28 16:13:57 -07:00
processor_64.h arch: remove unused macro/function thread_saved_pc() 2017-06-28 16:13:57 -07:00
processor.h sparc: reuse asm-generic/barrier.h 2016-01-12 20:46:49 +02:00
prom.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
psr.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
ptrace.h sparc64: Fill in rest of HAVE_REGS_AND_STACK_ACCESS_API 2017-04-23 17:15:51 -07:00
qrwlock.h arch/sparc: Enable queued rwlocks for SPARC 2017-05-25 12:06:51 -07:00
qspinlock.h arch/sparc: Enable queued spinlock support for SPARC 2017-05-25 12:06:52 -07:00
ross.h
sbi.h
scratchpad.h
seccomp.h sparc: switch to using asm-generic for seccomp.h 2015-04-17 09:04:10 -04:00
sections.h sparc32: add support for run-time patching of leon/sun single instructions 2012-05-27 23:52:43 -07:00
setup.h sparc64: remove trailing white spaces 2017-06-12 15:44:01 -07:00
sfafsr.h
sfp-machine_32.h sparc32: remove cast from output constraints in math asm statements 2014-05-18 19:01:28 -07:00
sfp-machine_64.h
sfp-machine.h
shmparam_32.h sparc32: Remove sun4 and sun4c from enum sparc_cpu. 2012-05-12 00:23:23 -07:00
shmparam_64.h
shmparam.h
sigcontext.h sparc: Convert naked unsigned uses to unsigned int 2016-03-20 21:28:58 -07:00
signal.h consolidate kernel-side struct sigaction declarations 2013-02-03 15:09:22 -05:00
smp_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
smp_64.h sparc64: Fix non-SMP build. 2016-09-28 20:40:52 -04:00
smp.h
sparsemem.h sparc64: Fix inconsistent max-physical-address defines. 2013-11-12 15:22:34 -08:00
spinlock_32.h sparc32: Fix old style declaration GCC warnings 2016-10-24 11:04:18 -07:00
spinlock_64.h arch/sparc: Enable queued spinlock support for SPARC 2017-05-25 12:06:52 -07:00
spinlock_types.h arch/sparc: Enable queued spinlock support for SPARC 2017-05-25 12:06:52 -07:00
spinlock.h
spitfire.h sparc64: recognize and support Sonoma CPU type 2016-04-21 16:43:47 -04:00
stacktrace.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
starfire.h arch: sparc: kernel: starfire.c: Remove unused function 2015-03-01 21:33:58 -08:00
string_32.h [sparc] unify 32bit and 64bit string.h 2016-08-07 23:55:48 -04:00
string_64.h [sparc] unify 32bit and 64bit string.h 2016-08-07 23:55:48 -04:00
string.h [sparc] unify 32bit and 64bit string.h 2016-08-07 23:55:48 -04:00
sunbpp.h
swift.h
switch_to_32.h scripts/spelling.txt: add "swith" pattern and fix typo instances 2017-02-27 18:43:46 -08:00
switch_to_64.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
switch_to.h Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
syscall.h sparc/syscall: fix syscall_get_arch 2016-03-22 15:36:02 -07:00
syscalls.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
termbits.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
termios.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
thread_info_32.h sparc: Fix execution domain removal 2015-04-12 21:03:31 +02:00
thread_info_64.h sparc64:Support User Probes for sparc 2016-12-11 18:01:51 -08:00
thread_info.h
timer_32.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
timer_64.h sparc64: add hot-patched and inlined get_tick() 2017-06-12 15:44:03 -07:00
timer.h
timex_32.h sparc32: generic clockevent support 2012-04-15 10:28:50 -07:00
timex_64.h
timex.h
tlb_32.h
tlb_64.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
tlb.h
tlbflush_32.h sparc32: Move cache and TLB flushes over to method ops. 2012-05-13 20:49:31 -07:00
tlbflush_64.h sparc64: Multi-page size support 2017-02-23 08:30:28 -08:00
tlbflush.h
topology_32.h
topology_64.h sparc: topology_64.h: Fix condition for including cpudata.h 2017-02-23 08:21:45 -08:00
topology.h
trap_block.h sparc64: Measure receiver forward progress to avoid send mondo timeout 2017-07-14 11:18:02 -07:00
traps.h UAPI: (Scripted) Disintegrate arch/sparc/include/asm 2012-10-09 09:47:43 +01:00
tsb.h sparc64: Trim page tables for 8M hugepages 2016-07-29 10:49:16 -07:00
tsunami.h
ttable.h sparc64:Support User Probes for sparc 2016-12-11 18:01:51 -08:00
turbosparc.h
uaccess_32.h kill strlen_user() 2017-05-15 23:40:22 -04:00
uaccess_64.h Merge branch 'work.uaccess-unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-15 11:17:52 -07:00
uaccess.h new helper: uaccess_kernel() 2017-03-28 16:43:25 -04:00
unaligned.h
unistd.h sys_sgetmask/sys_ssetmask: add CONFIG_SGETMASK_SYSCALL 2014-06-04 16:54:14 -07:00
upa.h
uprobes.h sparc64: fix for user probes in high memory 2017-02-23 08:22:28 -08:00
user.h
vaddrs.h sparc32: drop fixmap.h 2012-07-26 16:46:16 -07:00
vga.h BUG: headers with BUG/BUG_ON etc. need linux/bug.h 2012-03-04 17:54:34 -05:00
viking.h
vio.h sparc64: add port_id to VIO device metadata 2017-06-25 13:43:15 -07:00
visasm.h sparc64: Fix userspace FPU register corruptions. 2015-08-06 19:13:25 -07:00
winmacro.h sparc32: Implement hard_smp_processor_id() via instruction patching. 2012-05-14 13:31:38 -07:00
xor_32.h
xor_64.h sparc: drop use of extern for prototypes in arch/sparc/include/asm 2014-05-18 19:01:29 -07:00
xor.h