qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Konrad <fred.konrad@greensocs.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: mttcg@greensocs.com, QEMU Developers <qemu-devel@nongnu.org>,
	Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] when does a target frontend need to use gen_io_start()/gen_io_end() ?
Date: Wed, 13 May 2015 14:30:38 +0200	[thread overview]
Message-ID: <555343EE.3080302@greensocs.com> (raw)
In-Reply-To: <5553215E.4070705@redhat.com>

Hi,

On 13/05/2015 12:03, Paolo Bonzini wrote:
>
> On 13/05/2015 11:41, Peter Maydell wrote:
>>> For -icount and SMP, yes.  I even posted a patch to that end once.
>> I don't see why -icount and SMP need to be mutually exclusive.
>> If we're round-robining between the SMP CPUs then they should
>> all stay deterministic, I would have thought?
> No, because the round-robin switches happen non-deterministically when
> the I/O thread kicks the VCPU in qemu_mutex_lock_iothread.
>
> It gets worse with BQL-free TCG which lets you remove the kicks
> altogether (and the round-robin disappears in favor of true
> multithreading).  Even you could keep the kicks, having both round-robin
> and multi-threading would be extra complication in the code and cause of
> bitrot.

If you're talking of the kick_thread, kick_cpu, I think we should keep that.
We need to be able to synchronize all VCPUs somehow when we want to do for
example tb/tlb flush and tb_invalidate so we are sure no others VCPU will be
executing tb.

But then yes, we will probably have pain with icount and make it less 
deterministic
than it is today (it's broken in my series though because of 
cpu_exec_nocache
which does a tb_invalidate).

Fred
>>> You can get -icount and multi-threaded TCG (which for UP is simply TCG
>>> with execution out of the BQL) together I think.  For example you could
>>> handle cpu->icount_decr.u16.low == 0 like cpu->halted, hanging the CPU
>>> thread until QEMU_CLOCK_VIRTUAL timers have been processed.  The I/O
>>> thread would have to kick the CPU after processing QEMU_CLOCK_VIRTUAL
>>> timers---not hard to do.
>> Multithreaded TCG for a UP guest isn't very interesting though...
> BQL-free TCG is interesting though, for two reasons:
>
> 1) maintainability: get rid of all the aforementioned "kick VCPU" stuff
> in qemu_mutex_lock_iothread;
>
> 2) performance: allow handling of I/O events to run in parallel with the
> VCPU, rather than the lockstep technique we have now.  This improves
> performance, so that for example you might get rid of the artificial
> ratelimiting in ptimer.c.
>
> In case it wasn't clear, BQL-freedom is the main reason why I'm
> interested in multithreaded TCG! :)
>
> Paolo

  reply	other threads:[~2015-05-13 12:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 15:32 [Qemu-devel] when does a target frontend need to use gen_io_start()/gen_io_end() ? Peter Maydell
2015-05-12 15:43 ` Richard Henderson
2015-05-12 15:54   ` Peter Maydell
2015-05-12 18:17 ` Paolo Bonzini
2015-05-12 19:41   ` Peter Maydell
2015-05-13  8:42     ` Paolo Bonzini
2015-05-13  9:41       ` Peter Maydell
2015-05-13 10:03         ` Paolo Bonzini
2015-05-13 12:30           ` Frederic Konrad [this message]
2015-05-13  6:57   ` Pavel Dovgaluk
     [not found]   ` <16201.3286528692$1431500273@news.gmane.org>
2015-05-13  8:32     ` Paolo Bonzini

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=555343EE.3080302@greensocs.com \
    --to=fred.konrad@greensocs.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=mttcg@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).