qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Desnogues <laurent.desnogues@gmail.com>
To: Sami Kiminki <sami.kiminki@tkk.fi>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Instruction counting instrumentation for ARM, 2nd version
Date: Mon, 15 Jun 2009 15:26:30 +0200	[thread overview]
Message-ID: <761ea48b0906150626if3c3dc5kc000b0d6ab8bcc6d@mail.gmail.com> (raw)
In-Reply-To: <1244804168.7242.186.camel@dis>

On Fri, Jun 12, 2009 at 12:56 PM, Sami Kiminki<sami.kiminki@tkk.fi> wrote:
[...]
>
> There are also other ways to implement instruction counting (see
> responses to our previous patch [1]). As to our approach, I believe this
> is the cleanest way to implement this specific instrumentation. However,
> from the general point of view, I'm not so sure. I'd like to ask for
> more comments and options.

Apart from the fact your patch doesn't contain instrumentation.[ch]
it is bogus in several places and shows why I think the approach
is probably not the best.

E.g.:

@@ -6300,6 +6809,7 @@ static void disas_arm_insn(CPUState * en
                         if (insn & (1 << 20)) {
                             gen_helper_mark_exclusive(cpu_env, cpu_T[1]);
                             switch (op1) {
+                            instr_count_inc(ARM_INSTRUCTION_LDREX);
                             case 0: /* ldrex */
                                 tmp = gen_ld32(addr, IS_USER(s));
                                 break;

This is misplaced.

-            if (op1 & 2)
+            if (op1 & 2) {
                 gen_helper_double_saturate(tmp2, tmp2);
-            if (op1 & 1)
+                if (op1 & 1) instr_count_inc(ARM_INSTRUCTION_QDSUB);
+                else instr_count_inc(ARM_INSTRUCTION_QDADD);
+            }
+            if (op1 & 1) {
                 gen_helper_sub_saturate(tmp, tmp, tmp2);
-            else
+                instr_count_inc(ARM_INSTRUCTION_QSUB);
+            }
+            else {
                 gen_helper_add_saturate(tmp, tmp, tmp2);
+                instr_count_inc(ARM_INSTRUCTION_QADD);
+            }

Here your two last instr_count_inc will overwrite the first two ones.
So you don't distinguish between QDADD/QDSUB and
QADD/QSUB.

I also would like to see a more general instrumentation framework
but your approach is too intrusive and so it's too easy to introduce
hard to detect bugs.

Cheers,

Laurent

  parent reply	other threads:[~2009-06-15 13:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 10:56 [Qemu-devel] [PATCH] Instruction counting instrumentation for ARM, 2nd version Sami Kiminki
2009-06-12 15:41 ` Jamie Lokier
2009-06-15  8:12   ` Sami Kiminki
2009-06-15 13:26 ` Laurent Desnogues [this message]
2009-06-29  8:42   ` [Qemu-devel] [PATCH] Instruction counting instrumentation for ARM v3 Sami Kiminki
     [not found] ` <761ea48b0906150531j6cf88fa2v5652322efcc7469c@mail.gmail.com>
2009-06-15 13:31   ` [Qemu-devel] [PATCH] Instruction counting instrumentation for ARM, 2nd version & 2nd try Sami Kiminki

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=761ea48b0906150626if3c3dc5kc000b0d6ab8bcc6d@mail.gmail.com \
    --to=laurent.desnogues@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sami.kiminki@tkk.fi \
    /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).