public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov/profile/28441]  New: Need atomic increment of gcov counters for MP programs
@ 2006-07-20  0:47 gnb at sgi dot com
  2006-07-20  1:09 ` [Bug gcov/profile/28441] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: gnb at sgi dot com @ 2006-07-20  0:47 UTC (permalink / raw)
  To: gcc-bugs

The arc instrumentation code generated by -fprofile-arcs increments
gcov counters in a manner which is not guaranteed to be atomic.  As
a result, if two or more cpus enter the same basic block at nearly
the same time they can leave an incorrect arc count, which makes it
impossible for gcov to solve that function's arc count graph later.

Within SGI, this is a significant limitation when doing kernel test
coverage studies, as we have code that needs to be exercised over
multiple processors.  The same problem presumably affects people
trying to do coverage studies on multithreaded programs in userspace.

I've written a patch to solve this problem.  It adds a new option,
-fprofile-multithread, which changes the tree profiler code to
use the recently-added __sync_add_and_fetch() builtin to update
the counters.  I've tested it on ia64 and i386; it generates
the appropriate object code which runs and produces coverage
results.

Here's a diffstat:

 common.opt                         |    4 +
 doc/invoke.texi                    |   14 ++++-
 testsuite/gcc.misc-tests/gcov-12.c |   28 ++++++++++
 tree-profile.c                     |   75 +++++++++++++++++++++++++++++
 4 files changed, 119 insertions(+), 2 deletions(-)

Reading the documention at gcc.gnu.org, this looks "legally significant"
so I'll need to have some paperwork done right?  I assume a copyright
assignment form and an employer disclaimer are the correct documents.
Can someone start that process?  Should I just attach the patch now?


-- 
           Summary: Need atomic increment of gcov counters for MP programs
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov/profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gnb at sgi dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28441


^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <bug-28441-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-07-21 23:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20  0:47 [Bug gcov/profile/28441] New: Need atomic increment of gcov counters for MP programs gnb at sgi dot com
2006-07-20  1:09 ` [Bug gcov/profile/28441] " pinskia at gcc dot gnu dot org
2006-07-20  1:51 ` gnb at sgi dot com
2006-07-20  3:45 ` bangerth at dealii dot org
2006-07-21 18:05 ` ian at airs dot com
2006-07-23 17:27 ` seongbae dot park at gmail dot com
2006-07-24  2:23 ` gnb at sgi dot com
2006-07-26  0:28 ` pinskia at gcc dot gnu dot org
2006-07-29  0:41 ` steven at gcc dot gnu dot org
2006-07-29  5:21 ` ian at airs dot com
2006-07-31  1:18 ` gnb at sgi dot com
2006-12-06 20:50 ` [Bug gcov-profile/28441] " gnb at melbourne dot sgi dot com
2007-01-10  1:25 ` gnb at melbourne dot sgi dot com
2007-03-14 23:03 ` hubicka at gcc dot gnu dot org
2008-08-22 18:18 ` pinskia at gcc dot gnu dot org
     [not found] <bug-28441-4@http.gcc.gnu.org/bugzilla/>
2012-07-21 23:26 ` steven at gcc dot gnu.org

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).