public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* kvm-s390: Dont exit SIE on SIGP sense running
@ 2010-06-17 21:16 Christian Borntraeger
  2010-06-21  8:27 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2010-06-17 21:16 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti
  Cc: kvm, Heiko Carstens, Martin Schwidefsky, Carsten Otte

Avi, Marcello,

Newer (guest) kernels use sigp sense running in their spinlock
implementation to check if the other cpu is running before yielding
the processor. This revealed some wrong guest settings, causing
unnecessary exits for every sigp sense running.
 
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

---
 arch/s390/include/asm/kvm_host.h |    2 +-
 arch/s390/kvm/kvm-s390.c         |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Index: kvm/arch/s390/include/asm/kvm_host.h
===================================================================
--- kvm.orig/arch/s390/include/asm/kvm_host.h
+++ kvm/arch/s390/include/asm/kvm_host.h
@@ -26,7 +26,7 @@
 
 struct sca_entry {
 	atomic_t scn;
-	__u64	reserved;
+	__u32	reserved;
 	__u64	sda;
 	__u64	reserved2[2];
 } __attribute__((packed));
Index: kvm/arch/s390/kvm/kvm-s390.c
===================================================================
--- kvm.orig/arch/s390/kvm/kvm-s390.c
+++ kvm/arch/s390/kvm/kvm-s390.c
@@ -207,6 +207,7 @@ out_nokvm:
 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
 {
 	VCPU_EVENT(vcpu, 3, "%s", "free cpu");
+	clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn);
 	if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
 		(__u64) vcpu->arch.sie_block)
 		vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
@@ -296,7 +297,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu 
 {
 	atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH);
 	set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests);
-	vcpu->arch.sie_block->ecb   = 2;
+	vcpu->arch.sie_block->ecb   = 6;
 	vcpu->arch.sie_block->eca   = 0xC1002001U;
 	vcpu->arch.sie_block->fac   = (int) (long) facilities;
 	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
@@ -329,6 +330,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st
 		kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block;
 	vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32);
 	vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca;
+	set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn);
 
 	spin_lock_init(&vcpu->arch.local_int.lock);
 	INIT_LIST_HEAD(&vcpu->arch.local_int.list);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kvm-s390: Dont exit SIE on SIGP sense running
  2010-06-17 21:16 kvm-s390: Dont exit SIE on SIGP sense running Christian Borntraeger
@ 2010-06-21  8:27 ` Avi Kivity
  2010-06-21 10:15   ` Christian Borntraeger
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2010-06-21  8:27 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Marcelo Tosatti, kvm, Heiko Carstens, Martin Schwidefsky,
	Carsten Otte

On 06/18/2010 12:16 AM, Christian Borntraeger wrote:
> Avi, Marcello,
>
> Newer (guest) kernels use sigp sense running in their spinlock
> implementation to check if the other cpu is running before yielding
> the processor. This revealed some wrong guest settings, causing
> unnecessary exits for every sigp sense running.
>    

Applied, thanks.

>   void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
>   {
>   	VCPU_EVENT(vcpu, 3, "%s", "free cpu");
> +	clear_bit(63 - vcpu->vcpu_id, (unsigned long *)&vcpu->kvm->arch.sca->mcn);
>   	if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
>   		(__u64) vcpu->arch.sie_block)
>   		vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
>    

Unrelated, do these VCPU_EVENTs want to become ftrace tracepoints?

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kvm-s390: Dont exit SIE on SIGP sense running
  2010-06-21  8:27 ` Avi Kivity
@ 2010-06-21 10:15   ` Christian Borntraeger
  2010-06-21 10:26     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2010-06-21 10:15 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Marcelo Tosatti, kvm, Heiko Carstens, Martin Schwidefsky,
	Carsten Otte

Am Montag 21 Juni 2010, 10:27:50 schrieb Avi Kivity:
[...]
> >   	VCPU_EVENT(vcpu, 3, "%s", "free cpu");
> > +	clear_bit(63 - vcpu->vcpu_id, (unsigned long *)&vcpu->kvm->arch.sca->mcn);
> >   	if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
> >   		(__u64) vcpu->arch.sie_block)
> >   		vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
> >    
> 
> Unrelated, do these VCPU_EVENTs want to become ftrace tracepoints?
> 
> 

Hmm, dont know. Currently this calls into a s390 debug tracing facility
(arch/s390/kernel/debug.c) which is heavily used by our service folks.
There are commands for crash and lcrash to show these s390 debug traces
from a dump.

Maybe its worth to investigate if we should change some of these events to
have both ftrace-tracepoints and the debug traces.

Christian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kvm-s390: Dont exit SIE on SIGP sense running
  2010-06-21 10:15   ` Christian Borntraeger
@ 2010-06-21 10:26     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2010-06-21 10:26 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Avi Kivity, Marcelo Tosatti, kvm, Heiko Carstens,
	Martin Schwidefsky, Carsten Otte

On Monday 21 June 2010, Christian Borntraeger wrote:
> Hmm, dont know. Currently this calls into a s390 debug tracing facility
> (arch/s390/kernel/debug.c) which is heavily used by our service folks.
> There are commands for crash and lcrash to show these s390 debug traces
> from a dump.
> 
> Maybe its worth to investigate if we should change some of these events to
> have both ftrace-tracepoints and the debug traces.

I think that it would be worthwhile to convert the entire s390 debug
code to become tracepoints, either one by one or making it a subclass
with the existing interfaces.

	Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-21 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-17 21:16 kvm-s390: Dont exit SIE on SIGP sense running Christian Borntraeger
2010-06-21  8:27 ` Avi Kivity
2010-06-21 10:15   ` Christian Borntraeger
2010-06-21 10:26     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox