qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Kirill Batuzov <batuzovk@ispras.ru>
Cc: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>,
	Blue Swirl <blauwirbel@gmail.com>,
	Stefan Weil <weil@mail.berlios.de>,
	Anthony Liguori <aliguori@amazon.com>,
	Amit Shah <amit.shah@redhat.com>,
	Matthew Fernandez <matthew.fernandez@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [RFC PATCH] tcg: add ability to dump /tmp/perf-<pid>.map files
Date: Fri, 28 Mar 2014 16:34:17 +0000	[thread overview]
Message-ID: <87lhvub7ue.fsf@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1403281600550.4071@bulbul.intra.ispras.ru>


Kirill Batuzov <batuzovk@ispras.ru> writes:

> On Thu, 27 Mar 2014, alex.bennee@linaro.org wrote:
>
>> From: Alex Bennée <alex.bennee@linaro.org>
>> 
>> This allows the perf tool to map samples to each individual translation
>> block. This could be expanded for user space but currently it gives
>> enough information to find any hotblocks by other means.
>
> I'm in favor of this patch. Being able to profile guest code with perf
> will be very helpful for developing and tweaking optimizations in tcg.

OK I'll roll in Richard's comments and re-submit.

>
> <snip>
>
>> @@ -2575,6 +2579,8 @@ static inline int tcg_gen_code_common(TCGContext *s, uint64_t target_pc,
>>   the_end:
>>      /* Generate TB finalization at the end of block */
>>      tcg_out_tb_finalize(s);
>> +
>> +    tcg_write_perfmap(gen_code_buf, s->code_ptr - gen_code_buf, target_pc);
>>      return -1;
>>  }
>
> I think a part of the patch is missing here. tcg_gen_code_common does not
> have target_pc argument in current master.

Ahh yes - it's currently sitting on-top of my qemu-log series which
pulled target_pc into the tcg_gen_code_common loop for the -dfilter
patch. I'll be sending the updated series in a moment.

> <snip>
>
>> diff --git a/vl.c b/vl.c
>> index c036367..f1c3c3d 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -123,6 +123,9 @@ int main(int argc, char **argv)
>>  #define MAX_VIRTIO_CONSOLES 1
>>  #define MAX_SCLP_CONSOLES 1
>>  
>> +/* seems better than pulling in all the tcg headers? */
>> +extern void qemu_tcg_enable_perfmap(void);
>> +

I'm surprised no one has pulled me up on this yet, perhaps it is just
less ugly!

>>  static const char *data_dir[16];
>>  static int data_dir_idx;
>>  const char *bios_name = NULL;
>> @@ -3345,6 +3348,9 @@ int main(int argc, char **argv, char **envp)
>>              case QEMU_OPTION_DFILTER:
>>                  qemu_set_dfilter_ranges(optarg);
>>                  break;
>> +            case QEMU_OPTION_PERFMAP:
>> +                qemu_tcg_enable_perfmap();
>> +                break;
>>              case QEMU_OPTION_s:
>>                  add_device_config(DEV_GDB, "tcp::" DEFAULT_GDBSTUB_PORT);
>>                  break;
>> 
>
> Is there any particular reason it is not enabled for linux-user mode? I
> think it should work just fine in both modes. linux-user handles command
> line options by itself in a different manner (and it has it's own set of
> options, different from softmmu targets). The corresponding code is in
> linux-user/main.c.

No real reason. I was only experimenting with system emulation so that's
all I'd tested it with. In fact for linux-user we should be able to make
a better stab at giving the blocks decent names thanks to symbol-lookup.

I'll update the patch to do it.


-- 
Alex Bennée

  reply	other threads:[~2014-03-28 16:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 16:37 [Qemu-devel] [RFC PATCH] tcg: add ability to dump /tmp/perf-<pid>.map files alex.bennee
2014-03-27 19:51 ` Richard Henderson
2014-03-28 11:12   ` Alex Bennée
2014-03-28 13:29     ` Richard Henderson
2014-03-28 13:30     ` Richard Henderson
2014-03-28 12:29 ` Kirill Batuzov
2014-03-28 16:34   ` Alex Bennée [this message]
2014-03-28 20:04     ` Kirill Batuzov

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=87lhvub7ue.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=amit.shah@redhat.com \
    --cc=batuzovk@ispras.ru \
    --cc=blauwirbel@gmail.com \
    --cc=matthew.fernandez@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=weil@mail.berlios.de \
    --cc=yeongkyoon.lee@samsung.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).