From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH 2/4] KVM: s390: fix wrong lookup of VCPUs by array index Date: Thu, 19 Nov 2015 09:52:31 +0100 Message-ID: <564D8DCF.4090409@de.ibm.com> References: <1447922251-54261-1-git-send-email-borntraeger@de.ibm.com> <1447922251-54261-3-git-send-email-borntraeger@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: KVM , Cornelia Huck , Jens Freimann , linux-s390 , kvm-ppc@vger.kernel.org To: Paolo Bonzini , Alexander Graf , Paul Mackerras , David Hildenbrand Return-path: Received: from e06smtp09.uk.ibm.com ([195.75.94.105]:49971 "EHLO e06smtp09.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756138AbbKSIwh (ORCPT ); Thu, 19 Nov 2015 03:52:37 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Nov 2015 08:52:36 -0000 In-Reply-To: <1447922251-54261-3-git-send-email-borntraeger@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Sigh. Seems that my mail script got confused by the # after stable. So please strip down the cc list. On 11/19/2015 09:37 AM, Christian Borntraeger wrote: > From: David Hildenbrand > > For now, VCPUs were always created sequentially with incrementing > VCPU ids. Therefore, the index in the VCPUs array matched the id. > > As sequential creation might change with cpu hotplug, let's use > the correct lookup function to find a VCPU by id, not array index. > > Reviewed-by: Christian Borntraeger > Signed-off-by: David Hildenbrand > Signed-off-by: Christian Borntraeger > [split stable/non-stable parts] > Cc: stable@vger.kernel.org # c3853a8: KVM: Provide function for VCPU lookup by id > --- > arch/s390/kvm/sigp.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c > index da690b6..081dbd0 100644 > --- a/arch/s390/kvm/sigp.c > +++ b/arch/s390/kvm/sigp.c > @@ -291,12 +291,8 @@ static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code, > u16 cpu_addr, u32 parameter, u64 *status_reg) > { > int rc; > - struct kvm_vcpu *dst_vcpu; > + struct kvm_vcpu *dst_vcpu = kvm_lookup_vcpu(vcpu->kvm, cpu_addr); > > - if (cpu_addr >= KVM_MAX_VCPUS) > - return SIGP_CC_NOT_OPERATIONAL; > - > - dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); > if (!dst_vcpu) > return SIGP_CC_NOT_OPERATIONAL; > > @@ -478,7 +474,7 @@ int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu) > trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); > > if (order_code == SIGP_EXTERNAL_CALL) { > - dest_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); > + dest_vcpu = kvm_lookup_vcpu(vcpu->kvm, cpu_addr); > BUG_ON(dest_vcpu == NULL); > > kvm_s390_vcpu_wakeup(dest_vcpu); >