aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2014-08-05 11:40:47 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2015-01-23 07:25:34 -0500
commit9a022067ad75b117f1c1e5cbf6a592022cf0a749 (patch)
treef73884c87fe971a52c6f6966a20d8be695f13486
parent6cddd432e3da5e25eccbc13844d03c871674a62e (diff)
KVM: s390: a VCPU may only stop when no interrupts are left pending
As a SIGP STOP is an interrupt with the least priority, it may only result in stop of the vcpu when no other interrupts are left pending. To detect whether a non-stop irq is pending, we need a way to mask out stop irqs from the general kvm_cpu_has_interrupt() function. For this reason, the existing function (with an outdated name) is replaced by kvm_s390_vcpu_has_irq() which allows to mask out pending stop irqs. Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--arch/s390/kvm/intercept.c4
-rw-r--r--arch/s390/kvm/interrupt.c4
-rw-r--r--arch/s390/kvm/kvm-s390.c4
-rw-r--r--arch/s390/kvm/kvm-s390.h2
4 files changed, 9 insertions, 5 deletions
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 08e01acc13c3..897669454fb0 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -74,6 +74,10 @@ static int handle_stop(struct kvm_vcpu *vcpu)
74 74
75 vcpu->stat.exit_stop_request++; 75 vcpu->stat.exit_stop_request++;
76 76
77 /* delay the stop if any non-stop irq is pending */
78 if (kvm_s390_vcpu_has_irq(vcpu, 1))
79 return 0;
80
77 /* avoid races with the injection/SIGP STOP code */ 81 /* avoid races with the injection/SIGP STOP code */
78 spin_lock(&li->lock); 82 spin_lock(&li->lock);
79 flags = li->irq.stop.flags; 83 flags = li->irq.stop.flags;
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 18721886eb05..f753c0bf9604 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -749,7 +749,7 @@ int kvm_s390_si_ext_call_pending(struct kvm_vcpu *vcpu)
749 return 0; 749 return 0;
750} 750}
751 751
752int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu) 752int kvm_s390_vcpu_has_irq(struct kvm_vcpu *vcpu, int exclude_stop)
753{ 753{
754 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int; 754 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
755 struct kvm_s390_interrupt_info *inti; 755 struct kvm_s390_interrupt_info *inti;
@@ -773,7 +773,7 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
773 if (!rc && kvm_s390_si_ext_call_pending(vcpu)) 773 if (!rc && kvm_s390_si_ext_call_pending(vcpu))
774 rc = 1; 774 rc = 1;
775 775
776 if (!rc && kvm_s390_is_stop_irq_pending(vcpu)) 776 if (!rc && !exclude_stop && kvm_s390_is_stop_irq_pending(vcpu))
777 rc = 1; 777 rc = 1;
778 778
779 return rc; 779 return rc;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index b987b5674625..6a5ed333628c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -806,7 +806,7 @@ out:
806 806
807int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 807int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
808{ 808{
809 return kvm_cpu_has_interrupt(vcpu); 809 return kvm_s390_vcpu_has_irq(vcpu, 0);
810} 810}
811 811
812void s390_vcpu_block(struct kvm_vcpu *vcpu) 812void s390_vcpu_block(struct kvm_vcpu *vcpu)
@@ -1241,7 +1241,7 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu)
1241 return 0; 1241 return 0;
1242 if (psw_extint_disabled(vcpu)) 1242 if (psw_extint_disabled(vcpu))
1243 return 0; 1243 return 0;
1244 if (kvm_cpu_has_interrupt(vcpu)) 1244 if (kvm_s390_vcpu_has_irq(vcpu, 0))
1245 return 0; 1245 return 0;
1246 if (!(vcpu->arch.sie_block->gcr[0] & 0x200ul)) 1246 if (!(vcpu->arch.sie_block->gcr[0] & 0x200ul))
1247 return 0; 1247 return 0;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index d72ff624920e..2becffef6b61 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -228,7 +228,7 @@ int s390int_to_s390irq(struct kvm_s390_interrupt *s390int,
228 struct kvm_s390_irq *s390irq); 228 struct kvm_s390_irq *s390irq);
229 229
230/* implemented in interrupt.c */ 230/* implemented in interrupt.c */
231int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu); 231int kvm_s390_vcpu_has_irq(struct kvm_vcpu *vcpu, int exclude_stop);
232int psw_extint_disabled(struct kvm_vcpu *vcpu); 232int psw_extint_disabled(struct kvm_vcpu *vcpu);
233void kvm_s390_destroy_adapters(struct kvm *kvm); 233void kvm_s390_destroy_adapters(struct kvm *kvm);
234int kvm_s390_si_ext_call_pending(struct kvm_vcpu *vcpu); 234int kvm_s390_si_ext_call_pending(struct kvm_vcpu *vcpu);