linux/arch/s390/kvm
Christian Borntraeger 46b708ea87 KVM: s390: use simple switch statement as multiplexer
We currently do some magic shifting (by exploiting that exit codes
are always a multiple of 4) and a table lookup to jump into the
exit handlers. This causes some calculations and checks, just to
do an potentially expensive function call.

Changing that to a switch statement gives the compiler the chance
to inline and dynamically decide between jump tables or inline
compare and branches. In addition it makes the code more readable.

bloat-o-meter gives me a small reduction in code size:

add/remove: 0/7 grow/shrink: 1/1 up/down: 986/-1334 (-348)
function                                     old     new   delta
kvm_handle_sie_intercept                      72    1058    +986
handle_prog                                  704     696      -8
handle_noop                                   54       -     -54
handle_partial_execution                      60       -     -60
intercept_funcs                              120       -    -120
handle_instruction                           198       -    -198
handle_validity                              210       -    -210
handle_stop                                  316       -    -316
handle_external_interrupt                    368       -    -368

Right now my gcc does conditional branches instead of jump tables.
The inlining seems to give us enough cycles as some micro-benchmarking
shows minimal improvements, but still in noise.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-10-29 15:59:11 +01:00
..
diag.c KVM: s390: add more debug data for the pfault diagnoses 2015-07-29 11:02:34 +02:00
gaccess.c KVM: s390: Add MEMOP ioctls for reading/writing guest memory 2015-03-17 16:26:24 +01:00
gaccess.h KVM: s390: Add MEMOP ioctls for reading/writing guest memory 2015-03-17 16:26:24 +01:00
guestdbg.c KVM: s390: filter space-switch events when PER is enforced 2015-07-29 10:36:22 +02:00
intercept.c KVM: s390: use simple switch statement as multiplexer 2015-10-29 15:59:11 +01:00
interrupt.c KVM: s390: factor out reading of the guest TOD clock 2015-10-13 15:50:35 +02:00
irq.h KVM: s390: irq routing for adapter interrupts. 2014-03-21 13:43:00 +01:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
kvm-s390.c KVM: s390: drop useless newline in debugging data 2015-10-29 15:58:54 +01:00
kvm-s390.h KVM: s390: factor out reading of the guest TOD clock 2015-10-13 15:50:35 +02:00
Makefile KVM: s390: hardware support for guest debugging 2014-04-22 13:24:51 +02:00
priv.c KVM: s390: factor out and fix setting of guest TOD clock 2015-10-13 15:50:35 +02:00
sigp.c KVM: s390: adapt debug entries for instruction handling 2015-07-29 11:02:35 +02:00
trace-s390.h KVM: s390: more irq names for trace events 2015-07-29 11:02:34 +02:00
trace.h KVM: s390: interpretive execution of SIGP EXTERNAL CALL 2014-05-16 14:57:28 +02:00