linux/arch/x86/kernel/cpu
Peter Zijlstra e8a923cc1f perf/x86: Fix NMI measurements
OK, so what I'm actually seeing on my WSM is that sched/clock.c is
'broken' for the purpose we're using it for.

What triggered it is that my WSM-EP is broken :-(

  [    0.001000] tsc: Fast TSC calibration using PIT
  [    0.002000] tsc: Detected 2533.715 MHz processor
  [    0.500180] TSC synchronization [CPU#0 -> CPU#6]:
  [    0.505197] Measured 3 cycles TSC warp between CPUs, turning off TSC clock.
  [    0.004000] tsc: Marking TSC unstable due to check_tsc_sync_source failed

For some reason it consistently detects TSC skew, even though NHM+
should have a single clock domain for 'reasonable' systems.

This marks sched_clock_stable=0, which means that we do fancy stuff to
try and get a 'sane' clock. Part of this fancy stuff relies on the tick,
clearly that's gone when NOHZ=y. So for idle cpus time gets stuck, until
it either wakes up or gets kicked by another cpu.

While this is perfectly fine for the scheduler -- it only cares about
actually running stuff, and when we're running stuff we're obviously not
idle. This does somewhat break down for perf which can trigger events
just fine on an otherwise idle cpu.

So I've got NMIs get get 'measured' as taking ~1ms, which actually
don't last nearly that long:

          <idle>-0     [013] d.h.   886.311970: rcu_nmi_enter <-do_nmi
  ...
          <idle>-0     [013] d.h.   886.311997: perf_sample_event_took: HERE!!! : 1040990

So ftrace (which uses sched_clock(), not the fancy bits) only sees
~27us, but we measure ~1ms !!

Now since all this measurement stuff lives in x86 code, we can actually
fix it.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@kernel.org
Cc: dave.hansen@linux.intel.com
Cc: eranian@google.com
Cc: Don Zickus <dzickus@redhat.com>
Cc: jmario@redhat.com
Cc: acme@infradead.org
Link: http://lkml.kernel.org/r/20131017133350.GG3364@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-10-29 12:01:20 +01:00
..
mcheck Bit 12 may or may not be set in MCi_STATUS.MCACOD when 2013-08-12 19:51:43 +02:00
mtrr mm: vmstats: track TLB flush stats on UP too 2013-09-11 15:57:09 -07:00
.gitignore
amd.c Merge branch 'x86-asmlinkage-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-09-04 08:42:44 -07:00
bugs_64.c
bugs.c x86: Get rid of ->hard_math and all the FPU asm fu 2013-06-06 14:32:04 -07:00
centaur.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
common.c x86, asmlinkage: Make several variables used from assembler/linker script visible 2013-08-06 14:20:13 -07:00
cpu.h x86/tlb_info: get last level TLB entry number of CPU 2012-06-27 19:28:24 -07:00
cyrix.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
hypervisor.c x86: Correctly detect hypervisor 2013-08-05 06:35:33 -07:00
intel_cacheinfo.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
intel.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
Makefile perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation 2013-06-19 13:04:53 +02:00
match.c x86: Fix typo in MODULE_DEVICE_TABLE example: s/x86_cpu/x86cpu/ 2012-04-16 14:20:19 +02:00
mkcapflags.sh mkcapflags.pl: convert to mkcapflags.sh 2013-04-29 15:54:27 -07:00
mshyperv.c x86: Correctly detect hypervisor 2013-08-05 06:35:33 -07:00
perf_event_amd_ibs.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
perf_event_amd_iommu.c perf/x86/amd: Do not print an error when the device is not present 2013-07-05 08:27:15 +02:00
perf_event_amd_iommu.h perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation 2013-06-19 13:04:53 +02:00
perf_event_amd_uncore.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
perf_event_amd.c perf: Convert kmalloc_node(...GFP_ZERO...) to kzalloc_node() 2013-09-02 08:42:49 +02:00
perf_event_intel_ds.c Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-09-18 11:26:17 -05:00
perf_event_intel_lbr.c perf/x86/intel: Support Haswell/v4 LBR format 2013-06-19 14:43:35 +02:00
perf_event_intel_uncore.c perf/x86/intel/uncore: Don't use smp_processor_id() in validate_group() 2013-09-20 06:54:36 +02:00
perf_event_intel_uncore.h perf/x86/intel/uncore: Enable EV_SEL_EXT bit for PCU 2013-08-16 17:55:50 +02:00
perf_event_intel.c perf/x86/intel: Add model number for Avoton Silvermont 2013-09-23 10:22:00 +02:00
perf_event_knc.c x86: Constify a few items 2013-03-11 15:11:03 +01:00
perf_event_p4.c perf/x86/intel/P4: Robistify P4 PMU types 2013-04-26 09:31:41 +02:00
perf_event_p6.c x86: Constify a few items 2013-03-11 15:11:03 +01:00
perf_event.c perf/x86: Fix NMI measurements 2013-10-29 12:01:20 +01:00
perf_event.h perf/x86: Add Silvermont (22nm Atom) support 2013-09-02 08:42:47 +02:00
perfctr-watchdog.c perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU 2012-10-04 13:32:37 +02:00
powerflags.c update AMD powerflags comments 2013-05-28 12:02:10 +02:00
proc.c x86: Get rid of ->hard_math and all the FPU asm fu 2013-06-06 14:32:04 -07:00
rdrand.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
scattered.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
topology.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
transmeta.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
umc.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
vmware.c x86: Correctly detect hypervisor 2013-08-05 06:35:33 -07:00