android_kernel_xiaomi_sm8350/include/asm-ia64
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
..
sn [IA64] remove redundant local_irq_save() calls from sn_sal.h 2006-08-29 10:17:21 -07:00
a.out.h
acpi-ext.h
acpi.h
agp.h
asmmacro.h
atomic.h
auxvec.h
bitops.h
break.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
checksum.h
compat.h
cpu.h
cputime.h
current.h
cyclone.h
delay.h
div64.h
dma-mapping.h
dma.h
dmi.h
elf.h
emergency-restart.h
errno.h
esi.h
fcntl.h
fpswa.h
fpu.h
futex.h [IA64] Implement futex primitives 2006-09-26 14:00:56 -07:00
gcc_intrin.h
hardirq.h
hw_irq.h
ia32.h
ia64regs.h
ide.h
intel_intrin.h
intrinsics.h
io.h
ioctl.h
ioctls.h
iosapic.h
ipcbuf.h
irq_regs.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
irq.h
Kbuild [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00
kdebug.h
kmap_types.h
kprobes.h [IA64] kprobe opcode 16 bytes alignment on IA64 2006-09-26 11:20:37 -07:00
kregs.h
linkage.h
local.h
machvec_dig.h
machvec_hpsim.h
machvec_hpzx1_swiotlb.h
machvec_hpzx1.h
machvec_init.h
machvec_sn2.h [PATCH] msi: refactor and move the msi irq_chip into the arch code 2006-10-04 07:55:29 -07:00
machvec.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mc146818rtc.h
mca_asm.h [IA64] Make gp value point to Region 5 in mca handler 2006-09-26 14:13:03 -07:00
mca.h
meminit.h [PATCH] Have ia64 use add_active_range() and free_area_init_nodes 2006-09-27 08:26:11 -07:00
mman.h [PATCH] IA64,sparc: local DoS with corrupted ELFs 2006-09-08 08:40:46 -07:00
mmu_context.h
mmu.h
mmzone.h
module.h [PATCH] Move compiler check for modules to ia64 only 2006-09-26 10:52:37 +02:00
msgbuf.h
mutex.h
namei.h
nodedata.h
numa.h [PATCH] fix "cpu to node relationship fixup: map cpu to node" 2006-09-27 08:26:08 -07:00
page.h [PATCH] Fix 'make headers_check' on ia64 2006-09-16 12:54:32 -07:00
pal.h [IA64] PAL calls need physical mode, stacked 2006-09-26 15:21:11 -07:00
param.h
parport.h
patch.h
pci.h
percpu.h
perfmon_default_smpl.h
perfmon.h
pgalloc.h
pgtable.h [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
poll.h
posix_types.h
processor.h [IA64] Move perfmon tables from thread_struct to pfm_context 2006-09-26 12:03:13 -07:00
ptrace_offsets.h
ptrace.h [PATCH] Add regs_return_value() helper 2006-10-02 07:57:16 -07:00
resource.h
rse.h
rwsem.h
sal.h
scatterlist.h
sections.h
segment.h
semaphore.h
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-09-27 10:53:30 -07:00
socket.h
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h [PATCH] Directed yield: cpu_relax variants for spinlocks and rw-locks 2006-10-01 00:39:21 -07:00
stat.h
statfs.h
string.h
suspend.h
system.h [IA64] sparse cleanups 2006-08-02 16:03:44 -07:00
termbits.h
termios.h
thread_info.h
timex.h
tlb.h
tlbflush.h
topology.h [PATCH] sched: introduce child field in sched_domain 2006-10-03 08:04:06 -07:00
types.h
uaccess.h
ucontext.h
unaligned.h
uncached.h
unistd.h [PATCH] rename the provided execve functions to kernel_execve 2006-10-02 07:57:23 -07:00
unwind.h
user.h
ustack.h [PATCH] Fix 'make headers_check' on ia64 2006-09-16 12:54:32 -07:00
vga.h
xor.h