qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sami Kiminki <sami.kiminki@tkk.fi>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Instruction counting instrumentation for ARM + initial patch
Date: Mon, 25 May 2009 18:04:09 +0300	[thread overview]
Message-ID: <1243263849.7173.119.camel@dis> (raw)
In-Reply-To: <761ea48b0905230623y1732cbcdt174cfeee010d495b@mail.gmail.com>

On Sat, 2009-05-23 at 15:23 +0200, Laurent Desnogues wrote:
> On Wed, May 20, 2009 at 10:35 PM, Vince Weaver <vince@csl.cornell.edu> wrote:
> > The main problem is that adding instrumentation infrastructure will either
> > slow down the common case, or else introduce lots of #ifdefs all over the
> > code.  Neither is very attractive.
> 
> I don't think adding command-line enabled options will slow down
> the standard translation in a measurable way, provided, for instance,
> it isn't being checked before running every translated block.  If it's
> checked before/after translating a block, then it shouldn't effect
> performance.

I tried to measure the performance difference between vanilla Qemu and
Qemu with this patch but without the command-line switch. As suggested
above, I couldn't measure the difference. However, to disable this
feature compile-time, I think that it should be enough to:
 1. define macro instr_count_inc which conveniently eliminates all
    function calls to instr_count_inc() and instr_count_inc_init().
 2. insert some #ifdefs to disable the framework code (e.g. #ifdef in
    CPUARMState to remove counters)

For my small set of workloads, I've measured around 10%..40% overhead
when instruction counting is enabled and this is definitely acceptable
for us. Your mileage may vary.


> > It would be nice if maybe a limited instrumentation architecture could
> > be put into qemu, that could be configured out.  It would save the various
> > researchers the problem of everyone re-implementing it differently.

I think this is something that many software developers would be
interested in, too. E.g., getting proper cache utilization etc. BTW, for
on-line cache simulation, wouldn't it be enough to instrument memory
accesses at TCG level (e.g., tcg_gen_ld8u_i32, ...)?


> You don't need to generate an instruction trace as I said in my
> previous mail.  For user mode applications, a TB trace is enough
> (of course there are some fine points that can cause trouble to
> derive the instruction trace from a TB trace such as dynamically
> generated code, or TB flushing) to derive an instruction trace.

We considered this when designing the patch. However, we decided to
start with the current implementation due to concerns of dynamically
generated code, as you pointed out. And then there's the system
emulation. Anyways, the most important thing would be to have the
instr_count_inc():s in the decoders. It shouldn't be too hard to change
the implementation later with at most trivial modifications to the
decoders.

Sami Kiminki
Embedded Software Group / Helsinki University of Technology

      reply	other threads:[~2009-05-25 15:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 14:59 [Qemu-devel] Instruction counting instrumentation for ARM + initial patch Timo Töyry
2009-05-20 10:48 ` Paul Brook
2009-05-20 12:16   ` Laurent Desnogues
2009-05-20 20:35     ` Vince Weaver
2009-05-23 13:23       ` Laurent Desnogues
2009-05-25 15:04         ` Sami Kiminki [this message]

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=1243263849.7173.119.camel@dis \
    --to=sami.kiminki@tkk.fi \
    --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).