From: Richard Henderson <richard.henderson@linaro.org>
To: vandersonmr <vandersonmr2@gmail.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Riku Voipio <riku.voipio@iki.fi>,
Laurent Vivier <laurent@vivier.eu>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [Qemu-Devel][PATCH 1/3] Adding an optional tb execution counter.
Date: Sun, 16 Jun 2019 19:28:11 -0700 [thread overview]
Message-ID: <3e8fb7a9-12cc-aea7-6c95-de6ba8f8209b@linaro.org> (raw)
In-Reply-To: <20190614135332.12777-2-vandersonmr2@gmail.com>
On 6/14/19 6:53 AM, vandersonmr wrote:
> +void HELPER(inc_exec_freq)(void *ptr)
> +{
> + TranslationBlock* tb = (TranslationBlock*) ptr;
> + atomic_inc(&tb->exec_freq);
> +}
...
> +DEF_HELPER_FLAGS_1(inc_exec_freq, TCG_CALL_NO_RWG, void, ptr)
...
> uint32_t flags; /* flags defining in which context the code was generated */
> uint16_t size; /* size of target code for this block (1 <=
> size <= TARGET_PAGE_SIZE) */
> + uint64_t exec_freq;
It's not a frequency, but a count.
> uint16_t icount;
> uint32_t cflags; /* compile flags */
Consider where you've placed the data with respect to the packing of other
members of the structure.
> static inline void gen_tb_start(TranslationBlock *tb)
> {
> TCGv_i32 count, imm;
>
> + if (enable_freq_count) {
> + TCGv_ptr tb_ptr = tcg_temp_new_ptr();
> + tcg_gen_trunc_i64_ptr(tb_ptr, tcg_const_i64((int64_t) tb));
> + gen_helper_inc_exec_freq(tb_ptr);
> + }
> +
> tcg_ctx->exitreq_label = gen_new_label();
> if (tb_cflags(tb) & CF_USE_ICOUNT) {
> count = tcg_temp_local_new_i32();
By placing the increment before the exit for interrupt check instead of after,
you're kinda counting the wrong thing, because the TB hasn't executed.
> diff --git a/linux-user/main.c b/linux-user/main.c
> index a59ae9439d..1bf7155670 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -58,6 +58,7 @@ static const char *seed_optarg;
> unsigned long mmap_min_addr;
> unsigned long guest_base;
> int have_guest_base;
> +bool enable_freq_count = false;
This is being declared in multiple places and initialized in multiple places.
This needs to go elsewhere.
r~
next prev parent reply other threads:[~2019-06-17 2:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 13:53 [Qemu-devel] [PATCH 0/3] Collecting TB Execution Frequency vandersonmr
2019-06-14 13:53 ` [Qemu-devel] [Qemu-Devel][PATCH 1/3] Adding an optional tb execution counter vandersonmr
2019-06-17 2:28 ` Richard Henderson [this message]
2019-06-17 10:01 ` Alex Bennée
2019-06-14 13:53 ` [Qemu-devel] [Qemu-Devel][PATCH 2/3] Saving counters between tb_flush events vandersonmr
2019-06-17 2:52 ` Richard Henderson
2019-06-17 10:00 ` Alex Bennée
2019-06-14 13:53 ` [Qemu-devel] [Qemu-Devel][PATCH 3/3] Adding command line option to linux-user vandersonmr
2019-06-17 2:54 ` Richard Henderson
2019-06-17 11:30 ` Alex Bennée
2019-06-14 16:01 ` [Qemu-devel] [PATCH 0/3] Collecting TB Execution Frequency no-reply
2019-06-17 10:17 ` Alex Bennée
2019-06-17 13:13 ` Alex Bennée
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=3e8fb7a9-12cc-aea7-6c95-de6ba8f8209b@linaro.org \
--to=richard.henderson@linaro.org \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
--cc=vandersonmr2@gmail.com \
/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).