linux/arch/x86/kernel/cpu
Seiji Aguchi eddc0e922a x86, trace: Introduce entering/exiting_irq()
When implementing tracepoints in interrupt handers, if the tracepoints are
simply added in the performance sensitive path of interrupt handers,
it may cause potential performance problem due to the time penalty.

To solve the problem, an idea is to prepare non-trace/trace irq handers and
switch their IDTs at the enabling/disabling time.

So, let's introduce entering_irq()/exiting_irq() for pre/post-
processing of each irq handler.

A way to use them is as follows.

Non-trace irq handler:
smp_irq_handler()
{
	entering_irq();		/* pre-processing of this handler */
	__smp_irq_handler();	/*
				 * common logic between non-trace and trace handlers
				 * in a vector.
				 */
	exiting_irq();		/* post-processing of this handler */

}

Trace irq_handler:
smp_trace_irq_handler()
{
	entering_irq();		/* pre-processing of this handler */
	trace_irq_entry();	/* tracepoint for irq entry */
	__smp_irq_handler();	/*
				 * common logic between non-trace and trace handlers
				 * in a vector.
				 */
	trace_irq_exit();	/* tracepoint for irq exit */
	exiting_irq();		/* post-processing of this handler */

}

If tracepoints can place outside entering_irq()/exiting_irq() as follows,
it looks cleaner.

smp_trace_irq_handler()
{
	trace_irq_entry();
	smp_irq_handler();
	trace_irq_exit();
}

But it doesn't work.
The problem is with irq_enter/exit() being called. They must be called before
trace_irq_enter/exit(),  because of the rcu_irq_enter() must be called before
any tracepoints are used, as tracepoints use  rcu to synchronize.

As a possible alternative, we may be able to call irq_enter() first as follows
if irq_enter() can nest.

smp_trace_irq_hander()
{
	irq_entry();
	trace_irq_entry();
	smp_irq_handler();
	trace_irq_exit();
	irq_exit();
}

But it doesn't work, either.
If irq_enter() is nested, it may have a time penalty because it has to check if it
was already called or not. The time penalty is not desired in performance sensitive
paths even if it is tiny.

Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Link: http://lkml.kernel.org/r/51C3238D.9040706@hds.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
2013-06-20 22:25:01 -07:00
..
mcheck x86, trace: Introduce entering/exiting_irq() 2013-06-20 22:25:01 -07:00
mtrr taint: add explicit flag to show whether lock dep is still OK. 2013-01-21 17:17:57 +10:30
.gitignore
Makefile Merge branch 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-04-30 08:41:21 -07:00
amd.c x86, CPU, AMD: Drop useless label 2013-04-16 11:50:51 +02:00
bugs.c x86: Fold-in trivial check_config function 2013-04-16 11:50:50 +02:00
bugs_64.c x86/cpu: Clean up various files a bit 2009-07-11 11:24:09 +02:00
centaur.c x86, centaur: Enable cx8 for VIA Eden too 2011-12-15 08:04:42 -08:00
common.c x86, cpu: Expand cpufeature facility to include cpu bugs 2013-04-02 10:12:52 -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, cpu: Convert Cyrix coma bug detection 2013-04-02 10:12:54 -07:00
hypervisor.c x86/apic: Allow x2apic without IR on VMware platform 2013-01-24 13:11:18 +01:00
intel.c Merge branch 'x86-kaslr-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-04-30 08:37:24 -07:00
intel_cacheinfo.c Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-02-19 20:09:48 -08: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, hyperv: Handle Xen emulation of Hyper-V more gracefully 2013-04-18 08:59:20 -07:00
perf_event.c perf/x86: Check all MSRs before passing hw check 2013-04-21 11:16:29 +02:00
perf_event.h perf/x86: Add support for PEBS Precise Store 2013-04-01 12:17:06 -03:00
perf_event_amd.c perf/x86/amd: Remove old-style NB counter support from perf_event_amd.c 2013-04-21 17:21:59 +02:00
perf_event_amd_ibs.c treewide: Replace incomming with incoming in all comments and strings 2013-01-03 16:15:49 +01:00
perf_event_amd_uncore.c perf/x86/amd: Fix AMD NB and L2I "uncore" support 2013-04-22 10:10:55 +02:00
perf_event_intel.c Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-05-05 11:37:16 -07:00
perf_event_intel_ds.c Merge branch 'perf/urgent' into perf/core 2013-04-21 10:57:33 +02:00
perf_event_intel_lbr.c perf/x86/intel/lbr: Demand proper privileges for PERF_SAMPLE_BRANCH_KERNEL 2013-05-05 10:58:11 +02:00
perf_event_intel_uncore.c Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-05-05 11:37:16 -07:00
perf_event_intel_uncore.h perf/x86/intel: Add Ivy Bridge-EP uncore support 2013-04-21 11:01:24 +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
perfctr-watchdog.c perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU 2012-10-04 13:32:37 +02:00
powerflags.c x86: Report cpb and eff_freq_ro flags correctly 2011-12-15 08:14:49 +01:00
proc.c x86, cpu: Convert Cyrix coma bug detection 2013-04-02 10:12:54 -07:00
rdrand.c x86, random: Verify RDRAND functionality and allow it to be disabled 2011-07-31 14:02:19 -07:00
scattered.c cpufreq: AMD "frequency sensitivity feedback" powersave bias for ondemand governor 2013-04-10 13:19:26 +02:00
topology.c x86, cpu: Split addon_cpuid_features.c 2010-07-19 19:02:41 -07:00
transmeta.c x86, cpu: mv display_cacheinfo -> cpu_detect_cache_sizes 2009-11-23 11:59:53 -08:00
umc.c
vmware.c x86/apic: Allow x2apic without IR on VMware platform 2013-01-24 13:11:18 +01:00