linux/arch/s390/kvm
Frederic Weisbecker b080935c86 kvm: Directly account vtime to system on guest switch
Switching to or from guest context is done on ioctl context.
So by the time we call kvm_guest_enter() or kvm_guest_exit()
we know we are not running the idle task.

As a result, we can directly account the cputime using
vtime_account_system().

There are two good reasons to do this:

* We avoid some useless checks on guest switch. It optimizes
a bit this fast path.

* In the case of CONFIG_IRQ_TIME_ACCOUNTING, calling vtime_account()
checks for irq time to account. This is pointless since we know
we are not in an irq on guest switch. This is wasting cpu cycles
for no good reason. vtime_account_system() OTOH is a no-op in
this config option.

* We can remove the irq disable/enable around kvm guest switch in s390.

A further optimization may consist in introducing a vtime_account_guest()
that directly calls account_guest_time().

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Xiantao Zhang <xiantao.zhang@intel.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
2012-10-29 21:31:31 +01:00
..
diag.c KVM: s390: Add implementation-specific trace events 2012-07-26 14:04:35 +03:00
gaccess.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
intercept.c KVM: s390: Add implementation-specific trace events 2012-07-26 14:04:35 +03:00
interrupt.c KVM: s390: Fix vcpu_load handling in interrupt code 2012-09-27 18:19:53 +02:00
Kconfig KVM updates for the 3.7 merge window 2012-10-04 09:30:33 -07:00
kvm-s390.c kvm: Directly account vtime to system on guest switch 2012-10-29 21:31:31 +01:00
kvm-s390.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
Makefile [S390] move sie code to entry.S 2011-07-24 10:48:21 +02:00
priv.c KVM updates for the 3.7 merge window 2012-10-04 09:30:33 -07:00
sigp.c KVM: s390: Add architectural trace events 2012-07-26 14:04:34 +03:00
trace-s390.h KVM: s390: Add implementation-specific trace events 2012-07-26 14:04:35 +03:00
trace.h KVM: s390: Add architectural trace events 2012-07-26 14:04:34 +03:00