Re: [kvm-devel] Remove APIC lock

2007-09-03 Thread Avi Kivity
Dong, Eddie wrote: > Avi: > > apic->lock is used in many place to avoid race condition with apic > timer call back > function which may run on different pCPU. This patch migrate the > apic timer to > same CPU with the one VP runs on, thus the lock is no longer > necessary. > > thx,eddie

Re: [kvm-devel] Remove APIC lock

2007-08-26 Thread Dong, Eddie
Avi Kivity wrote: > Dong, Eddie wrote: >> Avi Kivity wrote: >> >> For this situation, even without preemption, the problem is still >> there. But maybe you are refering the old code, the latest code is >> already preemption free since the apic_timer_fn didn't change any >> APIC state. It only incr

Re: [kvm-devel] Remove APIC lock

2007-08-26 Thread Avi Kivity
Dong, Eddie wrote: > Avi Kivity wrote: > >>> Just noticed it is changed to mutex, but seems same here :-) >>> If the process is switched to other task, it is OK since it won't >>> access local APIC. Current VP access to APIC will take the mutex >>> first (see below). Or you are talking other cor

Re: [kvm-devel] Remove APIC lock

2007-08-26 Thread Dong, Eddie
Avi Kivity wrote: >> >> Just noticed it is changed to mutex, but seems same here :-) >> If the process is switched to other task, it is OK since it won't >> access local APIC. Current VP access to APIC will take the mutex >> first (see below). Or you are talking other corner case? >> >> > > api

Re: [kvm-devel] Remove APIC lock

2007-08-25 Thread Avi Kivity
Dong, Eddie wrote: > Avi Kivity wrote: > >> Dong, Eddie wrote: >> What about preemption: - vcpu executes lapic code in qemu process context >>> Don't understand. LAPIC is in kernel, how can qemu access? >>> If you mean qemu is calling APIC KVM syscall, then

Re: [kvm-devel] Remove APIC lock

2007-08-25 Thread Dong, Eddie
Avi Kivity wrote: > Dong, Eddie wrote: >>> What about preemption: >>> >>> - vcpu executes lapic code in qemu process context >>> >> >> Don't understand. LAPIC is in kernel, how can qemu access? >> If you mean qemu is calling APIC KVM syscall, then it already >> disabled preemption & take kvm->lo

Re: [kvm-devel] Remove APIC lock

2007-08-25 Thread Avi Kivity
Avi Kivity wrote: > > Do we really take kvm->lock for local accesses? That's a significant > problem, much more than the timer. Actually, we must take the lock during emulation. But maybe we can change it to a reader/writer lock, and certainly we can drop it during lapic access. ---

Re: [kvm-devel] Remove APIC lock

2007-08-25 Thread Avi Kivity
Dong, Eddie wrote: >> What about preemption: >> >> - vcpu executes lapic code in qemu process context >> > > Don't understand. LAPIC is in kernel, how can qemu access? > If you mean qemu is calling APIC KVM syscall, then it already > disabled preemption & take kvm->lock. > > > I meant qemu

Re: [kvm-devel] Remove APIC lock

2007-08-25 Thread Dong, Eddie
> What about preemption: > > - vcpu executes lapic code in qemu process context Don't understand. LAPIC is in kernel, how can qemu access? If you mean qemu is calling APIC KVM syscall, then it already disabled preemption & take kvm->lock. > - process is preempted > - timer fires, touches lapic

Re: [kvm-devel] Remove APIC lock

2007-08-25 Thread Avi Kivity
Dong, Eddie wrote: > Avi: > > apic->lock is used in many place to avoid race condition with apic > timer call back > function which may run on different pCPU. This patch migrate the > apic timer to > same CPU with the one VP runs on, thus the lock is no longer > necessary. > > thx,eddie

Re: [kvm-devel] Remove APIC lock

2007-08-24 Thread Gregory Haskins
On Fri, 2007-08-24 at 22:24 +0800, Dong, Eddie wrote: > [EMAIL PROTECTED] wrote: > > Gregory Haskins wrote: > >> On Fri, 2007-08-24 at 21:08 +0800, Dong, Eddie wrote: > >>> Avi: > >>> > >>> apic->lock is used in many place to avoid race condition with > >>> apic timer call back function wh

Re: [kvm-devel] Remove APIC lock

2007-08-24 Thread Dong, Eddie
[EMAIL PROTECTED] wrote: > Gregory Haskins wrote: >> On Fri, 2007-08-24 at 21:08 +0800, Dong, Eddie wrote: >>> Avi: >>> >>> apic->lock is used in many place to avoid race condition with >>> apic timer call back function which may run on different pCPU. >>> This patch migrate the apic t

Re: [kvm-devel] Remove APIC lock

2007-08-24 Thread Dong, Eddie
Gregory Haskins wrote: > On Fri, 2007-08-24 at 21:08 +0800, Dong, Eddie wrote: >> Avi: >> >> apic->lock is used in many place to avoid race condition with >> apic timer call back function which may run on different pCPU. >> This patch migrate the apic timer to same CPU with the one VP

Re: [kvm-devel] Remove APIC lock

2007-08-24 Thread Gregory Haskins
On Fri, 2007-08-24 at 21:08 +0800, Dong, Eddie wrote: > Avi: > > apic->lock is used in many place to avoid race condition with apic > timer call back > function which may run on different pCPU. This patch migrate the > apic timer to > same CPU with the one VP runs on, thus the lock is