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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 05, 2011 at 11:58:56AM +0200, Avi Kivity wrote:
> On 12/05/2011 11:42 AM, Gleb Natapov wrote:
> > On Mon, Dec 05, 2011 at 11:30:51AM +0200, Avi Kivity wrote:
> > > On 12/05/2011 07:29 AM, Liu ping fan wrote:
> > > > like this,
> > > > #define kvm_for_each_vcpu(idx, cnt, vcpup, kvm) \
> > > > 	for (idx = 0, cnt = 0, vcpup = kvm_get_vcpu(kvm, idx); \
> > > > 	     cnt < atomic_read(&kvm->online_vcpus) && \
> > > > 	     idx < KVM_MAX_VCPUS; \
> > > > 	     idx++, (vcpup == NULL)?:cnt++, vcpup = kvm_get_vcpu(kvm, idx)) \
> > > > 	     if (vcpup == NULL) \
> > > > 	          continue; \
> > > > 	     else
> > > >
> > > >
> > > > A little ugly, but have not thought a better way out :-)
> > > >
> > > 
> > > #define kvm_for_each_vcpu(vcpu, it) for (vcpu = kvm_fev_init(&it); vcpu;
> > > vcpu = kvm_fev_next(&it, vcpu))
> > > 
> > > Though that doesn't give a good place for rcu_read_unlock().
> > > 
> > > 
> > Why not use rculist to store vcpus and use list_for_each_entry_rcu()?
> 
> We can, but that's a bigger change.
> 
Is it? I do not see a lot of accesses to vcpu array except those loops.

--
			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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux