Blame SOURCES/oprofile-ppc64jvm.patch

e284e3
commit a41b4231ccfc83fb99271507a8e98f84a348e71d
e284e3
Author: Rei Odaira <rei.odaira@gmail.com>
e284e3
Date:   Fri May 22 15:34:50 2015 -0400
e284e3
e284e3
    Filter out zero-sized mapping to avoid opjitconv running indefinitely
e284e3
    
e284e3
    I found opjitconv ran indefinitely when profiling a Java application
e284e3
    running on OpenJDK/ppc64le.  This is because OpenJDK sometimes reports
e284e3
    generation of zero-size jitted code via JVMTI, but scan_overlaps() in
e284e3
    opjitconv does not assume the existence of jitted code with size zero.
e284e3
    
e284e3
    (1) scan_overlaps() finds overlap between a normal jitted code and a
e284e3
        zero-size jitted code.
e284e3
    (2) eliminate_overlaps() tries to split the zero-size jitted code but
e284e3
         cannot.
e284e3
    (3) resolve_overlaps() incorrectly thinks the split has happened and
e284e3
         invokes scan_overlaps() again.
e284e3
    (4) Back to (1)
e284e3
    
e284e3
    One solution is to remove all the zero-size entries before resolving
e284e3
    overlaps which is implemented by this patch.
e284e3
    
e284e3
    Signed-off-by: William Cohen <wcohen@redhat.com>
e284e3
e284e3
diff --git a/opjitconv/jitsymbol.c b/opjitconv/jitsymbol.c
e284e3
index e2b1e66..1b980af 100644
e284e3
--- a/opjitconv/jitsymbol.c
e284e3
+++ b/opjitconv/jitsymbol.c
e284e3
@@ -201,6 +201,26 @@ static void invalidate_earlybirds(unsigned long long start_time)
e284e3
 	}
e284e3
 }
e284e3
 
e284e3
+static void invalidate_zero_size_entries(void)
e284e3
+{
e284e3
+	u32 i;
e284e3
+	int flag;
e284e3
+	struct jitentry * a;
e284e3
+
e284e3
+	flag = 0;
e284e3
+	for (i = 0; i < entry_count; i++) {
e284e3
+		a = entries_address_ascending[i];
e284e3
+		if (a->code_size == 0) {
e284e3
+			invalidate_entry(a);
e284e3
+			flag = 1;
e284e3
+		}
e284e3
+	}
e284e3
+	if (flag) {
e284e3
+		resort_address();
e284e3
+		resort_symbol();
e284e3
+	}
e284e3
+}
e284e3
+
e284e3
 
e284e3
 /* select the symbol with the longest life time in the index range */
e284e3
 static int select_one(int start_idx, int end_idx)
e284e3
@@ -505,6 +525,7 @@ int resolve_overlaps(unsigned long long start_time)
e284e3
 	int cnt = 0;
e284e3
 
e284e3
 	invalidate_earlybirds(start_time);
e284e3
+	invalidate_zero_size_entries();
e284e3
 	while ((rc = scan_overlaps()) && rc != OP_JIT_CONV_FAIL) {
e284e3
 		resort_address();
e284e3
 		if (cnt == 0) {