Patchwork Fix profile feedback issue with Mozilla

login
register
mail settings
Submitter Jan Hubicka
Date Jan. 10, 2011, 9:49 p.m.
Message ID <20110110214935.GA2858@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/78243/
State New
Headers show

Comments

Jan Hubicka - Jan. 10, 2011, 9:49 p.m.
Hi,
building Mozilla with profile feedback dies at:
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c: In
function 'arena_malloc':
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c:6530:1:
note: correcting inconsistent profile data
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c: In
function 'malloc_mutex_unlock':
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c:6530:1:
error: corrupted profile info: edge from 0 to 2 exceeds maximal count
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c: In
function 'malloc_mutex_lock':
/abuild/jh/mozilla-central2/mozilla-central/memory/jemalloc/jemalloc.c:6530:1:
error: corrupted profile info: edge from 2 to 3 exceeds maximal count

the reason is that malloc makes concurent update into the counter while the
gcov info is streamed, so the maximal counter info is wrong.  Given that
Mozilla use -fprofile-correction (to work around lack of thread safety), I
think this should not be hard error, but just an inform, like the other profile
inconsistencies are.

I've tested the patch on Mozilla, will commit it to mainline after
bootstrapping/regtested x86_64-linux.

	PR lto/45375
	* profile.c (read_profile_edge_counts): Ignore profile inconistency
	when correcting profile.

Patch

Index: profile.c
===================================================================
--- profile.c	(revision 168631)
+++ profile.c	(working copy)
@@ -409,8 +409,18 @@ 
 		e->count = exec_counts[exec_counts_pos++];
 		if (e->count > profile_info->sum_max)
 		  {
-		    error ("corrupted profile info: edge from %i to %i exceeds maximal count",
-			   bb->index, e->dest->index);
+		    if (flag_profile_correction)
+		      {
+			static bool informed = 0;
+			if (!informed)
+		          inform (input_location,
+			          "corrupted profile info: edge count exceeds maximal count",
+			          bb->index, e->dest->index);
+			informed = 1;
+		      }
+		    else
+		      error ("corrupted profile info: edge from %i to %i exceeds maximal count",
+			     bb->index, e->dest->index);
 		  }
 	      }
 	    else