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

2011-12-06 Thread Gleb Natapov
On Tue, Dec 06, 2011 at 02:54:06PM +0800, Liu ping fan wrote: On Mon, Dec 5, 2011 at 4:41 PM, Gleb Natapov g...@redhat.com wrote: On Mon, Dec 05, 2011 at 01:39:37PM +0800, Liu ping fan wrote: On Sun, Dec 4, 2011 at 8:10 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Dec 04, 2011 at

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

2011-12-05 Thread Gleb Natapov
On Mon, Dec 05, 2011 at 01:39:37PM +0800, Liu ping fan wrote: On Sun, Dec 4, 2011 at 8:10 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Dec 04, 2011 at 07:53:37PM +0800, Liu ping fan wrote: On Sat, Dec 3, 2011 at 2:26 AM, Jan Kiszka jan.kis...@siemens.com wrote: On 2011-12-02 07:26, Liu

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

2011-12-05 Thread Avi Kivity
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++,

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

2011-12-05 Thread Gleb Natapov
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

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

2011-12-05 Thread Avi Kivity
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

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

2011-12-05 Thread Gleb Natapov
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

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

2011-12-05 Thread Avi Kivity
On 12/05/2011 12:18 PM, Gleb Natapov wrote: We can, but that's a bigger change. Is it? I do not see a lot of accesses to vcpu array except those loops. Well actually some of those loops have to go away and be replaced by a hash lookup with apic id as key. -- error compiling

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

2011-12-05 Thread Gleb Natapov
On Mon, Dec 05, 2011 at 12:22:53PM +0200, Avi Kivity wrote: On 12/05/2011 12:18 PM, Gleb Natapov wrote: We can, but that's a bigger change. Is it? I do not see a lot of accesses to vcpu array except those loops. Well actually some of those loops have to go away and be replaced

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

2011-12-05 Thread Liu ping fan
On Mon, Dec 5, 2011 at 4:41 PM, Gleb Natapov g...@redhat.com wrote: On Mon, Dec 05, 2011 at 01:39:37PM +0800, Liu ping fan wrote: On Sun, Dec 4, 2011 at 8:10 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Dec 04, 2011 at 07:53:37PM +0800, Liu ping fan wrote: On Sat, Dec 3, 2011 at 2:26 AM,

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

2011-12-04 Thread Avi Kivity
On 12/02/2011 08:26 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com 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. @@

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

2011-12-04 Thread Liu ping fan
On Sat, Dec 3, 2011 at 2:26 AM, Jan Kiszka jan.kis...@siemens.com wrote: On 2011-12-02 07:26, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction taken when its refcnt is zero,

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

2011-12-04 Thread Gleb Natapov
On Sun, Dec 04, 2011 at 07:53:37PM +0800, Liu ping fan wrote: On Sat, Dec 3, 2011 at 2:26 AM, Jan Kiszka jan.kis...@siemens.com wrote: On 2011-12-02 07:26, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Currently, vcpu can be destructed only when kvm instance

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

2011-12-04 Thread Liu ping fan
On Sun, Dec 4, 2011 at 6:23 PM, Avi Kivity a...@redhat.com wrote: On 12/02/2011 08:26 AM, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com Currently, vcpu can be destructed only when kvm instance destroyed. Change this to vcpu's destruction taken when its refcnt is zero,

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

2011-12-04 Thread Liu ping fan
On Sun, Dec 4, 2011 at 8:10 PM, Gleb Natapov g...@redhat.com wrote: On Sun, Dec 04, 2011 at 07:53:37PM +0800, Liu ping fan wrote: On Sat, Dec 3, 2011 at 2:26 AM, Jan Kiszka jan.kis...@siemens.com wrote: On 2011-12-02 07:26, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com

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

2011-12-02 Thread Jan Kiszka
On 2011-12-02 07:26, Liu Ping Fan wrote: From: Liu Ping Fan pingf...@linux.vnet.ibm.com 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. I'm

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

2011-12-01 Thread Liu Ping Fan
From: Liu Ping Fan pingf...@linux.vnet.ibm.com 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