All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Jan Kiszka <jan.kiszka@web.de>, Alexander Graf <agraf@suse.de>,
	Chris Wright <chrisw@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] Re: KVM call agenda for Feb 9
Date: Tue, 09 Feb 2010 09:08:37 -0600	[thread overview]
Message-ID: <4B717A75.3010300@codemonkey.ws> (raw)
In-Reply-To: <4B717361.3000307@redhat.com>

On 02/09/2010 08:38 AM, Avi Kivity wrote:
> On 02/09/2010 04:18 PM, Anthony Liguori wrote:
>> On 02/09/2010 02:52 AM, Jan Kiszka wrote:
>>> Alexander Graf wrote:
>>>> On 09.02.2010, at 07:56, Avi Kivity wrote:
>>>>> - rcuify/fine-grain qemu locks
>>>> And this should be done either way, but is probably not a 
>>>> short-term goal.
>>>>
>>> Indeed. We won't get around this longterm as it is a scalability
>>> bottleneck and a killer for RT guest load. We can't push everything 
>>> into
>>> the kernel. Qemu needs a smart plan how to gradually convert its CPU 
>>> and
>>> device model to fine-grained locking.
>>
>> The VCPU loops should be easy to convert to lockless operation.  It's 
>> easier to do this upstream but that requires a functioning IO thread.
>>
>> For the table based MMIO and PIO dispatch, RCU would be a good 
>> locking choice since these structures are rarely updated.  The tricky 
>> bit is that the APIC has to be converted over to lockless before any 
>> other device can be converted because just about every device wants 
>> to inject an interrupt.
>
> The problem is that all the internal APIs now have to be threaded.  
> Looking at hpet as a simple example, we have qemu_irq_pulse() and 
> qemu_mod_timer().

Yes.  But just as you mention, we have to approach it on a 
device-by-device basis and incrementally convert over devices.

>   We also have some lock inversion since hpet calls the timer but the 
> timers also call hpet.

Right.  Making the dispatch loop in the IO thread thread safe won't be 
so bad either :-)

>   qemu_irq_pulse() feeds the various interrupt controllers; not a 
> problem for kernel irqchip but nontrivial for qemu's ioapic and pic.
>
> I'm not saying we should push hpet into the kernel to save userspace 
> coding effort; there should be an independent reason to do this.  But 
> I don't think threading qemu is going to be anything near easy.

It's certainly not easy but I don't think it's impossibly hard.

Regards,

Anthony Liguori


WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Chris Wright <chrisw@redhat.com>, Jan Kiszka <jan.kiszka@web.de>,
	Alexander Graf <agraf@suse.de>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: KVM call agenda for Feb 9
Date: Tue, 09 Feb 2010 09:08:37 -0600	[thread overview]
Message-ID: <4B717A75.3010300@codemonkey.ws> (raw)
In-Reply-To: <4B717361.3000307@redhat.com>

On 02/09/2010 08:38 AM, Avi Kivity wrote:
> On 02/09/2010 04:18 PM, Anthony Liguori wrote:
>> On 02/09/2010 02:52 AM, Jan Kiszka wrote:
>>> Alexander Graf wrote:
>>>> On 09.02.2010, at 07:56, Avi Kivity wrote:
>>>>> - rcuify/fine-grain qemu locks
>>>> And this should be done either way, but is probably not a 
>>>> short-term goal.
>>>>
>>> Indeed. We won't get around this longterm as it is a scalability
>>> bottleneck and a killer for RT guest load. We can't push everything 
>>> into
>>> the kernel. Qemu needs a smart plan how to gradually convert its CPU 
>>> and
>>> device model to fine-grained locking.
>>
>> The VCPU loops should be easy to convert to lockless operation.  It's 
>> easier to do this upstream but that requires a functioning IO thread.
>>
>> For the table based MMIO and PIO dispatch, RCU would be a good 
>> locking choice since these structures are rarely updated.  The tricky 
>> bit is that the APIC has to be converted over to lockless before any 
>> other device can be converted because just about every device wants 
>> to inject an interrupt.
>
> The problem is that all the internal APIs now have to be threaded.  
> Looking at hpet as a simple example, we have qemu_irq_pulse() and 
> qemu_mod_timer().

Yes.  But just as you mention, we have to approach it on a 
device-by-device basis and incrementally convert over devices.

>   We also have some lock inversion since hpet calls the timer but the 
> timers also call hpet.

Right.  Making the dispatch loop in the IO thread thread safe won't be 
so bad either :-)

>   qemu_irq_pulse() feeds the various interrupt controllers; not a 
> problem for kernel irqchip but nontrivial for qemu's ioapic and pic.
>
> I'm not saying we should push hpet into the kernel to save userspace 
> coding effort; there should be an independent reason to do this.  But 
> I don't think threading qemu is going to be anything near easy.

It's certainly not easy but I don't think it's impossibly hard.

Regards,

Anthony Liguori

  reply	other threads:[~2010-02-09 15:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09  1:28 KVM call agenda for Feb 9 Chris Wright
2010-02-09  1:28 ` [Qemu-devel] " Chris Wright
2010-02-09  6:56 ` Avi Kivity
2010-02-09  6:56   ` [Qemu-devel] " Avi Kivity
2010-02-09  7:16   ` Alexander Graf
2010-02-09  8:52     ` Jan Kiszka
2010-02-09  8:52       ` Jan Kiszka
2010-02-09 14:18       ` Anthony Liguori
2010-02-09 14:18         ` Anthony Liguori
2010-02-09 14:38         ` Avi Kivity
2010-02-09 14:38           ` Avi Kivity
2010-02-09 15:08           ` Anthony Liguori [this message]
2010-02-09 15:08             ` Anthony Liguori
2010-02-09 15:32             ` Avi Kivity
2010-02-09 15:32               ` Avi Kivity
2010-02-09 14:15   ` Anthony Liguori
2010-02-09 14:15     ` [Qemu-devel] " Anthony Liguori
2010-02-09 14:18   ` Avi Kivity
2010-02-09 14:18     ` [Qemu-devel] " Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B717A75.3010300@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.