linux/arch/arm64/include/asm
Will Deacon 2a2830703a arm64: debug: avoid accessing mdscr_el1 on fault paths where possible
Since mdscr_el1 is part of the debug register group, it is highly likely
to be trapped by a hypervisor to prevent virtual machines from debugging
(buggering?) each other. Unfortunately, this absolutely destroys our
performance, since we access the register on many of our low-level
fault handling paths to keep track of the various debug state machines.

This patch removes our dependency on mdscr_el1 in the case that debugging
is not being used. More specifically we:

  - Use TIF_SINGLESTEP to indicate that a task is stepping at EL0 and
    avoid disabling step in the MDSCR when we don't need to.
    MDSCR_EL1.SS handling is moved to kernel_entry, when trapping from
    userspace.

  - Ensure debug exceptions are re-enabled on *all* exception entry
    paths, even the debug exception handling path (where we re-enable
    exceptions after invoking the handler). Since we can now rely on
    MDSCR_EL1.SS being cleared by the entry code, exception handlers can
    usually enable debug immediately before enabling interrupts.

  - Remove all debug exception unmasking from ret_to_user and
    el1_preempt, since we will never get here with debug exceptions
    masked.

This results in a slight change to kernel debug behaviour, where we now
step into interrupt handlers and data aborts from EL1 when debugging the
kernel, which is actually a useful thing to do. A side-effect of this is
that it *does* potentially prevent stepping off {break,watch}points when
there is a high-frequency interrupt source (e.g. a timer), so a debugger
would need to use either breakpoints or manually disable interrupts to
get around this issue.

With this patch applied, guest performance is restored under KVM when
debug register accesses are trapped (and we get a measurable performance
increase on the host on Cortex-A57 too).

Cc: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2014-05-12 16:43:28 +01:00
..
xen xen/arm64: do not call the swiotlb functions twice 2013-12-11 16:21:00 +00:00
arch_timer.h ARM64: arch_timer: add support to configure and enable event stream 2013-09-26 09:47:43 +01:00
asm-offsets.h
assembler.h arm64: debug: avoid accessing mdscr_el1 on fault paths where possible 2014-05-12 16:43:28 +01:00
atomic.h arm64: Make atomic64_t() return "long", not "long long" 2014-05-09 16:00:19 +01:00
barrier.h arm64: barriers: use barrier() instead of smp_mb() when !SMP 2014-05-09 17:03:52 +01:00
bitops.h arm64: klib: Optimised atomic bitops 2013-03-21 17:39:31 +00:00
cache.h arm64: Implement cache_line_size() based on CTR_EL0.CWG 2014-05-09 15:47:45 +01:00
cacheflush.h arm64: barriers: make use of barrier options with explicit barriers 2014-05-09 17:03:15 +01:00
cachetype.h arm64: Implement cache_line_size() based on CTR_EL0.CWG 2014-05-09 15:47:45 +01:00
cmpxchg.h arm64: xchg: prevent warning if return value is unused 2014-05-09 17:00:00 +01:00
compat.h ARM64: perf: support dwarf unwinding in compat mode 2014-03-13 11:22:38 +00:00
compiler.h arm64: Miscellaneous header files 2012-09-17 13:42:21 +01:00
cpu_ops.h arm64: kernel: cpu_{suspend/resume} implementation 2013-12-16 17:17:31 +00:00
cpufeature.h arm64: enable generic CPU feature modalias matching for this architecture 2014-03-14 18:01:36 +00:00
cputable.h arm64: CPU support 2012-09-17 13:41:59 +01:00
cputype.h Merge tag 'arm64-suspend' of git://linux-arm.org/linux-2.6-lp into upstream 2013-12-19 17:57:51 +00:00
debug-monitors.h arm64: KGDB: Add Basic KGDB support 2014-02-26 11:16:25 +00:00
device.h arm64: device: add iommu pointer to device archdata 2013-06-11 18:15:55 +01:00
dma-contiguous.h arm64: fix build error if DMA_CMA is enabled 2014-01-27 12:00:25 +00:00
dma-mapping.h arm64: Implement coherent DMA API based on swiotlb 2014-02-27 17:16:59 +00:00
elf.h arm64: compat: add support for big-endian (BE8) AArch32 binaries 2013-10-25 15:59:35 +01:00
esr.h arm64: Provide read/write fault information in compat signal handlers 2014-05-09 15:47:47 +01:00
exception.h arm64: Use irqchip_init() for interrupt controller initialisation 2013-03-26 16:02:23 +00:00
exec.h arm64: Miscellaneous header files 2012-09-17 13:42:21 +01:00
fb.h arm64: Device specific operations 2012-09-17 13:42:04 +01:00
fixmap.h arm64: add early_ioremap support 2014-04-07 16:36:15 -07:00
fpsimd.h arm64: elf: fix core dumping definitions for GP and FP registers 2012-11-08 16:06:20 +00:00
fpsimdmacros.h arm64: move FP-SIMD save/restore code to a macro 2012-12-05 11:26:50 +00:00
futex.h arm64: asm: remove redundant "cc" clobbers 2014-02-07 16:46:07 +00:00
hardirq.h arm64: enable generic clockevent broadcast 2013-12-16 17:17:35 +00:00
hugetlb.h ARM64: mm: HugeTLB support. 2013-06-14 09:52:40 +01:00
hw_breakpoint.h arm64: Debugging support 2012-09-17 13:42:14 +01:00
hwcap.h arm64: advertise ARMv8 extensions to 32-bit compat ELF binaries 2014-03-04 08:06:32 +00:00
hypervisor.h arm64/xen: introduce asm/xen header files on arm64 2013-06-07 10:39:45 +00:00
insn.h arm64: introduce aarch64_insn_gen_{nop|branch_imm}() helper functions 2014-01-08 15:21:29 +00:00
io.h arm64: Clean up the default pgprot setting 2014-05-09 15:53:37 +01:00
irq.h arm64: add CPU_HOTPLUG infrastructure 2013-10-25 11:33:21 +01:00
irqflags.h arm64: Add macros to manage processor debug state 2014-02-26 11:16:25 +00:00
jump_label.h arm64, jump label: optimize jump label implementation 2014-01-08 15:23:53 +00:00
Kbuild arm64: add early_ioremap support 2014-04-07 16:36:15 -07:00
kgdb.h arm64: KGDB: Add Basic KGDB support 2014-02-26 11:16:25 +00:00
kvm_arm.h Merge tag 'kvm-3.15-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2014-04-02 14:50:10 -07:00
kvm_asm.h arm64: KVM: trap VM system registers until MMU and caches are ON 2014-03-03 01:15:21 +00:00
kvm_coproc.h arm64: KVM: 32bit handling of coprocessor traps 2013-06-12 16:42:16 +01:00
kvm_emulate.h A handful of fixes for KVM/arm64: 2013-11-11 12:05:20 +01:00
kvm_host.h arm64: KVM: Add Kconfig option for max VCPUs per-Guest 2013-12-28 10:28:50 +00:00
kvm_mmio.h arm64: KVM: MMIO access backend 2013-06-07 14:03:38 +01:00
kvm_mmu.h arm64: KVM: flush VM pages before letting the guest enable caches 2014-03-03 01:15:22 +00:00
kvm_psci.h arm64: KVM: PSCI implementation 2013-06-12 16:40:32 +01:00
linkage.h arm64: fix alignment padding in assembly code 2012-10-20 11:12:01 +01:00
memblock.h arm64: MMU initialisation 2012-09-17 13:41:56 +01:00
memory.h arm64: add early_ioremap support 2014-04-07 16:36:15 -07:00
mmu_context.h arm64: mm: don't bother invalidating the icache in switch_mm 2013-06-07 18:00:11 +01:00
mmu.h arm64: initialize spinlock for init_mm's context 2014-04-25 16:46:51 +01:00
module.h arm64: Loadable modules 2012-09-17 13:42:19 +01:00
neon.h arm64: add support for kernel mode NEON 2013-08-20 12:12:26 +01:00
page.h arm64: MMU fault handling and page table management 2012-09-17 13:41:57 +01:00
percpu.h arm64: Fix !CONFIG_SMP kernel build 2014-02-28 16:12:25 +00:00
perf_event.h arm64: perf: add guest vs host discrimination 2013-01-29 16:56:17 +00:00
pgalloc.h arm64: handle pgtable_page_ctor() fail 2013-11-15 09:32:16 +09:00
pgtable-2level-hwdef.h arm64: Use 42-bit address space with 64K pages 2013-11-05 17:23:52 +00:00
pgtable-2level-types.h ARM64: include: asm: include "asm/types.h" in "pgtable-2level-types.h" and "pgtable-3level-types.h" 2013-08-22 11:44:41 +01:00
pgtable-3level-hwdef.h arm64: MMU definitions 2012-09-17 13:41:56 +01:00
pgtable-3level-types.h ARM64: include: asm: include "asm/types.h" in "pgtable-2level-types.h" and "pgtable-3level-types.h" 2013-08-22 11:44:41 +01:00
pgtable-hwdef.h arm64: mm: Create gigabyte kernel logical mappings where possible 2014-05-09 16:10:58 +01:00
pgtable.h arm64: barriers: make use of barrier options with explicit barriers 2014-05-09 17:03:15 +01:00
pmu.h arm64: Performance counters support 2012-09-17 13:42:17 +01:00
proc-fns.h arm64: kernel: suspend/resume registers save/restore 2013-12-16 17:17:31 +00:00
processor.h arm64: Provide read/write fault information in compat signal handlers 2014-05-09 15:47:47 +01:00
psci.h arm64: remove return value form psci_init() 2014-02-28 14:14:53 +00:00
ptrace.h ARM64: perf: support dwarf unwinding in compat mode 2014-03-13 11:22:38 +00:00
shmparam.h arm64: ELF definitions 2012-09-17 13:42:07 +01:00
signal32.h arm64: 32-bit (compat) applications support 2012-09-17 13:42:12 +01:00
smp_plat.h arm64: kernel: build MPIDR_EL1 hash function data structure 2013-12-16 17:17:30 +00:00
smp.h arm64: add CPU_HOTPLUG infrastructure 2013-10-25 11:33:21 +01:00
sparsemem.h arm64: MMU definitions 2012-09-17 13:41:56 +01:00
spinlock_types.h arm64: Fix the endianness of arch_spinlock_t 2013-10-25 16:10:22 +01:00
spinlock.h arm64: asm: remove redundant "cc" clobbers 2014-02-07 16:46:07 +00:00
stacktrace.h arm64: Exception handling 2012-09-17 10:24:46 +01:00
stat.h UAPI: (Scripted) Disintegrate arch/arm64/include/asm 2012-10-11 11:05:13 +01:00
string.h arm64: klib: Optimised string functions 2013-03-21 17:39:30 +00:00
suspend.h arm64: kernel: cpu_{suspend/resume} implementation 2013-12-16 17:17:31 +00:00
sync_bitops.h arm64/xen: introduce asm/xen header files on arm64 2013-06-07 10:39:45 +00:00
syscall.h arm64: check for number of arguments in syscall_get/set_arguments() 2013-10-23 15:45:35 +01:00
syscalls.h arm64: switch to generic sigaltstack 2013-02-14 09:17:29 -05:00
system_misc.h arm64: use common reboot infrastructure 2013-07-19 15:57:08 +01:00
thread_info.h preempt: Make PREEMPT_ACTIVE generic 2013-11-13 20:21:47 +01:00
timex.h arm64: kernel: compiling issue, need delete read_current_timer() 2013-06-10 17:58:20 +01:00
tlb.h arm64: mm: Add THP TLB entries to general mmu_gather 2014-04-25 16:46:49 +01:00
tlbflush.h arm64: barriers: make use of barrier options with explicit barriers 2014-05-09 17:03:15 +01:00
topology.h arm64: topology: Implement basic CPU topology support 2014-03-04 10:30:07 +00:00
traps.h arm64: Exception handling 2012-09-17 10:24:46 +01:00
uaccess.h arm64: Fix __range_ok macro 2014-03-20 17:41:27 +00:00
ucontext.h arm64: fix padding computation in struct ucontext 2013-03-18 10:42:16 +00:00
unistd32.h arm64: add renameat2 compat syscall 2014-04-23 10:22:33 +01:00
unistd.h compat: let architectures define __ARCH_WANT_COMPAT_SYS_GETDENTS64 2014-03-04 09:05:33 +01:00
vdso_datapage.h arm64: VDSO support 2012-09-17 13:42:09 +01:00
vdso.h arm64: VDSO support 2012-09-17 13:42:09 +01:00
virt.h Revert "arm64: virt: ensure visibility of __boot_cpu_mode" 2014-04-05 10:06:20 +01:00
word-at-a-time.h arm64: dcache: select DCACHE_WORD_ACCESS for little-endian CPUs 2013-12-19 17:43:08 +00:00