WSL2-Linux-Kernel/arch/powerpc/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
..
vdso32 [PATCH] vDSO hash-style fix 2006-07-31 13:28:43 -07:00
vdso64 [PATCH] vDSO hash-style fix 2006-07-31 13:28:43 -07:00
Makefile [POWERPC] convert string i/o operations to C 2006-09-20 14:06:18 +10:00
align.c
asm-offsets.c [POWERPC] Fix non-smp build 2006-09-14 10:36:11 +10:00
audit.c [PATCH] audit: AUDIT_PERM support 2006-09-11 13:32:30 -04:00
binfmt_elf32.c
btext.c [POWERPC] Constify & voidify get_property() 2006-07-31 15:55:04 +10:00
compat_audit.c [PATCH] audit: AUDIT_PERM support 2006-09-11 13:32:30 -04:00
cpu_setup_6xx.S
cpu_setup_ppc970.S Merge branch 'merge' 2006-08-25 14:56:07 +10:00
cputable.c [POWERPC] Add initial support for the e300c2 core 2006-10-04 15:24:27 +10:00
crash.c [POWERPC] Fix interrupt clearing in kdump shutdown sequence 2006-09-13 18:31:23 +10:00
crash_dump.c [POWERPC] Make doc comments extractable 2006-08-08 17:07:04 +10:00
dma_64.c [POWERPC] Simplify dma_ops bug conditions 2006-07-31 15:55:06 +10:00
entry_32.S
entry_64.S [POWERPC] implement BEGIN/END_FW_FTR_SECTION 2006-10-03 16:50:21 +10:00
firmware.c
fpu.S [POWERPC] Restore copyright notice in arch/powerpc/kernel/fpu.S 2006-08-30 14:45:35 +10:00
head_4xx.S
head_8xx.S
head_32.S
head_44x.S
head_64.S [POWERPC] implement BEGIN/END_FW_FTR_SECTION 2006-10-03 16:50:21 +10:00
head_booke.h
head_fsl_booke.S
ibmebus.c Merge branch 'merge' 2006-08-01 10:37:25 +10:00
idle.c
idle_6xx.S
idle_power4.S
init_task.c [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c 2006-10-02 07:57:20 -07:00
io.c [POWERPC] Merge iSeries i/o operations with the rest 2006-09-22 15:19:58 +10:00
iomap.c
iommu.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
irq.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
kprobes.c [PATCH] kretprobe spinlock deadlock patch 2006-10-02 07:57:16 -07:00
l2cr_6xx.S
legacy_serial.c Merge branch 'merge' 2006-08-25 14:56:07 +10:00
lparcfg.c [POWERPC] clean up pseries hcall interfaces 2006-08-01 16:19:15 +10:00
lparmap.c
machine_kexec.c [POWERPC] Move some kexec logic into machine_kexec.c 2006-08-17 16:41:10 +10:00
machine_kexec_32.c
machine_kexec_64.c Merge branch 'merge' 2006-08-25 14:56:07 +10:00
misc.S [POWERPC] convert string i/o operations to C 2006-09-20 14:06:18 +10:00
misc_32.S [PATCH] rename the provided execve functions to kernel_execve 2006-10-02 07:57:23 -07:00
misc_64.S IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
module_32.c
module_64.c
nvram_64.c
of_device.c [POWERPC] Remove linux,device properties 2006-07-07 20:19:16 +10:00
paca.c [POWERPC] Implement SLB shadow buffer 2006-08-08 17:08:56 +10:00
pci_32.c Merge branch 'merge' 2006-08-01 10:37:25 +10:00
pci_64.c [POWERPC] modify PCI code for a merged kernel 2006-09-25 13:35:09 +10:00
pci_direct_iommu.c
pci_dn.c [POWERPC] Constify & voidify get_property() 2006-07-31 15:55:04 +10:00
pci_iommu.c
perfmon_fsl_booke.c fix file specification in comments 2006-10-03 23:01:26 +02:00
pmc.c
ppc32.h
ppc_ksyms.c [POWERPC] convert string i/o operations to C 2006-09-20 14:06:18 +10:00
proc_ppc64.c
process.c [PATCH] namespaces: utsname: use init_utsname when appropriate 2006-10-02 07:57:21 -07:00
prom.c [POWERPC] Define of_read_ulong helper 2006-09-20 15:09:48 +10:00
prom_init.c Merge branch 'merge' 2006-08-31 15:45:48 +10:00
prom_parse.c Merge branch 'merge' 2006-08-31 15:45:48 +10:00
ptrace-common.h
ptrace.c [POWERPC] Fix PPC32 SECCOMP, unexport do_syscall_trace_{enter,leave} 2006-09-26 15:24:34 +10:00
ptrace32.c
rtas-proc.c [POWERPC] Constify & voidify get_property() 2006-07-31 15:55:04 +10:00
rtas-rtc.c
rtas.c [POWERPC] reboot when panic_timout is set 2006-08-25 13:30:26 +10:00
rtas_flash.c
rtas_pci.c [POWERPC] Add a helper for calculating RTAS "config_addr" parameters 2006-08-25 13:27:35 +10:00
semaphore.c
setup-common.c [POWERPC] Fix xmon=off and cleanup xmon initialisation 2006-10-04 14:52:22 +10:00
setup.h
setup_32.c [POWERPC] Fix xmon=off and cleanup xmon initialisation 2006-10-04 14:52:22 +10:00
setup_64.c [POWERPC] Fix xmon=off and cleanup xmon initialisation 2006-10-04 14:52:22 +10:00
signal_32.c
signal_64.c
smp-tbsync.c [POWERPC] Fix irq enable/disable in smp_generic_take_timebase 2006-08-30 16:10:47 +10:00
smp.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
swsusp_32.S [PATCH] Change the name of pagedir_nosave 2006-09-26 08:49:01 -07:00
sys_ppc32.c [PATCH] VFS: Make filldir_t and struct kstat deal in 64-bit inode numbers 2006-10-03 08:03:40 -07:00
syscalls.c [PATCH] namespaces: utsname: switch to using uts namespaces 2006-10-02 07:57:21 -07:00
sysfs.c [POWERPC] Always call cede in pseries dedicated idle loop 2006-09-26 15:24:34 +10:00
systbl.S
tau_6xx.c
time.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
traps.c [POWERPC] Emulate power5 popcntb instruction 2006-09-13 18:39:52 +10:00
udbg.c
udbg_16550.c [POWERPC] Fix default clock for udbg_16550 2006-07-26 01:27:13 +10:00
vdso.c
vecemu.c
vector.S
vio.c [POWERPC] Constify & voidify get_property() 2006-07-31 15:55:04 +10:00
vmlinux.lds.S [POWERPC] implement BEGIN/END_FW_FTR_SECTION 2006-10-03 16:50:21 +10:00