qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: 陳韋任 <chenwj@iis.sinica.edu.tw>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel@nongnu.org, 陳韋任 <chenwj@iis.sinica.edu.tw>
Subject: Re: [Qemu-devel] Improve QEMU performance with LLVM codegen and other techniques
Date: Thu, 1 Dec 2011 11:50:24 +0800	[thread overview]
Message-ID: <20111201035024.GA88545@cs.nctu.edu.tw> (raw)
In-Reply-To: <BD39A319-B197-4763-B335-5B23CAC1FE02@suse.de>

Hi Alex,

> Very cool! I was thinking about this for a while myself now. It's especially appealing these days since you can do the hotspot optimization in a separate thread :).
> 
> Especially in system mode, you also need to flush when tb_flush() is called though. And you have to make sure to match hflags and segment descriptors for the links - otherwise you might end up connecting TBs from different processes :).

  I'll check the tb_flush again. IIRC, we make the code cache big enough so that
there is no need to flush the code cache. But I think we still need to deal with
it in the end.

  The block linking is done by QEMU and we leave it alone. But I don't know QEMU
ever does hflags and segment descriptors check before doing block linking. Could
you point it out? Anyway, here is how we form trace from a set of basic blocks.

1. We insert instrumented code at the beginning of each TCG block to collect how
   many times this block being executed.

2. When a block's execution time, say block A, reaches a pre-defined threshold,
   we follow the run time execution path to collect block B followed A and so on
   to form a trace. This approach is called NET (Next-Executing Tail) [1].

3. Then a trace composed of TCG blocks is sent to a LLVM translator. The translator
   generates the host binary for the trace into a LLVM code cache, and patch the
   beginning of block A (in QEMU code cache) so that anyone executing block A will 
   jump to the corresponding trace and execute.

Above is block to trace link. I think there is no need to do hflags and segment
descriptors check, right? Although I set the trace length to one basic block at
the moment (make the situation simpler), I think we still don't have to check
the blocks' hflags and segment descriptors in the trace to see if they match.
 
> > successfully, then login and run some benchmark on it. As a very first step, we
> > make a very high threshold on trace building. In other words, a basic block must
> > be executed *many* time to trigger the trace building process. Then we lower the
> > threshold a bit at a time to see how things work. When something goes wrong, we
> > might get kernel panic or the system hangs at some point on the booting process.
> > I have no idea on how to solve this kind of problem. So I'd like to seek for
> > help/experience/suggestion on the mailing list. I just hope I make the whole
> > situation clear to you. 
> 
> I don't see any better approach to debugging this than the one you're already taking. Try to run as many workloads as you can and see if they break :). Oh and always make the optimization optional, so that you can narrow it down to it and know you didn't hit a generic QEMU bug.

  You mean make the trace optimization optional? We have tested our framework in
LLVM-only mode. which means we replace TCG with LLVM entirely. It's _very_ slow
but works. What the generic QEMU bug is? We use QEMU 0.13 and just rely on its
emulation part right now. Does recent version fix major bugs in the emulation
engine?

  Thanks for your advices. :-)

[1] http://www.cs.virginia.edu/kim/docs/micro05.pdf

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

  reply	other threads:[~2011-12-01  3:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  7:03 [Qemu-devel] Improve QEMU performance with LLVM codegen and other techniques 陳韋任
2011-11-30 12:37 ` Alexander Graf
2011-12-01  3:50   ` 陳韋任 [this message]
2011-12-01  7:46     ` Stefan Hajnoczi
2011-12-01  9:16       ` Alex Bradbury
2011-12-01  9:30       ` 陳韋任
2011-12-01 10:23     ` Alexander Graf
2011-12-04  6:14       ` 陳韋任
2011-12-04 11:29         ` Alexander Graf
2011-12-05  6:05           ` 陳韋任
2011-12-01 10:59     ` Peter Maydell
2011-12-06  7:39   ` 陳韋任
2011-12-19 17:44     ` Alexander Graf
2011-11-30 12:51 ` Peter Maydell
2011-12-01  9:03   ` 陳韋任
2011-12-01  9:13     ` 陳韋任
2011-12-01  9:15     ` Max Filippov
2011-12-01  9:25       ` 陳韋任
2011-12-01  9:41         ` Max Filippov
2011-12-06  6:37           ` 陳韋任
2011-12-01 10:12     ` Peter Maydell
2011-12-01 10:40       ` 陳韋任

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=20111201035024.GA88545@cs.nctu.edu.tw \
    --to=chenwj@iis.sinica.edu.tw \
    --cc=agraf@suse.de \
    --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 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).