KVM: s390: fix bug in sigp emergency signal injection
authorJens Freimann <jfrei@linux.vnet.ibm.com>
Thu, 18 Dec 2014 14:48:14 +0000 (15:48 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 23 Jan 2015 12:25:39 +0000 (13:25 +0100)
Currently we are always setting the wrong bit in the
bitmap for pending emergency signals. Instead of using
emerg.code from the passed in irq parameter, we use the
value in our per-vcpu local_int structure, which is always zero.
That means all emergency signals will have address 0 as parameter.
If two CPUs send a SIGP to the same target, one might be lost.

Let's fix this by using the value from the parameter and
also trace the correct value.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/interrupt.c

index 8ebae298a24d60edcd0bec1593cc0c04e333e64d..eb5fb66380e3ac1cdbb241b77af70897a8d9b6d1 100644 (file)
@@ -1103,14 +1103,13 @@ static int __inject_sigp_emergency(struct kvm_vcpu *vcpu,
                                   struct kvm_s390_irq *irq)
 {
        struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
-       struct kvm_s390_emerg_info *emerg = &li->irq.emerg;
 
        VCPU_EVENT(vcpu, 3, "inject: emergency %u\n",
                   irq->u.emerg.code);
        trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_EMERGENCY,
-                                  emerg->code, 0, 2);
+                                  irq->u.emerg.code, 0, 2);
 
-       set_bit(emerg->code, li->sigp_emerg_pending);
+       set_bit(irq->u.emerg.code, li->sigp_emerg_pending);
        set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs);
        atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
        return 0;