public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Andi Kleen <ak@linux.intel.com>,GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/3] Add a pass to automatically add ptwrite instrumentation
Date: Tue, 13 Nov 2018 18:37:00 -0000	[thread overview]
Message-ID: <09B38DAB-F70B-4DFB-8BA2-4F5774A11753@gmail.com> (raw)
In-Reply-To: <20181113180915.skcqes73spiruooa@two.firstfloor.org>

On November 13, 2018 7:09:15 PM GMT+01:00, Andi Kleen <andi@firstfloor.org> wrote:
>On Tue, Nov 13, 2018 at 09:03:52AM +0100, Richard Biener wrote:
>> > I even had an earlier version of this that instrumented
>> > assembler output of the compiler with PTWRITE in a separate script,
>> > and it worked fine too.
>> 
>> Apart from eventually messing up branch range restrictions I guess ;)
>
>You mean for LOOP? For everything else the assembler handles it I
>believe.
>
>> Did you gather any statistics on how many ptwrite instructions
>> that are generated by your patch are not covered by any
>> location range & expr?  
>
>Need to look into that. Any suggestions how to do it in the compiler?

I guess you need to do that in a dwarf decoder somehow. 

>I had some decode failures with the perf dwarf decoder,
>but I was usually blaming them on perf dwarf limitations. 
>
>> I assume ptwrite is writing from register
>> input only so you probably should avoid instrumenting writes
>> of constants (will require an extra register)?
>
>Hmm, I think those are needed unfortunately because someone
>might want to trace every update of of something. With branch
>tracing it could be recreated theoretically but would 
>be a lot more work for the decoder.
>
>> How does the .text size behave say for cc1 when you enable
>> the various granularities of instrumentation?  How many
>> ptwrite instructions are there per 100 regular instructions?
>
>With locals tracing (worst case) I see ~23% of all instructions
>in cc1 be PTWRITE. Binary is ~27% bigger.

OK, I suppose it will get better when addressing some of my review comments. 

>> Can we get an updated patch based on my review?
>
>Yes, working on it, also addressing Martin's comments. Hopefully soon.
>> 
>> I still think we should eventually move the pass later
>
>It's after pass_sanopt now.
>
>> avoid instrumenting places we'll not have any meaningful locations
>> in the debug info - if only to reduce required trace bandwith.
>
>Can you suggest how to check that?

I'd look at doing the instrumentation after var-tracking has run - that is what computes the locations in the end. That means instrumenting on late RTL after register allocation (and eventually with branch range restrictions in place). Basically you'd instrument at the same time as generating debug info.

Richard. 

>-Andi

  reply	other threads:[~2018-11-13 18:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-04  6:33 [PATCH 1/3] Add PTWRITE builtins for x86 Andi Kleen
2018-11-04  6:33 ` [PATCH 2/3] Add a pass to automatically add ptwrite instrumentation Andi Kleen
2018-11-04  6:33   ` [PATCH 3/3] Add tests for the vartrace pass Andi Kleen
2018-11-09 15:27   ` [PATCH 2/3] Add a pass to automatically add ptwrite instrumentation Richard Biener
2018-11-09 18:18     ` Andi Kleen
2018-11-11  9:06       ` Richard Biener
2018-11-12  3:16         ` Andi Kleen
2018-11-13  8:04           ` Richard Biener
2018-11-13 18:09             ` Andi Kleen
2018-11-13 18:37               ` Richard Biener [this message]
2018-11-13 20:19                 ` Andi Kleen
2018-11-10  0:20   ` Martin Sebor
2018-11-11 18:38   ` Martin Sebor
2018-11-12  3:02     ` Andi Kleen
2018-11-08 17:10 ` [PATCH 1/3] Add PTWRITE builtins for x86 Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2018-02-12  2:53 Andi Kleen
2018-02-12  2:53 ` [PATCH 2/3] Add a pass to automatically add ptwrite instrumentation Andi Kleen

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=09B38DAB-F70B-4DFB-8BA2-4F5774A11753@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=gcc-patches@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).