Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-07-08 Thread Avi Kivity
On 07/06/2012 09:06 PM, Jan Kiszka wrote: > On 2012-07-06 19:16, Jan Kiszka wrote: >> On 2012-06-24 16:08, Jan Kiszka wrote: >>> On 2012-06-24 10:49, Avi Kivity wrote: On 06/23/2012 02:45 PM, Jan Kiszka wrote: > > Hmm, we may need the iothread lock around cpu_set_apic_tpr for > !kv

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-07-06 Thread Jan Kiszka
On 2012-07-06 19:16, Jan Kiszka wrote: > On 2012-06-24 16:08, Jan Kiszka wrote: >> On 2012-06-24 10:49, Avi Kivity wrote: >>> On 06/23/2012 02:45 PM, Jan Kiszka wrote: Hmm, we may need the iothread lock around cpu_set_apic_tpr for !kvm_irqchip_in_kernel(). And as we are at it, apic_b

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-07-06 Thread Jan Kiszka
On 2012-06-24 16:08, Jan Kiszka wrote: > On 2012-06-24 10:49, Avi Kivity wrote: >> On 06/23/2012 02:45 PM, Jan Kiszka wrote: >>> >>> Hmm, we may need the iothread lock around cpu_set_apic_tpr for >>> !kvm_irqchip_in_kernel(). And as we are at it, apic_base manipulation >>> can be but there as well.

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-28 Thread Marcelo Tosatti
On Thu, Jun 28, 2012 at 09:10:39AM -0500, Anthony Liguori wrote: > On 06/26/2012 02:34 PM, Marcelo Tosatti wrote: > >On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > >>Should have declared this [RFC] in the subject and CC'ed kvm... > >> > >>On 2012-06-23 00:45, Jan Kiszka wrote: > >>>T

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-28 Thread Marcelo Tosatti
On Thu, Jun 28, 2012 at 09:10:39AM -0500, Anthony Liguori wrote: > > > >1. read_lock(memmap_lock) > >2. MemoryRegionSection mrs = lookup(addr) > >3. qom_ref(mrs.mr->dev) > >4. read_unlock(memmap_lock) > > > >5. mutex_lock(dev->lock) > >6. dispatch(&mrs, addr, data, size) > >7. mutex_unlock(d

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-28 Thread Avi Kivity
On 06/28/2012 05:10 PM, Anthony Liguori wrote: >> >> 1. read_lock(memmap_lock) >> 2. MemoryRegionSection mrs = lookup(addr) >> 3. qom_ref(mrs.mr->dev) >> 4. read_unlock(memmap_lock) >> >> 5. mutex_lock(dev->lock) >> 6. dispatch(&mrs, addr, data, size) >> 7. mutex_unlock(dev->lock) > > Just

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-28 Thread Anthony Liguori
On 06/26/2012 02:34 PM, Marcelo Tosatti wrote: On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: Should have declared this [RFC] in the subject and CC'ed kvm... On 2012-06-23 00:45, Jan Kiszka wrote: This sketches a possible path to get rid of the iothread lock on vmexits in KVM mode

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-28 Thread Marcelo Tosatti
On Wed, Jun 27, 2012 at 08:41:49AM +0100, Stefan Hajnoczi wrote: > On Wed, Jun 27, 2012 at 8:39 AM, Stefan Hajnoczi wrote: > > On Tue, Jun 26, 2012 at 8:34 PM, Marcelo Tosatti > > wrote: > >> On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > >> net.txt > >> > >> > >> > >> io

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-28 Thread Stefan Hajnoczi
On Wed, Jun 27, 2012 at 12:19 PM, Marcelo Tosatti wrote: > On Wed, Jun 27, 2012 at 08:41:49AM +0100, Stefan Hajnoczi wrote: >> On Wed, Jun 27, 2012 at 8:39 AM, Stefan Hajnoczi wrote: >> > On Tue, Jun 26, 2012 at 8:34 PM, Marcelo Tosatti >> > wrote: >> >> On Sat, Jun 23, 2012 at 12:55:49AM +0200

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Marcelo Tosatti
On Sat, Jun 23, 2012 at 11:22:07AM +0200, Jan Kiszka wrote: > On 2012-06-23 02:22, Marcelo Tosatti wrote: > > On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > >> Should have declared this [RFC] in the subject and CC'ed kvm... > >> > >> On 2012-06-23 00:45, Jan Kiszka wrote: > >>> This

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Jan Kiszka
On 2012-06-26 21:34, Marcelo Tosatti wrote: > The following plan would allow progressive convertion to parallel > operation. > > Jan mentioned the MMIO handler->MMIO handler deadlock in a private message. > > Jan: if there is recursive MMIO accesses, you can detect that and skip > such MMIO handl

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Marcelo Tosatti
On Wed, Jun 27, 2012 at 08:41:49AM +0100, Stefan Hajnoczi wrote: > On Wed, Jun 27, 2012 at 8:39 AM, Stefan Hajnoczi wrote: > > On Tue, Jun 26, 2012 at 8:34 PM, Marcelo Tosatti > > wrote: > >> On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > >> net.txt > >> > >> > >> > >> io

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Avi Kivity
On 06/26/2012 10:34 PM, Marcelo Tosatti wrote: > > 1. read_lock(memmap_lock) > 2. MemoryRegionSection mrs = lookup(addr) > 3. qom_ref(mrs.mr->dev) > 4. read_unlock(memmap_lock) > > 5. mutex_lock(dev->lock) > 6. dispatch(&mrs, addr, data, size) > 7. mutex_unlock(dev->lock) > > 8. qom_unre

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Stefan Hajnoczi
On Wed, Jun 27, 2012 at 8:39 AM, Stefan Hajnoczi wrote: > On Tue, Jun 26, 2012 at 8:34 PM, Marcelo Tosatti wrote: >> On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: >> net.txt >> >> >> >> iothread flow >> = >> >> 1) Skip-work-if-device-locked >> >> select(tap fd r

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Stefan Hajnoczi
On Tue, Jun 26, 2012 at 8:34 PM, Marcelo Tosatti wrote: > On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > net.txt > > > > iothread flow > = > > 1) Skip-work-if-device-locked > > select(tap fd ready) > tap_send >    if (trylock(TAPState->NetClientState->dev)) >  

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-26 Thread Marcelo Tosatti
On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > Should have declared this [RFC] in the subject and CC'ed kvm... > > On 2012-06-23 00:45, Jan Kiszka wrote: > > This sketches a possible path to get rid of the iothread lock on vmexits > > in KVM mode. On x86, the the in-kernel irqchips

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Avi Kivity
On 06/24/2012 05:58 PM, Jan Kiszka wrote: >>> Are there really cases where the framebuffer is accessible both via MMIO >>> and RAM-like mappings at the same time? If so, the current flushing on >>> vmexit would help either as the direct mappings would not trigger exits. >>> Or what do you mean? >>

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Jan Kiszka
On 2012-06-24 16:56, Avi Kivity wrote: > On 06/24/2012 05:51 PM, Jan Kiszka wrote: >> On 2012-06-24 16:46, Avi Kivity wrote: >>> On 06/24/2012 05:40 PM, Jan Kiszka wrote: On 2012-06-24 16:35, Avi Kivity wrote: > On 06/24/2012 05:08 PM, Jan Kiszka wrote: >> As a first step, I will post

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Avi Kivity
On 06/24/2012 05:51 PM, Jan Kiszka wrote: > On 2012-06-24 16:46, Avi Kivity wrote: >> On 06/24/2012 05:40 PM, Jan Kiszka wrote: >>> On 2012-06-24 16:35, Avi Kivity wrote: On 06/24/2012 05:08 PM, Jan Kiszka wrote: > As a first step, I will post a series later that gets rid of > kvm_flus

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Jan Kiszka
On 2012-06-24 16:46, Avi Kivity wrote: > On 06/24/2012 05:40 PM, Jan Kiszka wrote: >> On 2012-06-24 16:35, Avi Kivity wrote: >>> On 06/24/2012 05:08 PM, Jan Kiszka wrote: As a first step, I will post a series later that gets rid of kvm_flush_coalesced_mmio_buffer in the common vmexit path

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Avi Kivity
On 06/24/2012 05:40 PM, Jan Kiszka wrote: > On 2012-06-24 16:35, Avi Kivity wrote: >> On 06/24/2012 05:08 PM, Jan Kiszka wrote: >>> As a first step, I will post a series later that gets rid of >>> kvm_flush_coalesced_mmio_buffer in the common vmexit path. >> >> If you defer this, I can think of tw

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Jan Kiszka
On 2012-06-24 16:35, Avi Kivity wrote: > On 06/24/2012 05:08 PM, Jan Kiszka wrote: >> As a first step, I will post a series later that gets rid of >> kvm_flush_coalesced_mmio_buffer in the common vmexit path. > > If you defer this, I can think of two places that need to flush: > - anything that ac

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Avi Kivity
On 06/24/2012 05:08 PM, Jan Kiszka wrote: > As a first step, I will post a series later that gets rid of > kvm_flush_coalesced_mmio_buffer in the common vmexit path. If you defer this, I can think of two places that need to flush: - anything that accesses those memory areas (such as DMA to the fra

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Avi Kivity
On 06/24/2012 05:08 PM, Jan Kiszka wrote: > On 2012-06-24 10:49, Avi Kivity wrote: >> On 06/23/2012 02:45 PM, Jan Kiszka wrote: >>> >>> Hmm, we may need the iothread lock around cpu_set_apic_tpr for >>> !kvm_irqchip_in_kernel(). And as we are at it, apic_base manipulation >>> can be but there as we

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Jan Kiszka
On 2012-06-24 15:34, liu ping fan wrote: > On Sat, Jun 23, 2012 at 7:45 PM, Jan Kiszka wrote: >> On 2012-06-23 11:06, Marcelo Tosatti wrote: >>> On Fri, Jun 22, 2012 at 09:22:59PM -0300, Marcelo Tosatti wrote: On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > Should have decla

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Jan Kiszka
On 2012-06-24 10:49, Avi Kivity wrote: > On 06/23/2012 02:45 PM, Jan Kiszka wrote: >> >> Hmm, we may need the iothread lock around cpu_set_apic_tpr for >> !kvm_irqchip_in_kernel(). And as we are at it, apic_base manipulation >> can be but there as well. >> >> With in-kernel irqchip, there is no suc

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread liu ping fan
On Sat, Jun 23, 2012 at 7:45 PM, Jan Kiszka wrote: > On 2012-06-23 11:06, Marcelo Tosatti wrote: >> On Fri, Jun 22, 2012 at 09:22:59PM -0300, Marcelo Tosatti wrote: >>> On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: Should have declared this [RFC] in the subject and CC'ed kvm...

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-24 Thread Avi Kivity
On 06/23/2012 02:45 PM, Jan Kiszka wrote: > > Hmm, we may need the iothread lock around cpu_set_apic_tpr for > !kvm_irqchip_in_kernel(). And as we are at it, apic_base manipulation > can be but there as well. > > With in-kernel irqchip, there is no such need. Also, no one accesses > eflags outsid

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-23 Thread Jan Kiszka
On 2012-06-23 11:06, Marcelo Tosatti wrote: > On Fri, Jun 22, 2012 at 09:22:59PM -0300, Marcelo Tosatti wrote: >> On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: >>> Should have declared this [RFC] in the subject and CC'ed kvm... >>> >>> On 2012-06-23 00:45, Jan Kiszka wrote: This

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-23 Thread Marcelo Tosatti
On Fri, Jun 22, 2012 at 09:22:59PM -0300, Marcelo Tosatti wrote: > On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > > Should have declared this [RFC] in the subject and CC'ed kvm... > > > > On 2012-06-23 00:45, Jan Kiszka wrote: > > > This sketches a possible path to get rid of the io

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-23 Thread Jan Kiszka
On 2012-06-23 02:22, Marcelo Tosatti wrote: > On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: >> Should have declared this [RFC] in the subject and CC'ed kvm... >> >> On 2012-06-23 00:45, Jan Kiszka wrote: >>> This sketches a possible path to get rid of the iothread lock on vmexits >>>

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-23 Thread Jan Kiszka
On 2012-06-23 00:59, Anthony Liguori wrote: > On 06/22/2012 05:45 PM, Jan Kiszka wrote: >> This sketches a possible path to get rid of the iothread lock on vmexits >> in KVM mode. On x86, the the in-kernel irqchips has to be used because >> we otherwise need to synchronize APIC and other per-cpu st

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-22 Thread Marcelo Tosatti
On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > Should have declared this [RFC] in the subject and CC'ed kvm... > > On 2012-06-23 00:45, Jan Kiszka wrote: > > This sketches a possible path to get rid of the iothread lock on vmexits > > in KVM mode. On x86, the the in-kernel irqchips

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-22 Thread Anthony Liguori
On 06/22/2012 05:45 PM, Jan Kiszka wrote: This sketches a possible path to get rid of the iothread lock on vmexits in KVM mode. On x86, the the in-kernel irqchips has to be used because we otherwise need to synchronize APIC and other per-cpu state accesses that could be changed concurrently. Not

Re: [Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-22 Thread Jan Kiszka
Should have declared this [RFC] in the subject and CC'ed kvm... On 2012-06-23 00:45, Jan Kiszka wrote: > This sketches a possible path to get rid of the iothread lock on vmexits > in KVM mode. On x86, the the in-kernel irqchips has to be used because > we otherwise need to synchronize APIC and oth

[Qemu-devel] [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-22 Thread Jan Kiszka
This sketches a possible path to get rid of the iothread lock on vmexits in KVM mode. On x86, the the in-kernel irqchips has to be used because we otherwise need to synchronize APIC and other per-cpu state accesses that could be changed concurrently. Not yet fully analyzed is the NMI injection path