android_kernel_xiaomi_sm7250/arch/x86_64/kernel
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
..
acpi Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
cpufreq Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
aperture.c [PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1 2006-09-26 10:52:41 +02:00
apic.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
asm-offsets.c [CRYPTO] all: Pass tfm instead of ctx to algorithms 2006-06-26 17:34:39 +10:00
audit.c [PATCH] audit: AUDIT_PERM support 2006-09-11 13:32:30 -04:00
crash_dump.c [PATCH] kdump: read previous kernel's memory 2006-01-10 08:01:28 -08:00
crash.c [PATCH] Remove all ifdefs for local/io apic 2006-09-26 10:52:29 +02:00
e820.c [PATCH] Have x86_64 use add_active_range() and free_area_init_nodes 2006-09-27 08:26:11 -07:00
early_printk.c [PATCH] Convert x86-64 to early param 2006-09-26 10:52:32 +02:00
early-quirks.c [PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1 2006-09-26 10:52:41 +02:00
entry.S [PATCH] rename the provided execve functions to kernel_execve 2006-10-02 07:57:23 -07:00
functionlist [NET]: make skb_release_data() static 2006-06-29 16:58:30 -07:00
genapic_cluster.c [PATCH] remove int_delivery_dest 2006-09-26 10:52:31 +02:00
genapic_flat.c [PATCH] Replace local_save_flags+local_irq_disable with 2006-09-26 10:52:33 +02:00
genapic.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head64.c [PATCH] Remove need for early lockdep init 2006-09-26 10:52:32 +02:00
head.S [PATCH] Reload CS when startup_64 is used. 2006-09-26 10:52:38 +02:00
i387.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
i8259.c [PATCH] genirq: x86_64 irq: make vector_irq per cpu 2006-10-04 07:55:29 -07:00
init_task.c [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c 2006-10-02 07:57:20 -07:00
io_apic.c [PATCH] htirq: tidy up the htirq code 2006-10-04 07:55:30 -07:00
ioport.c [PATCH] x86-64 TIF flags for debug regs and io bitmap in ctxsw 2006-09-26 10:52:28 +02:00
irq.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
k8.c [PATCH] x86_64: Clean and enhance up K8 northbridge access code 2006-06-26 10:48:15 -07:00
kprobes.c [PATCH] kretprobe spinlock deadlock patch 2006-10-02 07:57:16 -07:00
ldt.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
machine_kexec.c [PATCH] Avoid overwriting the current pgd (V4, x86_64) 2006-09-26 10:52:38 +02:00
Makefile [PATCH] x86: Refactor thermal throttle processing 2006-09-26 10:52:42 +02:00
mce_amd.c [PATCH] cpu hotplug: use hotplug version of registration in late inits 2006-07-31 13:28:39 -07:00
mce_intel.c [PATCH] x86: Add a cumulative thermal throttle event counter. 2006-09-26 10:52:42 +02:00
mce.c [PATCH] x86: Refactor thermal throttle processing 2006-09-26 10:52:42 +02:00
module.c [PATCH] x86_64: x86_64 version of the smp alternative patch. 2006-06-26 10:48:14 -07:00
mpparse.c [PATCH] genirq: x86_64 irq: Kill irq compression 2006-10-04 07:55:29 -07:00
nmi.c [PATCH] x86: Clean up x86 NMI sysctls 2006-09-30 01:47:55 +02:00
pci-calgary.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
pci-dma.c [PATCH] Document iommu=panic 2006-09-30 01:47:55 +02:00
pci-gart.c [PATCH] remove superflous BUG_ON's in nommu and gart 2006-09-26 10:52:32 +02:00
pci-nommu.c [PATCH] remove superflous BUG_ON's in nommu and gart 2006-09-26 10:52:32 +02:00
pci-swiotlb.c [PATCH] Move valid_dma_direction() from x86_64 to generic code 2006-09-29 09:18:10 -07:00
pmtimer.c [PATCH] make pmtmr_ioport __read_mostly 2006-06-26 09:58:21 -07:00
process.c [PATCH] namespaces: utsname: use init_utsname when appropriate 2006-10-02 07:57:21 -07:00
ptrace.c [PATCH] i386/x86-64: rename is_at_popf(), add iret to tests and fix 2006-09-26 10:52:33 +02:00
reboot.c [PATCH] x86_64: Move export symbols to their C functions 2006-06-26 10:48:22 -07:00
relocate_kernel.S [PATCH] Avoid overwriting the current pgd (V4, x86_64) 2006-09-26 10:52:38 +02:00
setup64.c [PATCH] Don't leak NT bit into next task 2006-09-26 10:52:41 +02:00
setup.c [PATCH] Use ARRAY_SIZE in setup.c 2006-09-30 01:47:55 +02:00
signal.c [PATCH] Remove all traces of signal number conversion 2006-09-26 10:52:41 +02:00
smp.c [PATCH] Remove safe_smp_processor_id() 2006-09-26 10:52:37 +02:00
smpboot.c Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6 2006-09-26 13:07:55 -07:00
stacktrace.c [PATCH] Merge stacktrace and show_trace 2006-09-26 10:52:34 +02:00
suspend_asm.S [PATCH] Change the name of pagedir_nosave 2006-09-26 08:49:01 -07:00
suspend.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sys_x86_64.c [PATCH] namespaces: utsname: switch to using uts namespaces 2006-10-02 07:57:21 -07:00
syscall.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
tce.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
time.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
trampoline.S [PATCH] Fix gdt table size in trampoline.S 2006-09-26 10:52:32 +02:00
traps.c [PATCH] Don't use kernel_text_address in oops context 2006-09-26 10:52:38 +02:00
vmlinux.lds.S [PATCH] kill wall_jiffies 2006-10-01 00:39:27 -07:00
vsmp.c [PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1 2006-09-26 10:52:41 +02:00
vsyscall.c [PATCH] kill wall_jiffies 2006-10-01 00:39:27 -07:00
x8664_ksyms.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00