Re: [PATCH/RFC] KVM: track pid for VCPU only on KVM_RUN ioctl

Christian Borntraeger
2014-08-07T09:59:37Z

On 07/08/14 10:21, Raghavendra K T wrote:
> On 08/05/2014 08:14 PM, Christian Borntraeger wrote:
>> We currently track the pid of the task that runs the VCPU in
>> vcpu_load. Since we call vcpu_load for all kind of ioctls on a
>> CPU, this causes hickups due to synchronize_rcu if one CPU is
>> modified by another CPU or the main thread (e.g. initialization,
>> reset). We track the pid only for the purpose of yielding, so
>> let's update the pid only in the KVM_RUN ioctl.
>>
>> In addition, don't do a synchronize_rcu on startup (pid == 0).
>>
>> This speeds up guest boot time on s390 noticably for some configs, e.g.
>> HZ=100, no full state tracking, 64 guest cpus 32 host cpus.
>>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> CC: Rik van Riel <riel@redhat.com>
>> CC: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
>> CC: Michael Mueller <mimu@linux.vnet.ibm.com>
>> ---
>
> Please feel free to add
> Reviewed-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
>
> I could see very small improvement while testing 32 vcpu guest booting
> on x86 (16 pcpu host +ht).
>
> I was just wondering whether somebody implementing vcpu hot plug would
> have to bother about this change, but could not see any. What do you
> think?

The yield code can handle pid == 0, so the new CPU wont be a yield candidate until run for the first time. So I guess this is ok.

Paolo,

are you willing to apply to kvm/queue?

Christian