qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Doubts on SMP, VCPU and CONFIG_IOTHREAD


From: Alex Barcelo
Subject: Re: [Qemu-devel] Doubts on SMP, VCPU and CONFIG_IOTHREAD
Date: Wed, 19 Sep 2012 17:16:14 +0200

Thanks a lot! Ok, now it seems a bit clearer :)

On Tue, Sep 18, 2012 at 10:19 AM, Paolo Bonzini <address@hidden> wrote:
> Il 18/09/2012 08:27, Alex Barcelo ha scritto:
>>
>> I saw some things[1] about multiple vcpu, smp and things like that. It
>> seemed to me that --enable-io-thread enables it.
>
> iothread means that the QEMU main thread only services an event loop
> (I/O, bottom halves, timers, etc.).  Running CPUs is offloaded to extra
> threads.
>
> The iothread most of the times runs without the big QEMU lock (because
> most of the time it is waiting on a select system call).
>
>> But, it only works
>> for KVM, doesn't it? I assume that there is NOT one thread per vcpu in
>> TCG mode.
>
> Yes, KVM has a thread per VCPU.  This is possible because with KVM the
> VCPU thread is _also_ running most of the time without the big QEMU lock
> (it is in the KVM_RUN ioctl).
>
> However, TCG needs to run with the big QEMU lock.  For this reason TCG
> has a single thread that runs in lockstep with the io-thread.  Whenever
> the iothread gets out of the select system call and needs the lock, it
> asks the TCG thread to exit and the TCG thread obeys.  This is done
> using a condition variable qemu_io_proceeded_cond, controlled by a
> boolean variable iothread_requesting_mutex.
>
> Whenever the iothread goes back to sleep, it signals the condition
> variable and the TCG thread starts running again.
>
>> And this --enable-io-thread now is the default? This option
>> is always active? Now I was wondering if something "parallel" is done
>> in TCG (maybe through coroutines?).
>
> The lockstep behavior obtained with the condition variable is what you
> are looking for.
>
> Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]