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

From: Liu ping fan
Date: Wed Dec 14 2011 - 22:21:38 EST


On Tue, Dec 13, 2011 at 7:36 PM, Marcelo Tosatti <mtosatti@xxxxxxxxxx> wrote:
> On Mon, Dec 12, 2011 at 10:41:23AM +0800, 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 taken when its refcnt is zero,
>> and then vcpu MUST and CAN be destroyed before kvm's destroy.
>>
>> Signed-off-by: Liu Ping Fan <pingfank@xxxxxxxxxxxxxxxxxx>
>> ---
>> Âarch/x86/kvm/i8254.c   |  10 ++++--
>> Âarch/x86/kvm/i8259.c   |  12 +++++--
>> Âarch/x86/kvm/mmu.c    |  Â7 ++--
>> Âarch/x86/kvm/x86.c    |  54 +++++++++++++++++++----------------
>> Âinclude/linux/kvm_host.h | Â 71 ++++++++++++++++++++++++++++++++++++++++++----
>> Âvirt/kvm/irq_comm.c   Â|  Â7 +++-
>> Âvirt/kvm/kvm_main.c   Â|  62 +++++++++++++++++++++++++++++++++------
>> Â7 files changed, 170 insertions(+), 53 deletions(-)
>
> This needs a full audit of paths that access vcpus. See for one example
> bsp_vcpu pointer.
>
Yes, I had missed it and just paid attention to the access path to
vcpu in kvm_lapic and the path used in async_pf. I will correct it
later.
BTW, I want to make it sure that because kvm_lapic will be destroyed
before vcpu, so it is safe to bypass the access path there, and the
situation is the same in async_pf for we have called
kvm_clear_async_pf_completion_queue before zapping vcpu. Am I right?

As to the scene like bsp_vcpu, I think that introducing refcount like
in V2 can handle it easier. Please help to review these changes in V4
which I will send a little later.

Thanks and regards
ping fan
>
--
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/