Re: [PATCH v6] kvm: make vcpu life cycle separated from kvm instance

From: Liu ping fan
Date: Wed Dec 28 2011 - 01:55:18 EST


2011/12/27 Takuya Yoshikawa <yoshikawa.takuya@xxxxxxxxxxxxx>:
> (2011/12/27 17:38), Liu Ping Fan wrote:
>> From: Liu Ping Fan<pingfank@xxxxxxxxxxxxxxxxxx>
>>
>> Currently, vcpu can be destructed only when kvm instance destroyed.
>> Change this to vcpu's destruction before kvm instance, so vcpu MUST
>> and CAN be destroyed before kvm's destroy.
>
> I really don't understand why this big change can be justified by only
> 3 lines.
>
I think just recording what this patch does, not the whole story about
it. Right?
>>
>> Signed-off-by: Liu Ping Fan<pingfank@xxxxxxxxxxxxxxxxxx>
>> ---
>>  arch/x86/kvm/i8254.c   |  10 +++--
>>  arch/x86/kvm/i8259.c   |  17 +++++--
>>  arch/x86/kvm/x86.c    |  53 +++++++++++-----------
>> Â include/linux/kvm_host.h | Â 20 +++-----
>>  virt/kvm/irq_comm.c   Â|  Â6 ++-
>>  virt/kvm/kvm_main.c   Â| Â110 +++++++++++++++++++++++++++++++++++-----------
>> Â 6 files changed, 140 insertions(+), 76 deletions(-)
>>
>
> You are introducing kvm_arch_vcpu_zap().
>
> Then, apart from the "zap" naming issue I mentioned last time,
Yes, I will correct "zap", as you said, its meaning is quite different
from destroy. :-)

> what about other architectures than x86?
>
Have not considered it in detail yet. At first step, I just want to
figure out the whole frame, then, I will push them on other arch.
Maybe you foresee some problem when extending this onto other arch,
please tell me, thanks ï-).
>
>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>> index 900c763..b88d418d 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -117,6 +117,7 @@ enum {
>>
>> Â struct kvm_vcpu {
>> Â Â Â struct kvm *kvm;
>> + Â Â struct list_head list;
>> Â #ifdef CONFIG_PREEMPT_NOTIFIERS
>> Â Â Â struct preempt_notifier preempt_notifier;
>> Â #endif
>> @@ -251,12 +252,14 @@ struct kvm {
>> Â Â Â struct mm_struct *mm; /* userspace tied to this vm */
>> Â Â Â struct kvm_memslots *memslots;
>> Â Â Â struct srcu_struct srcu;
>> + Â Â struct srcu_struct srcu_vcpus;
>> +
>
> Another srcu. ÂThis alone is worth explaining in the changelog IMO.
>
Sorry, but why? I think it is just a srcu, and because it has
different aim and want a independent grace period, so not multiplex
kvm->srcu.

thanks and regards,
ping fan

> Â Â Â ÂTakuya
>
>> Â #ifdef CONFIG_KVM_APIC_ARCHITECTURE
>> Â Â Â u32 bsp_vcpu_id;
>> Â #endif
>> - Â Â struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
>> + Â Â struct list_head vcpus;
>> Â Â Â atomic_t online_vcpus;
>> - Â Â int last_boosted_vcpu;
>> + Â Â int last_boosted_vcpu_id;
>> Â Â Â struct list_head vm_list;
>> Â Â Â struct mutex lock;
>> Â Â Â struct kvm_io_bus *buses[KVM_NR_BUSES];
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/