diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2016-02-18 04:15:43 -0500 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-06-21 03:43:45 -0400 |
commit | 94a15de8fb2667791d66c49610676ea2add90034 (patch) | |
tree | d1d82f6926c4ad126f48d23678f2a6ffea0a6b35 /arch | |
parent | adbf16985c387851fd3454ca34893705dbde7f98 (diff) |
KVM: s390: don't use CPUSTAT_WAIT to detect if a VCPU is idle
As we want to make use of CPUSTAT_WAIT also when a VCPU is not idle but
to force interception of external calls, let's check in the bitmap instead.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 2 | ||||
-rw-r--r-- | arch/s390/kvm/sigp.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index ffbbdd285385..031f451bb2cf 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h | |||
@@ -56,7 +56,7 @@ static inline int is_vcpu_stopped(struct kvm_vcpu *vcpu) | |||
56 | 56 | ||
57 | static inline int is_vcpu_idle(struct kvm_vcpu *vcpu) | 57 | static inline int is_vcpu_idle(struct kvm_vcpu *vcpu) |
58 | { | 58 | { |
59 | return atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_WAIT; | 59 | return test_bit(vcpu->vcpu_id, vcpu->arch.local_int.float_int->idle_mask); |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline int kvm_is_ucontrol(struct kvm *kvm) | 62 | static inline int kvm_is_ucontrol(struct kvm *kvm) |
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index 28ea0cab1f1b..1a252f537081 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
@@ -77,18 +77,18 @@ static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, | |||
77 | const u64 psw_int_mask = PSW_MASK_IO | PSW_MASK_EXT; | 77 | const u64 psw_int_mask = PSW_MASK_IO | PSW_MASK_EXT; |
78 | u16 p_asn, s_asn; | 78 | u16 p_asn, s_asn; |
79 | psw_t *psw; | 79 | psw_t *psw; |
80 | u32 flags; | 80 | bool idle; |
81 | 81 | ||
82 | flags = atomic_read(&dst_vcpu->arch.sie_block->cpuflags); | 82 | idle = is_vcpu_idle(vcpu); |
83 | psw = &dst_vcpu->arch.sie_block->gpsw; | 83 | psw = &dst_vcpu->arch.sie_block->gpsw; |
84 | p_asn = dst_vcpu->arch.sie_block->gcr[4] & 0xffff; /* Primary ASN */ | 84 | p_asn = dst_vcpu->arch.sie_block->gcr[4] & 0xffff; /* Primary ASN */ |
85 | s_asn = dst_vcpu->arch.sie_block->gcr[3] & 0xffff; /* Secondary ASN */ | 85 | s_asn = dst_vcpu->arch.sie_block->gcr[3] & 0xffff; /* Secondary ASN */ |
86 | 86 | ||
87 | /* Inject the emergency signal? */ | 87 | /* Inject the emergency signal? */ |
88 | if (!(flags & CPUSTAT_STOPPED) | 88 | if (!is_vcpu_stopped(vcpu) |
89 | || (psw->mask & psw_int_mask) != psw_int_mask | 89 | || (psw->mask & psw_int_mask) != psw_int_mask |
90 | || ((flags & CPUSTAT_WAIT) && psw->addr != 0) | 90 | || (idle && psw->addr != 0) |
91 | || (!(flags & CPUSTAT_WAIT) && (asn == p_asn || asn == s_asn))) { | 91 | || (!idle && (asn == p_asn || asn == s_asn))) { |
92 | return __inject_sigp_emergency(vcpu, dst_vcpu); | 92 | return __inject_sigp_emergency(vcpu, dst_vcpu); |
93 | } else { | 93 | } else { |
94 | *reg &= 0xffffffff00000000UL; | 94 | *reg &= 0xffffffff00000000UL; |