Message ID | 20211105192101.3862492-4-maz@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | KVM: Turn the vcpu array into an xarray | expand |
On Fri, 5 Nov 2021 19:20:59 +0000 Marc Zyngier <maz@kernel.org> wrote: > As we are about to change the way vcpus are allocated, mandate > the use of kvm_get_vcpu() instead of open-coding the access. > > Signed-off-by: Marc Zyngier <maz@kernel.org> makes sense Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > arch/s390/kvm/kvm-s390.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index 7af53b8788fa..4a0f62b03964 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -4572,7 +4572,7 @@ int kvm_s390_vcpu_start(struct kvm_vcpu *vcpu) > } > > for (i = 0; i < online_vcpus; i++) { > - if (!is_vcpu_stopped(vcpu->kvm->vcpus[i])) > + if (!is_vcpu_stopped(kvm_get_vcpu(vcpu->kvm, i))) > started_vcpus++; > } > > @@ -4634,9 +4634,11 @@ int kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu) > __disable_ibs_on_vcpu(vcpu); > > for (i = 0; i < online_vcpus; i++) { > - if (!is_vcpu_stopped(vcpu->kvm->vcpus[i])) { > + struct kvm_vcpu *tmp = kvm_get_vcpu(vcpu->kvm, i); > + > + if (!is_vcpu_stopped(tmp)) { > started_vcpus++; > - started_vcpu = vcpu->kvm->vcpus[i]; > + started_vcpu = tmp; > } > } >
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 7af53b8788fa..4a0f62b03964 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -4572,7 +4572,7 @@ int kvm_s390_vcpu_start(struct kvm_vcpu *vcpu) } for (i = 0; i < online_vcpus; i++) { - if (!is_vcpu_stopped(vcpu->kvm->vcpus[i])) + if (!is_vcpu_stopped(kvm_get_vcpu(vcpu->kvm, i))) started_vcpus++; } @@ -4634,9 +4634,11 @@ int kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu) __disable_ibs_on_vcpu(vcpu); for (i = 0; i < online_vcpus; i++) { - if (!is_vcpu_stopped(vcpu->kvm->vcpus[i])) { + struct kvm_vcpu *tmp = kvm_get_vcpu(vcpu->kvm, i); + + if (!is_vcpu_stopped(tmp)) { started_vcpus++; - started_vcpu = vcpu->kvm->vcpus[i]; + started_vcpu = tmp; } }
As we are about to change the way vcpus are allocated, mandate the use of kvm_get_vcpu() instead of open-coding the access. Signed-off-by: Marc Zyngier <maz@kernel.org> --- arch/s390/kvm/kvm-s390.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)