OpenCloudOS-Kernel/arch/x86/kernel
Peter Zijlstra ef21f683a0 perf, x86: use LBR for PEBS IP+1 fixup
Use the LBR to fix up the PEBS IP+1 issue.

As said, PEBS reports the next instruction, here we use the LBR to find
the last branch and from that construct the actual IP. If the IP matches
the LBR-TO, we use LBR-FROM, otherwise we use the LBR-TO address as the
beginning of the last basic block and decode forward.

Once we find a match to the current IP, we use the previous location.

This patch introduces a new ABI element: PERF_RECORD_MISC_EXACT, which
conveys that the reported IP (PERF_SAMPLE_IP) is the exact instruction
that caused the event (barring CPU errata).

The fixup can fail due to various reasons:

 1) LBR contains invalid data (quite possible)
 2) part of the basic block got paged out
 3) the reported IP isn't part of the basic block (see 1)

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
Cc: paulus@samba.org
Cc: eranian@google.com
Cc: robert.richter@amd.com
Cc: fweisbec@gmail.com
LKML-Reference: <20100304140100.619375431@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-03-10 13:23:32 +01:00
..
acpi Merge branch 'x86-mrst-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-07 15:59:39 -08:00
apic Merge branch 'x86-mrst-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-07 15:59:39 -08:00
cpu perf, x86: use LBR for PEBS IP+1 fixup 2010-03-10 13:23:32 +01:00
.gitignore
Makefile x86, apbt: Moorestown APB system timer driver 2010-02-24 11:01:21 -08:00
alternative.c Merge branch 'perf-probes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-05 10:50:22 -08:00
amd_iommu.c x86/amd-iommu: Fix deassignment of a device from the pt_domain 2010-01-22 17:56:49 +01:00
amd_iommu_init.c x86/amd-iommu: Fix IOMMU-API initialization for iommu=pt 2010-01-22 17:44:35 +01:00
apb_timer.c Merge branch 'x86-mrst-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-07 15:59:39 -08:00
aperture_64.c x86/agp: Fix agp_amd64_init and agp_amd64_cleanup 2010-01-13 11:15:37 +01:00
apm_32.c x86: Remove trailing spaces in messages 2010-02-07 17:47:51 +01:00
asm-offsets.c
asm-offsets_32.c lguest: optimize by coding restore_flags and irq_enable in assembler. 2009-06-12 22:27:03 +09:30
asm-offsets_64.c tracing: Define NR_syscalls for x86_64 2009-08-26 21:29:58 +02:00
audit_64.c
bios_uv.c Merge branch 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-28 11:00:55 -08:00
bootflag.c
check.c
cpuid.c x86, msr/cpuid: Pass the number of minors when unregistering MSR and CPUID drivers. 2010-01-26 23:52:38 -08:00
crash.c x86: Use x86_platform for iommu_shutdown 2009-11-08 13:12:26 +01:00
crash_dump_32.c x86: crash_dump: Fix non-pae kdump kernel memory accesses 2009-10-26 12:38:59 +01:00
crash_dump_64.c
doublefault_32.c x86: Use get_desc_base() 2009-07-19 18:27:51 +02:00
ds.c percpu: make percpu symbols in x86 unique 2009-10-29 22:34:14 +09:00
ds_selftest.c x86, ds: fix buffer alignment in debug store selftest 2009-04-24 10:18:51 +02:00
ds_selftest.h
dumpstack.c perf: Stop stack frame walking off kernel addresses boundaries 2010-01-13 09:32:54 +01:00
dumpstack.h perf events, x86/stacktrace: Make stack walking optional 2009-12-17 09:56:19 +01:00
dumpstack_32.c perf: Drop useless check for ignored frame 2010-01-13 10:09:08 +01:00
dumpstack_64.c Merge commit 'v2.6.34-rc1' into perf/urgent 2010-03-09 17:11:53 +01:00
e820.c Merge branch 'linus' into x86/mm 2010-02-17 18:28:05 +01:00
early-quirks.c
early_printk.c x86: earlyprintk: Fix regression to handle serial,ttySn as 1 arg 2009-10-01 10:34:16 +02:00
efi.c x86: Remove trailing spaces in messages 2010-02-07 17:47:51 +01:00
efi_32.c
efi_64.c x86: Make 64-bit efi_ioremap use ioremap on MMIO regions 2009-08-03 13:34:25 -07:00
efi_stub_32.S
efi_stub_64.S
entry_32.S x86, 32-bit: Use same regs as 64-bit for kernel_thread_helper 2009-12-10 15:55:36 -08:00
entry_64.S Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-12-16 12:02:37 -08:00
ftrace.c Merge branch 'tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing into tracing/core 2010-02-27 10:06:10 +01:00
head.c
head32.c x86: Move bios page reserve early to head32/64.c 2010-02-12 09:42:38 -08:00
head64.c x86: Use find_e820() instead of hard coded trampoline address 2009-12-11 09:28:22 +01:00
head_32.S Merge branch 'master' into percpu 2010-01-05 09:17:33 +09:00
head_64.S Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-12-08 13:27:33 -08:00
hpet.c clocksource: add argument to resume callback 2010-02-05 14:54:10 +01:00
hw_breakpoint.c Merge branch 'perf/core' into perf/urgent 2010-03-04 11:47:52 +01:00
i386_ksyms_32.c x86: Don't generate cmpxchg8b_emu if CONFIG_X86_CMPXCHG64=y 2009-10-01 08:42:24 +02:00
i387.c x86, ptrace: Remove set_stopped_child_used_math() in [x]fpregs_set 2010-02-23 13:45:27 -08:00
i8237.c
i8253.c x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown 2009-08-21 21:13:37 +02:00
i8259.c x86, pic: Fix section mismatch in legacy pic 2010-02-23 23:13:19 -08:00
init_task.c Use new __init_task_data macro in arch init_task.c files. 2009-09-21 06:27:08 +02:00
io_delay.c
ioport.c x86-64, paravirt: Call set_iopl_mask() on 64 bits 2009-12-09 16:54:08 -08:00
irq.c genirq: Convert irq_desc.lock to raw_spinlock 2009-12-14 23:55:33 +01:00
irq_32.c x86: Unify fixup_irqs() for 32-bit and 64-bit kernels 2009-11-02 15:56:34 +01:00
irq_64.c x86: Unify fixup_irqs() for 32-bit and 64-bit kernels 2009-11-02 15:56:34 +01:00
irqinit.c x86, legacy_irq: Remove left over nr_legacy_irqs 2010-02-24 11:01:34 -08:00
k8.c
kdebugfs.c
kgdb.c perf, hw_breakpoint, kgdb: Do not take mutex for kernel debugger 2010-01-30 08:42:21 +01:00
kprobes.c kprobes/x86: Support kprobes jump optimization on x86 2010-02-25 17:49:26 +01:00
kvm.c KVM guest: do not batch pte updates from interrupt context 2009-09-10 18:10:50 +03:00
kvmclock.c Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-09-18 14:05:47 -07:00
ldt.c cpumask: use mm_cpumask() wrapper: x86 2009-09-24 09:34:52 +09:30
machine_kexec_32.c Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-12-08 13:27:33 -08:00
machine_kexec_64.c hw-breakpoints: cleanup HW Breakpoint registers before kexec 2009-06-02 22:47:00 +02:00
mca_32.c
microcode_amd.c Revert "x86: ucode-amd: Load ucode-patches once ..." 2010-01-23 06:21:59 +01:00
microcode_core.c Revert "x86: ucode-amd: Load ucode-patches once ..." 2010-01-23 06:21:59 +01:00
microcode_intel.c x86: Remove trailing spaces in messages 2010-02-07 17:47:51 +01:00
mmconf-fam10h_64.c x86: Move range related operation to one file 2010-02-10 17:47:17 -08:00
module.c module: cleanup FIXME comments about trimming exception table entries. 2009-06-12 21:47:05 +09:30
mpparse.c x86, apic: Don't use logical-flat mode when CPU hotplug may exceed 8 CPUs 2010-02-09 20:51:11 -08:00
mrst.c x86, mrst: Platform clock setup code 2010-02-24 11:01:33 -08:00
msr.c x86, msr/cpuid: Pass the number of minors when unregistering MSR and CPUID drivers. 2010-01-26 23:52:38 -08:00
olpc.c x86, olpc: Use pci subarch init for OLPC 2010-02-25 19:26:23 -08:00
paravirt-spinlocks.c locking: Convert __raw_spin* functions to arch_spin* 2009-12-14 23:55:32 +01:00
paravirt.c x86, paravirt: Remove kmap_atomic_pte paravirt op. 2010-02-27 14:41:35 -08:00
paravirt_patch_32.c
paravirt_patch_64.c
pci-calgary_64.c iommu-helper: use bitmap library 2009-12-16 07:20:18 -08:00
pci-dma.c x86: Only call dma32_reserve_bootmem 64bit !CONFIG_NUMA 2010-02-10 17:47:18 -08:00
pci-gart_64.c iommu-helper: use bitmap library 2009-12-16 07:20:18 -08:00
pci-nommu.c x86: Kill bad_dma_address variable 2009-11-17 07:53:21 +01:00
pci-swiotlb.c x86: Split swiotlb initialization into two stages 2009-12-15 13:01:57 +01:00
pcspeaker.c
pmtimer_64.c
probe_roms_32.c
process.c Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-28 10:35:09 -08:00
process_32.c Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-28 10:35:09 -08:00
process_64.c Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-28 10:35:09 -08:00
ptrace.c Merge branch 'x86-ptrace-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-28 10:59:44 -08:00
pvclock.c x86: Fix warning in pvclock.c 2009-07-14 16:25:05 +02:00
quirks.c x86: Disable HPET MSI on ATI SB700/SB800 2010-01-23 06:21:58 +01:00
reboot.c x86: Add iMac9,1 to pci_reboot_dmi_table 2010-02-17 08:08:21 +01:00
reboot_fixups_32.c cs5535: move the DIVIL MSR definition into linux/cs5535.h 2009-12-15 08:53:28 -08:00
relocate_kernel_32.S
relocate_kernel_64.S
rtc.c Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-09-18 14:05:47 -07:00
scx200_32.c
setup.c Merge branch 'x86-bootmem-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-03 08:15:05 -08:00
setup_percpu.c early_res: Add free_early_partial() 2010-02-26 08:25:35 +01:00
sfi.c SFI: remove unneeded includes 2009-09-15 15:08:40 -04:00
signal.c x86: Merge sys_sigaltstack 2009-12-09 16:28:59 -08:00
smp.c Revert "x86, timers: Check for pending timers after (device) interrupts" 2009-10-09 15:58:20 +02:00
smpboot.c Merge branch 'x86-mrst-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-07 15:59:39 -08:00
stacktrace.c perf events, x86/stacktrace: Make stack walking optional 2009-12-17 09:56:19 +01:00
step.c x86: Use get_desc_base() 2009-07-19 18:27:51 +02:00
sys_i386_32.c Unify sys_mmap* 2009-12-11 06:44:29 -05:00
sys_x86_64.c Unify sys_mmap* 2009-12-11 06:44:29 -05:00
syscall_64.c
syscall_table_32.S Unify sys_mmap* 2009-12-11 06:44:29 -05:00
tboot.c x86, intel_txt: clean up the impact on generic code, unbreak non-x86 2009-09-01 18:25:07 -07:00
tce_64.c
test_nx.c
test_rodata.c
time.c x86: Convert i8259_lock to raw_spinlock 2010-02-16 18:21:32 +01:00
tlb_uv.c Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-12-08 13:27:33 -08:00
tls.c
tls.h
topology.c
trampoline.c x86: Use find_e820() instead of hard coded trampoline address 2009-12-11 09:28:22 +01:00
trampoline_32.S x86: cpuinit-annotate SMP boot trampolines properly 2009-09-20 20:23:37 +02:00
trampoline_64.S x86: Fix Suspend to RAM freeze on Acer Aspire 1511Lmi laptop 2009-10-12 18:06:48 +02:00
traps.c x86/debug: Clear reserved bits of DR6 in do_debug() 2010-01-29 02:26:10 +01:00
tsc.c Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-01 08:48:25 -08:00
tsc_sync.c locking: Convert __raw_spin* functions to arch_spin* 2009-12-14 23:55:32 +01:00
uv_irq.c x86, irq: Allow 0xff for /proc/irq/[n]/smp_affinity on an 8-cpu system 2009-12-17 22:03:06 -08:00
uv_sysfs.c x86: Remove trailing spaces in messages 2010-02-07 17:47:51 +01:00
uv_time.c x86, UV: Fix RTC latency bug by reading replicated cachelines 2010-01-27 11:33:53 +01:00
verify_cpu_64.S
visws_quirks.c Merge remote branch 'origin/x86/apic' into x86/mrst 2010-02-22 16:25:18 -08:00
vm86_32.c x86, 32-bit: Convert sys_vm86 & sys_vm86old 2009-12-09 16:29:23 -08:00
vmi_32.c x86, paravirt: Remove kmap_atomic_pte paravirt op. 2010-02-27 14:41:35 -08:00
vmiclock_32.c x86, irq: Don't block IRQ0_VECTOR..IRQ15_VECTOR's on all cpu's 2010-01-19 13:40:29 -08:00
vmlinux.lds.S Merge branch 'master' into percpu 2010-01-05 09:17:33 +09:00
vsmp_64.c
vsyscall_64.c x86: Raise vsyscall priority on hotplug notifier chain 2010-03-01 12:35:40 -03:00
x86_init.c Merge branch 'x86-mrst-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-07 15:59:39 -08:00
x8664_ksyms_64.c x86-64: Modify copy_user_generic() alternatives mechanism 2009-12-30 11:57:31 +01:00
xsave.c x86, ptrace: regset extensions to support xstate 2010-02-11 15:08:17 -08:00