Re: [PATCH 1/1] KVM: s390: index kvm->arch.idle_mask by vcpu_idx

From: Christian Borntraeger
Date: Sun Aug 29 2021 - 02:25:26 EST




On 27.08.21 23:23, Halil Pasic wrote:
On Fri, 27 Aug 2021 18:36:48 +0200
Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote:

On 27.08.21 16:06, Claudio Imbrenda wrote:
On Fri, 27 Aug 2021 14:54:29 +0200
Halil Pasic <pasic@xxxxxxxxxxxxx> wrote:
While in practice vcpu->vcpu_idx == vcpu->vcp_id is often true,

s/vcp_id/vcpu_id/

it may not always be, and we must not rely on this.

why?

maybe add a simple explanation of why vcpu_idx and vcpu_id can be
different, namely:
KVM decides the vcpu_idx, userspace decides the vcpu_id, thus the two
might not match

Currently kvm->arch.idle_mask is indexed by vcpu_id, which implies
that code like
for_each_set_bit(vcpu_id, kvm->arch.idle_mask, online_vcpus) {
vcpu = kvm_get_vcpu(kvm, vcpu_id);

you can also add a sentence to clarify that kvm_get_vcpu expects an
vcpu_idx, not an vcpu_id.
do_stuff(vcpu);

I will modify the patch description accordingly before sending to Paolo.
Thanks for noticing.

Can you also please fix the typo I pointed out above (in the first line
of the long description).

I already queued, but I think this is not a big deal.