On Tue, Dec 13, 2011 at 05:29:50PM +0800, Liu ping fan wrote: > On Mon, Dec 12, 2011 at 8:54 PM, Gleb Natapov <gleb@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. > >> > > Please drop all printks that you add. You do not use rcu_assign_pointer() > > during vcpu creation and BTW the code there is incorrect now. It assumed > > that online_vcpus is never decremented so it is OK to put newly created > > vcpu into kvm->vcpus[kvm->online_vcpus], but now it is not longer true. > > We even have BUG_ON() to catch that which I believe you can trigger with > > this patch by creating 3 vcpus, removing second one and then adding one > > more. Moving to rculist would solve this of course, and will simplify > > code that iterates over all vcpus too. > > > OK, it seems unavoidable to use rculist now :-). Just one more question, is it > useless for "case HV_X64_MSR_VP_INDEX" after adopting rculist? > Windows does not support cpu hot-unplug IIRC. Just return the index of the vcpu in the vcpus list there. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html