From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Question regarding tcg trace-events
Date: Sun, 28 Jul 2019 11:11:01 +0100 [thread overview]
Message-ID: <87k1c2cvuy.fsf@linaro.org> (raw)
In-Reply-To: <CABqzqi5n9Sz4H+wc7yJSQz+tzOf8zr8=9H+KkgSoNv8wf=04WA@mail.gmail.com>
sainath grandhi <saiallforums@gmail.com> writes:
> Hello
> I am working with qemu tracing support and combined with tcg.
> I read that if tcg property is used for trace-event, it generates a
> trace-event once during translation and another trace-event after the
> execution.
>
> I made the following change in target/i386/translate.c
>
> -static inline void gen_op_movl_seg_T0_vm(DisasContext *s, int seg_reg)
> +static inline void gen_op_movl_seg_T0_vm(DisasContext *s, int
> seg_reg, CPUX86State *env)
> {
> tcg_gen_ext16u_tl(s->T0, s->T0);
> tcg_gen_st32_tl(s->T0, cpu_env,
> offsetof(CPUX86State,segs[seg_reg].selector));
> + trace_seg_write_tcg(tcg_ctx->cpu, cpu_env, env->eip, seg_reg,
> env->segs[seg_reg].selector, s->T0);
This is a new trace point you've added?
> tcg_gen_shli_tl(cpu_seg_base[seg_reg], s->T0, 4);
>
> I see seg_write_trans and seg_write_exec trace-events.
> Question I have is the following:
> I expect one seg_write_trans trace-event per seg_write_exec
> trace-event. However I notice more than one seg_write_exec
> trace-events after a seg_write_trans
If a translated block is executed more than once (most are) you should
see more exec events than trans events.
> and in some cases seg_write_exec
> trace-events occur without a seg_write_trans.
That is odd.
> Why do this happen? Does this have something to do with TCG and TBs?
In TCG an execution block (TranslationBlock) is:
- translated into TCgops
- generated into host code
- added to the code cache
from this point each time we need to execute something with the same
parameters (pc/flags) we fetch the already translated code and execute
it directly. There are more pointers to how the TCG works on the wiki.
--
Alex Bennée
prev parent reply other threads:[~2019-07-28 10:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-26 23:32 [Qemu-devel] Question regarding tcg trace-events sainath grandhi
2019-07-28 10:11 ` Alex Bennée [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=87k1c2cvuy.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.