diff --git a/SOURCES/papi-aarch64.patch b/SOURCES/papi-aarch64.patch new file mode 100644 index 0000000..3a35034 --- /dev/null +++ b/SOURCES/papi-aarch64.patch @@ -0,0 +1,88 @@ +commit 071943b6ffb67047c78bc7e7c370fc41c16ef538 +Author: William Cohen +Date: Fri Oct 11 13:41:41 2013 -0400 + + add preliminary aarch64 (arm64) support + + There has been some work to build fedora 19 on 64-bit arm armv8 machines + (aarch64). I took a look that the why the papi build was failing. The + attached is a set of minimal patches to get papi to build. The patch is + just a step toward getting aarch64 support for papi. Things are not all + there for papi to work in that environment. Still need libpfm to + support aarch64 and papi_events.csv describing mappings to machine + specific events. + +diff --git a/src/configure b/src/configure +index 7cbd262..3c50e20 100755 +--- a/src/configure ++++ b/src/configure +@@ -4262,7 +4262,7 @@ _ACEOF + + # First set pthread-mutexes based on arch + case $arch in +- arm*) ++ aarch64|arm*) + pthread_mutexes=yes + CFLAGS="$CFLAGS -DUSE_PTHREAD_MUTEXES" + echo "forcing use of pthread mutexes... " >&6 +diff --git a/src/configure.in b/src/configure.in +index 2a73ad6..acc8bfc 100644 +--- a/src/configure.in ++++ b/src/configure.in +@@ -382,7 +382,7 @@ AC_DEFINE_UNQUOTED(CPU,$CPU,[cpu type]) + + # First set pthread-mutexes based on arch + case $arch in +- arm*) ++ aarch64|arm*) + pthread_mutexes=yes + CFLAGS="$CFLAGS -DUSE_PTHREAD_MUTEXES" + echo "forcing use of pthread mutexes... " >&6 +diff --git a/src/linux-context.h b/src/linux-context.h +index 2135695..524490b 100644 +--- a/src/linux-context.h ++++ b/src/linux-context.h +@@ -31,6 +31,8 @@ typedef ucontext_t hwd_ucontext_t; + #define OVERFLOW_ADDRESS(ctx) ((struct sigcontext *)ctx.ucontext)->si_regs.pc + #elif defined(__arm__) + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.arm_pc ++#elif defined(__aarch64__) ++#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc + #elif defined(__mips__) + #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc + #else +diff --git a/src/linux-timer.c b/src/linux-timer.c +index 8e2d21f..9b918cd 100644 +--- a/src/linux-timer.c ++++ b/src/linux-timer.c +@@ -215,7 +215,7 @@ get_cycles( void ) + /* POWER get_cycles() */ + /************************/ + +-#elif (defined(__powerpc__) || defined(__arm__) || defined(__mips__)) ++#elif (defined(__powerpc__) || defined(__arm__) || defined(__mips__) || defined(__aarch64__)) + /* + * It's not possible to read the cycles from user space on ppc970. + * There is a 64-bit time-base register (TBU|TBL), but its +commit 479e89a51ee18ba331c86a41be9ff17cd501e6d9 +Author: William Cohen +Date: Wed May 28 17:01:41 2014 -0400 + + Add aarch64 Cortex A57 presets + + The events for the ARM Cortex A57 events look to be the same as the + events for the ARM Cortex A15 events. Add an entry so the preset are + available for the ARM Cortex A57. + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index 441844e..dbbc8d8 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -1473,6 +1473,7 @@ PRESET,PAPI_L1_DCM,NOT_DERIVED,DCACHE_REFILL + PRESET,PAPI_L1_ICM,NOT_DERIVED,IFETCH_MISS + # + CPU,arm_ac15 ++CPU,arm_ac57 + # + PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED + PRESET,PAPI_TOT_IIS,NOT_DERIVED,INST_SPEC_EXEC diff --git a/SOURCES/papi-coverity.patch b/SOURCES/papi-coverity.patch new file mode 100644 index 0000000..e63aec8 --- /dev/null +++ b/SOURCES/papi-coverity.patch @@ -0,0 +1,834 @@ +commit 284f25c227d1b6c07e87f6336d3b6ff0533c85d7 +Author: William Cohen +Date: Thu Jan 30 16:20:24 2014 -0500 + + Use correct specification for signed and unsigned int + + A run of cppcheck showed that some mismatches between the specfications + for sscanf and the variables being used to store the values. This corrects + those minor issues. + +diff --git a/src/components/lustre/linux-lustre.c b/src/components/lustre/linux-lustre.c +index 4f4fb7a..46899f2 100644 +--- a/src/components/lustre/linux-lustre.c ++++ b/src/components/lustre/linux-lustre.c +@@ -334,13 +334,13 @@ read_lustre_counter( ) + if (fgets(buffer,BUFSIZ,fff)==NULL) break; + + if (strstr( buffer, "write_bytes" )) { +- sscanf(buffer,"%*s %*d %*s %*s %*d %*d %lld",&fs->write_cntr->value); +- SUBDBG("Read %lld write_bytes\n",fs->write_cntr->value); ++ sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->write_cntr->value); ++ SUBDBG("Read %llu write_bytes\n",fs->write_cntr->value); + } + + if (strstr( buffer, "read_bytes" )) { +- sscanf(buffer,"%*s %*d %*s %*s %*d %*d %lld",&fs->read_cntr->value); +- SUBDBG("Read %lld read_bytes\n",fs->read_cntr->value); ++ sscanf(buffer,"%*s %*d %*s %*s %*d %*d %llu",&fs->read_cntr->value); ++ SUBDBG("Read %llu read_bytes\n",fs->read_cntr->value); + } + } + fclose(fff); +@@ -352,8 +352,8 @@ read_lustre_counter( ) + if (fgets(buffer,BUFSIZ,fff)==NULL) break; + + if (strstr( buffer, "read but discarded")) { +- sscanf(buffer,"%*s %*s %*s %lld",&fs->readahead_cntr->value); +- SUBDBG("Read %lld discared\n",fs->readahead_cntr->value); ++ sscanf(buffer,"%*s %*s %*s %llu",&fs->readahead_cntr->value); ++ SUBDBG("Read %llu discared\n",fs->readahead_cntr->value); + break; + } + } +diff --git a/src/components/net/linux-net.c b/src/components/net/linux-net.c +index ad15d84..ba7563c 100644 +--- a/src/components/net/linux-net.c ++++ b/src/components/net/linux-net.c +@@ -240,7 +240,7 @@ read_net_counters( long long *values ) + SUBDBG("Interface <%s> not found\n", ifname); + } else { + nf = sscanf( data, +- "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", ++ "%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n", + &values[if_bidx + 0], &values[if_bidx + 1], + &values[if_bidx + 2], &values[if_bidx + 3], + &values[if_bidx + 4], &values[if_bidx + 5], +@@ -251,7 +251,7 @@ read_net_counters( long long *values ) + &values[if_bidx + 14], &values[if_bidx + 15]); + + SUBDBG("\nRead " +- "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu\n", ++ "%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n", + values[if_bidx + 0], values[if_bidx + 1], + values[if_bidx + 2], values[if_bidx + 3], + values[if_bidx + 4], values[if_bidx + 5], +commit c810cd0d90baead96838145004545cc156b7ab77 +Author: James Ralph +Date: Tue Aug 13 14:13:55 2013 -0400 + + Close resource leaks + + User dcb reported several resource leaks in trac bug #184. + -------------------- + I just ran the static analysis checker "cppcheck" over the source + code of papi-5.2.0 + + It said + + 1. [linux-memory.c:711]: (error) Resource leak: sys_cpu + + 2. [papi_preset.c:735]: (error) Resource leak: fp + + 3. [components/micpower/linux-micpower.c:166]: (error) Resource leak: fp + + I've checked them all and they all look like resource leaks to me. + + Suggest code rework. + ---------------------------------- + +diff --git a/src/components/micpower/linux-micpower.c b/src/components/micpower/linux-micpower.c +index 896e75f..4da4577 100644 +--- a/src/components/micpower/linux-micpower.c ++++ b/src/components/micpower/linux-micpower.c +@@ -163,6 +163,7 @@ read_sysfs_file( long long* counts) + retval&= fscanf(fp, "%lld %lld %lld", &counts[i], &counts[i+1], &counts[i+2] ); + } + ++ fclose(fp); + return retval; + } + +diff --git a/src/linux-memory.c b/src/linux-memory.c +index 6c69fbd..bf6c420 100644 +--- a/src/linux-memory.c ++++ b/src/linux-memory.c +@@ -707,6 +707,7 @@ sparc_sysfs_cpu_attr( char *name, char **result ) + return 0; + } + } ++ closedir( sys_cpu ); + return -1; + } + +diff --git a/src/papi_preset.c b/src/papi_preset.c +index 9485793..603c8df 100644 +--- a/src/papi_preset.c ++++ b/src/papi_preset.c +@@ -732,12 +732,14 @@ _xml_papi_hwi_setup_all_presets( char *arch, hwi_dev_notes_t * notes ) + + if ( !p ) { + PAPIERROR( "Couldn't allocate memory for XML parser." ); ++ fclose(fp); + return ( PAPI_ESYS ); + } + XML_SetElementHandler( p, _xml_start, _xml_end ); + XML_SetCharacterDataHandler( p, _xml_content ); + if ( fp == NULL ) { + PAPIERROR( "Error opening Preset XML file." ); ++ fclose(fp); + return ( PAPI_ESYS ); + } + +@@ -749,11 +751,13 @@ _xml_papi_hwi_setup_all_presets( char *arch, hwi_dev_notes_t * notes ) + + if ( buffer == NULL ) { + PAPIERROR( "Couldn't allocate memory for XML buffer." ); ++ fclose(fp); + return ( PAPI_ESYS ); + } + len = fread( buffer, 1, BUFFSIZE, fp ); + if ( ferror( fp ) ) { + PAPIERROR( "XML read error." ); ++ fclose(fp); + return ( PAPI_ESYS ); + } + done = feof( fp ); +@@ -761,10 +765,13 @@ _xml_papi_hwi_setup_all_presets( char *arch, hwi_dev_notes_t * notes ) + PAPIERROR( "Parse error at line %d:\n%s\n", + XML_GetCurrentLineNumber( p ), + XML_ErrorString( XML_GetErrorCode( p ) ) ); ++ fclose(fp); + return ( PAPI_ESYS ); + } +- if ( error ) ++ if ( error ) { ++ fclose(fp); + return ( PAPI_ESYS ); ++ } + } while ( !done ); + XML_ParserFree( p ); + fclose( fp ); +commit e5b335740fad31cd230295508f2a4e9fb77a2878 +Author: James Ralph +Date: Fri Nov 8 15:15:28 2013 -0500 + + multiplex_cost: check return value on PAPI_set_opt + + Thanks to Will Cohen for reporting based upon output of coverity. + +diff --git a/src/utils/multiplex_cost.c b/src/utils/multiplex_cost.c +index 8fbd7a4..2f8216a 100644 +--- a/src/utils/multiplex_cost.c ++++ b/src/utils/multiplex_cost.c +@@ -112,7 +112,8 @@ init_test(int SoftwareMPX, int KernelMPX, int* Events) + option.multiplex.eventset = SoftwareMPX; + option.multiplex.ns = itimer.itimer.ns; + +- PAPI_set_opt( PAPI_MULTIPLEX, &option ); ++ if ( (retval = PAPI_set_opt( PAPI_MULTIPLEX, &option )) != PAPI_OK ) ++ test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval); + + for (i = 0; i < options.min - 1; i++) { + if ( options.kernel_mpx ) { +@@ -249,7 +250,8 @@ main( int argc, char **argv ) + option.multiplex.eventset = SoftwareMPX; + option.multiplex.ns = itimer.itimer.ns; + +- PAPI_set_opt( PAPI_MULTIPLEX, &option ); ++ if ( PAPI_OK != (retval = PAPI_set_opt( PAPI_MULTIPLEX, &option ))) ++ test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval); + + if ( !options.kernel_mpx && !options.force_sw ) { + test_fail(__FILE__, __LINE__, "No tests to run.", -1); +commit 83c31e25409040aac8178a4a3f89111efd060cc0 +Author: James Ralph +Date: Fri Nov 8 16:10:18 2013 -0500 + + perf_event.c: Check return value of ioctl + + Thanks to Will Cohen for reporting based upon output of coverity. + +diff --git a/src/components/perf_event/perf_event.c b/src/components/perf_event/perf_event.c +index 4b52cce..b4b2656 100644 +--- a/src/components/perf_event/perf_event.c ++++ b/src/components/perf_event/perf_event.c +@@ -1909,7 +1909,9 @@ _pe_dispatch_timer( int n, hwd_siginfo_t *info, void *uc) + return; + } + +- ioctl( fd, PERF_EVENT_IOC_DISABLE, NULL ); ++ if (ioctl( fd, PERF_EVENT_IOC_DISABLE, NULL ) == -1 ) { ++ PAPIERROR("ioctl(PERF_EVENT_IOC_DISABLE) failed.\n"); ++ } + + if ( ( thread->running_eventset[cidx]->state & PAPI_PROFILING ) && + !( thread->running_eventset[cidx]->profile.flags & +commit 60fb1dd4497df7d0ea77d88f586142ceb3e22b32 +Author: James Ralph +Date: Thu Nov 21 13:18:49 2013 -0500 + + command_line utility: Initialize a variable + + Initialize data_type to PAPI_DATATYPE_INT64 + Addresses a coverity error + Error: COMPILER_WARNING: [#def19] + papi-5.2.0/src/utils/command_line.c:133:4: warning: 'data_type' may be used uninitialized in this function [-Wmaybe-uninitialized] + switch (data_type) { + ^ + +diff --git a/src/utils/command_line.c b/src/utils/command_line.c +index 36f7df5..2f4a816 100644 +--- a/src/utils/command_line.c ++++ b/src/utils/command_line.c +@@ -56,7 +56,7 @@ main( int argc, char **argv ) + char *success; + PAPI_event_info_t info; + int EventSet = PAPI_NULL; +- int i, j, data_type, event; ++ int i, j, event, data_type = PAPI_DATATYPE_INT64; + int u_format = 0; + int hex_format = 0; + +commit e43b1138296866795c5db1a6dcd123d312af1b46 +Author: James Ralph +Date: Wed Jul 23 15:40:47 2014 -0400 + + native_avail.c: Bug fixes and updates + + Thanks to Gary Mohr + -------------------------------------------------- + This patch fixes a couple of problems found in the papi_native_avail program. + + First change fixes a problem introduced when the -validate option was added. This + option causes events to get added to an event set but never removes them. This change + will remove them if the add works. This change also fixes a coverity detected error + where the return value from PAPI_destroy_eventset was being ignored. + + Second change improves the delimitor check when separating the event description from + the event mask description. The previous check only looked for a colon but some of the + event descriptions contain a colon so descriptions would get displayed incorrectly. The + new check finds the "masks:" substring which is what papi inserts to separate these two + descriptions. + + Third change adds code to allow the user to enter events of the form pmu:::event or + pmu::event when using the -e option in the program. + +diff --git a/src/utils/native_avail.c b/src/utils/native_avail.c +index 2073ed7..59fc1b4 100644 +--- a/src/utils/native_avail.c ++++ b/src/utils/native_avail.c +@@ -227,13 +232,19 @@ parse_unit_masks( PAPI_event_info_t * info ) + if ( ( pmask = strchr( ptr, ':' ) ) == NULL ) { + return ( 0 ); + } +- memmove( info->symbol, pmask, ( strlen( pmask ) + 1 ) * sizeof ( char ) ); +- pmask = strchr( info->long_descr, ':' ); +- if ( pmask == NULL ) ++ memmove( info->symbol, pmask, ( strlen(pmask) + 1 ) * sizeof(char) ); ++ ++ // The description field contains the event description followed by a tag 'masks:' ++ // and then the mask description (if there was a mask with this event). The following ++ // code isolates the mask description part of this information. ++ ++ pmask = strstr( info->long_descr, "masks:" ); ++ if ( pmask == NULL ) { + info->long_descr[0] = 0; +- else +- memmove( info->long_descr, pmask + sizeof ( char ), +- ( strlen( pmask ) + 1 ) * sizeof ( char ) ); ++ } else { ++ pmask += 6; // bump pointer past 'masks:' identifier in description ++ memmove( info->long_descr, pmask, (strlen(pmask) + 1) * sizeof(char) ); ++ } + return ( 1 ); + } + +@@ -295,8 +306,20 @@ main( int argc, char **argv ) + "Event name:", info.symbol); + printf( "%-29s|%s|\n", "Description:", info.long_descr ); + ++ /* handle the PAPI component-style events which have a component:::event type */ ++ char *ptr; ++ if ((ptr=strstr(flags.name, ":::"))) { ++ ptr+=3; ++ /* handle libpfm4-style events which have a pmu::event type event name */ ++ } else if ((ptr=strstr(flags.name, "::"))) { ++ ptr+=2; ++ } ++ else { ++ ptr=flags.name; ++ } ++ + /* if unit masks exist but none specified, process all */ +- if ( !strchr( flags.name, ':' ) ) { ++ if ( !strchr( ptr, ':' ) ) { + if ( PAPI_enum_event( &i, PAPI_NTV_ENUM_UMASKS ) == PAPI_OK ) { + printf( "\nUnit Masks:\n" ); + do { +commit 74041b3ebcfc69575efb4ff830b9dc2f651b458b +Author: James Ralph +Date: Fri Aug 29 14:44:08 2014 -0400 + + event_info utility: address coverity defect + + From Gary Mohr + -------------- + This patch corrects a defect reported by Coverity. The defect reported + that the call to PAPI_enum_cmp_event was setting retval which was never + getting used before it got set again by a call to PAPI_get_event_info. + + After looking at the code, I decided that we should not be trying to get + the next event inside a loop that is enumerating masks for the current + event. It makes more sense to break out of the loop to get masks and + let the outer loop that is walking the events get the next event. + -------------- + +diff --git a/src/utils/event_info.c b/src/utils/event_info.c +index d1010b6..1de375f 100644 +--- a/src/utils/event_info.c ++++ b/src/utils/event_info.c +@@ -237,8 +237,7 @@ enum_native_events( FILE * f, int cidx) + retval = PAPI_get_event_info( k, &info ); + if ( retval == PAPI_OK ) { + if ( test_event( k )!=PAPI_OK ) { +- retval = PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cidx ); +- continue; ++ break; + } + xmlize_event( f, &info, -1 ); + } +commit 07990f85c706221f41d8b27bb2aebfc6c4874dbd +Author: James Ralph +Date: Tue Sep 2 11:54:07 2014 -0400 + + ctests/ Address coverity reported defects + + Thanks to Gary Mohr for the patch + --------------------------------- + he contents of this patch file fix defects reported by Coverity in the + directory 'papi/src/ctests'. + + The defect reported in branches.c was that a comparison between + different kinds of data was being done. + + The defect reported in calibrate.c was that the variable + 'papi_event_str' could end up without a null terminator. + + The defects reported in describe.c, get_event_component.c, and + krentel_pthreads.c were that return values from function calls were + being stored in a variable but never being used. + + I also did a little clean-up in describe.c. This test had been failing + for me on Intel NHM and SNBEP but now it runs and reports that it + PASSED. + --------------------------------- + +diff --git a/src/ctests/branches.c b/src/ctests/branches.c +index 930329e..5292323 100644 +--- a/src/ctests/branches.c ++++ b/src/ctests/branches.c +@@ -94,7 +94,7 @@ main( int argc, char **argv ) + /* Find a reasonable number of iterations (each + * event active 20 times) during the measurement + */ +- t2 = 10000 * 20 * nevents; /* Target: 10000 usec/multiplex, 20 repeats */ ++ t2 = (long long)(10000 * 20) * nevents; /* Target: 10000 usec/multiplex, 20 repeats */ + if ( t2 > 30e6 ) + test_skip( __FILE__, __LINE__, "This test takes too much time", + retval ); +diff --git a/src/ctests/calibrate.c b/src/ctests/calibrate.c +index a3dea0a..e370ba9 100644 +--- a/src/ctests/calibrate.c ++++ b/src/ctests/calibrate.c +@@ -160,7 +160,8 @@ main( int argc, char *argv[] ) + print_help( argv ); + exit( 1 ); + } +- strncpy( papi_event_str, argv[i + 1], sizeof ( papi_event_str ) ); ++ strncpy( papi_event_str, argv[i + 1], sizeof ( papi_event_str ) - 1); ++ papi_event_str[sizeof ( papi_event_str )-1] = '\0'; + i++; + } else if ( strstr( argv[i], "-d" ) ) + double_precision = 1; +diff --git a/src/ctests/describe.c b/src/ctests/describe.c +index d29bf72..f03309e 100644 +--- a/src/ctests/describe.c ++++ b/src/ctests/describe.c +@@ -25,7 +25,6 @@ main( int argc, char **argv ) + int retval; + long long g1[2]; + int eventcode = PAPI_TOT_INS; +- char eventname[PAPI_MAX_STR_LEN]; + PAPI_event_info_t info, info1, info2; + + tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ +@@ -52,18 +51,19 @@ main( int argc, char **argv ) + test_fail( __FILE__, __LINE__, "PAPI_stop", retval ); + + /* Case 0, no info, should fail */ +- eventname[0] = '\0'; + eventcode = 0; + /* + if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) == PAPI_OK) + test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval); + */ ++ if (!TESTS_QUIET) { ++ printf("This test expects a 'PAPI Error' to be returned from this PAPI call.\n"); ++ } + if ( ( retval = PAPI_get_event_info( eventcode, &info ) ) == PAPI_OK ) + test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval ); + + /* Case 1, fill in name field. */ + eventcode = PAPI_TOT_INS; +- eventname[0] = '\0'; + /* + if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) != PAPI_OK) + test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval); +@@ -85,11 +85,9 @@ main( int argc, char **argv ) + if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) != PAPI_OK) + test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval); + */ +- strcpy( eventname, info1.symbol ); +- if ( ( retval = +- PAPI_event_name_to_code( eventname, +- ( int * ) &eventcode ) ) != PAPI_OK ) ++ if ( ( retval = PAPI_event_name_to_code( info1.symbol, ( int * ) &eventcode ) ) != PAPI_OK ) { + test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code", retval ); ++ } + + if ( eventcode != PAPI_TOT_INS ) + test_fail( __FILE__, __LINE__, +diff --git a/src/ctests/get_event_component.c b/src/ctests/get_event_component.c +index ae1bdd9..874f394 100644 +--- a/src/ctests/get_event_component.c ++++ b/src/ctests/get_event_component.c +@@ -42,8 +42,7 @@ main( int argc, char **argv ) + test_fail( __FILE__, __LINE__, "PAPI_get_component_info", 2 ); + } + +- if (cmpinfo->disabled) +- { ++ if (cmpinfo->disabled && !TESTS_QUIET) { + printf( "Name: %-23s %s\n", cmpinfo->name ,cmpinfo->description); + printf(" \\-> Disabled: %s\n",cmpinfo->disabled_reason); + continue; +@@ -55,7 +54,12 @@ main( int argc, char **argv ) + if (retval!=PAPI_OK) continue; + + do { +- retval = PAPI_get_event_info( i, &info ); ++ if (PAPI_get_event_info( i, &info ) != PAPI_OK) { ++ if (!TESTS_QUIET) { ++ printf("Getting information about event: %#x failed\n", i); ++ } ++ continue; ++ } + our_cid=PAPI_get_event_component(i); + + if (our_cid!=cid) { +diff --git a/src/ctests/krentel_pthreads.c b/src/ctests/krentel_pthreads.c +index a8b97ff..2417976 100644 +--- a/src/ctests/krentel_pthreads.c ++++ b/src/ctests/krentel_pthreads.c +@@ -125,11 +125,18 @@ my_thread( void *v ) + } + + PAPI_stop( EventSet, &value ); +- PAPI_remove_event( EventSet, EVENT ); +- PAPI_destroy_eventset( &EventSet ); ++ retval = PAPI_remove_event( EventSet, EVENT ); ++ if ( PAPI_OK != retval ) { ++ test_fail( __FILE__, __LINE__, "PAPI_remove_event", retval ); ++ } ++ retval = PAPI_destroy_eventset( &EventSet ); ++ if ( PAPI_OK != retval ) { ++ test_fail( __FILE__, __LINE__, "PAPI_destroy_eventset", retval ); ++ } + retval = PAPI_unregister_thread( ); +- if ( retval != PAPI_OK ) ++ if ( PAPI_OK != retval ) { + test_fail( __FILE__, __LINE__, "PAPI_unregister_thread", retval ); ++ } + return ( NULL ); + } + +commit 266c61a4d4e5beee43cce7e3ef1d64da202c0b09 +Author: James Ralph +Date: Fri Sep 19 17:46:42 2014 -0400 + + Address coverity reported issues in src/ + + Thanks to Gary Mohr + ------------------- + Changes in this patch file: + + linux-common.c: Add code to insure that cpu info vendor_string and + model_string buffers are NULL terminated strings. Also insure that + the value which gets read into mdi->exe_info.fullname gets NULL + terminated. This makes it safe to use the 'strxxx' functions on the + value (which is done immediately after it is read in). + + papi_hl.c: Fix call to _hl_rate_calls() where the third argument was + not the correct data type. + + papi_internal.c: Add code to insure that event info name, short_desc, + and long_desc buffers are NULL terminated strings. + + papi_user_events.c: While processing define symbols, insure that the + 'local_line', 'name', and 'value' + buffers get NULL terminated (so we can safely use + 'strxxx' functions on them). + Insure that the 'symbol' field in the user defined + event ends up NULL terminated. + Rearrange code to avoid falling through from one + case to the next in a switch statement. + Coverity flagged falling out the bottom of a case + statement as a potential defect but it + was doing what it should. + + sw_multiplex.c: Unnecessary test. The value of ESI can not be NULL + when this code is reached. + + x86_cpuid_info.c: The variable need_leaf4 is set but not used. The + only place it gets set returns without + checking its value. The place that checks its value + never could have set its value non-zero. + +diff --git a/src/linux-common.c b/src/linux-common.c +index 4adc232..614a83c 100644 +--- a/src/linux-common.c ++++ b/src/linux-common.c +@@ -171,6 +171,7 @@ int + _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz ) + { + int tmp, retval = PAPI_OK; ++ unsigned int strSize; + char maxargs[PAPI_HUGE_STR_LEN], *t, *s; + float mhz = 0.0; + FILE *f; +@@ -197,14 +198,17 @@ _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz ) + /* Vendor Name and Vendor Code */ + rewind( f ); + s = search_cpu_info( f, "vendor_id", maxargs ); ++ strSize = sizeof(hwinfo->vendor_string); + if ( s && ( t = strchr( s + 2, '\n' ) ) ) { + *t = '\0'; ++ if (strlen(s+2) >= strSize-1) s[strSize+1] = '\0'; + strcpy( hwinfo->vendor_string, s + 2 ); + } else { + rewind( f ); + s = search_cpu_info( f, "vendor", maxargs ); + if ( s && ( t = strchr( s + 2, '\n' ) ) ) { + *t = '\0'; ++ if (strlen(s+2) >= strSize-1) s[strSize+1] = '\0'; + strcpy( hwinfo->vendor_string, s + 2 ); + } else { + rewind( f ); +@@ -212,6 +216,7 @@ _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz ) + if ( s && ( t = strchr( s + 2, '\n' ) ) ) { + *t = '\0'; + s = strtok( s + 2, " " ); ++ if (strlen(s) >= strSize-1) s[strSize-1] = '\0'; + strcpy( hwinfo->vendor_string, s ); + } else { + rewind( f ); +@@ -258,14 +263,17 @@ _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz ) + /* Model Name */ + rewind( f ); + s = search_cpu_info( f, "model name", maxargs ); ++ strSize = sizeof(hwinfo->model_string); + if ( s && ( t = strchr( s + 2, '\n' ) ) ) { + *t = '\0'; ++ if (strlen(s+2) >= strSize-1) s[strSize+1] = '\0'; + strcpy( hwinfo->model_string, s + 2 ); + } else { + rewind( f ); + s = search_cpu_info( f, "family", maxargs ); + if ( s && ( t = strchr( s + 2, '\n' ) ) ) { + *t = '\0'; ++ if (strlen(s+2) >= strSize-1) s[strSize+1] = '\0'; + strcpy( hwinfo->model_string, s + 2 ); + } else { + rewind( f ); +@@ -274,6 +282,7 @@ _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz ) + *t = '\0'; + strtok( s + 2, " " ); + s = strtok( NULL, " " ); ++ if (strlen(s) >= strSize-1) s[strSize-1] = '\0'; + strcpy( hwinfo->model_string, s ); + } else { + rewind( f ); +@@ -282,6 +291,7 @@ _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz ) + *t = '\0'; + /* get just the first token */ + s = strtok( s + 2, " " ); ++ if (strlen(s) >= strSize-1) s[strSize-1] = '\0'; + strcpy( hwinfo->model_string, s ); + } + } +@@ -444,15 +454,18 @@ _linux_get_system_info( papi_mdi_t *mdi ) { + mdi->pid = pid; + + sprintf( maxargs, "/proc/%d/exe", ( int ) pid ); +- if ( readlink( maxargs, mdi->exe_info.fullname, PAPI_HUGE_STR_LEN ) < 0 ) { ++ if ( (retval = readlink( maxargs, mdi->exe_info.fullname, PAPI_HUGE_STR_LEN-1 )) < 0 ) { + PAPIERROR( "readlink(%s) returned < 0", maxargs ); + return PAPI_ESYS; + } ++ if (retval > PAPI_HUGE_STR_LEN-1) retval=PAPI_HUGE_STR_LEN-1; ++ mdi->exe_info.fullname[retval] = '\0'; + + /* Careful, basename can modify it's argument */ + + strcpy( maxargs, mdi->exe_info.fullname ); +- strcpy( mdi->exe_info.address_info.name, basename( maxargs ) ); ++ strncpy( mdi->exe_info.address_info.name, basename( maxargs ), PAPI_HUGE_STR_LEN-1); ++ mdi->exe_info.address_info.name[PAPI_HUGE_STR_LEN-1] = '\0'; + + SUBDBG( "Executable is %s\n", mdi->exe_info.address_info.name ); + SUBDBG( "Full Executable is %s\n", mdi->exe_info.fullname ); +diff --git a/src/papi_hl.c b/src/papi_hl.c +index 19111e7..4fcfe23 100644 +--- a/src/papi_hl.c ++++ b/src/papi_hl.c +@@ -204,13 +204,13 @@ int + PAPI_flips( float *rtime, float *ptime, long long *flpins, float *mflips ) + { + int retval; +- int events = PAPI_FP_INS; ++ int events[1] = {PAPI_FP_INS}; + long long values = 0; + + if ( rtime == NULL || ptime == NULL || flpins == NULL || mflips == NULL ) + return PAPI_EINVAL; + +- retval = _hl_rate_calls( rtime, ptime, &events, &values, flpins, mflips, HL_FLIP ); ++ retval = _hl_rate_calls( rtime, ptime, events, &values, flpins, mflips, HL_FLIP ); + return ( retval ); + } + +@@ -259,13 +259,13 @@ int + PAPI_flops( float *rtime, float *ptime, long long *flpops, float *mflops ) + { + int retval; +- int events = PAPI_FP_OPS; ++ int events[1] = {PAPI_FP_OPS}; + long long values = 0; + + if ( rtime == NULL || ptime == NULL || flpops == NULL || mflops == NULL ) + return PAPI_EINVAL; + +- retval = _hl_rate_calls( rtime, ptime, &events, &values, flpops, mflops, HL_FLOP ); ++ retval = _hl_rate_calls( rtime, ptime, events, &values, flpops, mflops, HL_FLOP ); + return ( retval ); + } + +diff --git a/src/papi_internal.c b/src/papi_internal.c +index d354b76..3c51717 100644 +--- a/src/papi_internal.c ++++ b/src/papi_internal.c +@@ -2162,20 +2162,22 @@ _papi_hwi_get_preset_event_info( int EventCode, PAPI_event_info_t * info ) + unsigned int j; + + if ( _papi_hwi_presets[i].symbol ) { /* if the event is in the preset table */ +- /* set whole structure to 0 */ ++ // since we are setting the whole structure to zero the strncpy calls below will ++ // be leaving NULL terminates strings as long as they copy 1 less byte than the ++ // buffer size of the field. + memset( info, 0, sizeof ( PAPI_event_info_t ) ); + + info->event_code = ( unsigned int ) EventCode; + strncpy( info->symbol, _papi_hwi_presets[i].symbol, +- sizeof(info->symbol)); ++ sizeof(info->symbol)-1); + + if ( _papi_hwi_presets[i].short_descr != NULL ) + strncpy( info->short_descr, _papi_hwi_presets[i].short_descr, +- sizeof ( info->short_descr ) ); ++ sizeof ( info->short_descr )-1 ); + + if ( _papi_hwi_presets[i].long_descr != NULL ) + strncpy( info->long_descr, _papi_hwi_presets[i].long_descr, +- sizeof ( info->long_descr ) ); ++ sizeof ( info->long_descr )-1 ); + + info->event_type = _papi_hwi_presets[i].event_type; + info->count = _papi_hwi_presets[i].count; +@@ -2185,17 +2187,17 @@ _papi_hwi_get_preset_event_info( int EventCode, PAPI_event_info_t * info ) + + if ( _papi_hwi_presets[i].postfix != NULL ) + strncpy( info->postfix, _papi_hwi_presets[i].postfix, +- sizeof ( info->postfix ) ); ++ sizeof ( info->postfix )-1 ); + + for(j=0;j < info->count; j++) { + info->code[j]=_papi_hwi_presets[i].code[j]; + strncpy(info->name[j], _papi_hwi_presets[i].name[j], +- sizeof(info->name[j])); ++ sizeof(info->name[j])-1); + } + + if ( _papi_hwi_presets[i].note != NULL ) { + strncpy( info->note, _papi_hwi_presets[i].note, +- sizeof ( info->note ) ); ++ sizeof ( info->note )-1 ); + } + + return PAPI_OK; +diff --git a/src/papi_user_events.c b/src/papi_user_events.c +index 04fc4af..b1f124a 100644 +--- a/src/papi_user_events.c ++++ b/src/papi_user_events.c +@@ -246,10 +246,11 @@ get_event_line( char **place, FILE * table, char **tmp_perfmon_events_table ) + + int add_define( char *line, list_t* LIST ) { + char *t; +- char local_line[USER_EVENT_OPERATION_LEN]; ++ char local_line[USER_EVENT_OPERATION_LEN+1]; + list_t *temp; + + strncpy( local_line, line, USER_EVENT_OPERATION_LEN ); ++ local_line[USER_EVENT_OPERATION_LEN] = '\0'; + + temp = (list_t*)papi_malloc(sizeof(list_t)); + +@@ -262,12 +263,14 @@ int add_define( char *line, list_t* LIST ) { + + /* next token should be the name */ + t = strtok(NULL, " "); +- strncpy( temp->name, t, PAPI_MIN_STR_LEN); ++ strncpy( temp->name, t, PAPI_MIN_STR_LEN-1); ++ temp->name[PAPI_MIN_STR_LEN-1] = '\0'; + + /* next token should be the value */ + t = strtok(NULL," "); + t[strlen(t)] = '\0'; +- strncpy( temp->value, t, PAPI_MIN_STR_LEN); ++ strncpy( temp->value, t, PAPI_MIN_STR_LEN-1); ++ temp->value[PAPI_MIN_STR_LEN-1] = '\0'; + + temp->next = LIST->next; + LIST->next = temp; +@@ -395,12 +398,15 @@ check_preset_events (char *target, user_defined_event_t* ue, int* msi) + strcat(ue->operation, temp); + ue->events[ue->count++] = _papi_hwi_presets[j].code[0]; + } else { +- op = '-'; + switch ( _papi_hwi_presets[j].derived_int ) { + case DERIVED_ADD: + case DERIVED_ADD_PS: +- op = '+'; + case DERIVED_SUB: ++ if (_papi_hwi_presets[j].derived_int == DERIVED_SUB) { ++ op = '-'; ++ } else { ++ op = '+'; ++ } + for ( k = 0; k < (int) _papi_hwi_presets[j].count; k++) { + ue->events[ue->count++] = _papi_hwi_presets[j].code[k]; + if (k%2) +@@ -574,7 +580,8 @@ load_user_event_table( char *file_name) + goto nextline; + } + +- strncpy(foo->symbol, t, PAPI_MIN_STR_LEN); ++ // the entire structure was zeroed so if we only copy one less that what fits in the 'symbol' buffer, it will insure that this buffer is NULL terminated ++ strncpy(foo->symbol, t, PAPI_MIN_STR_LEN-1); + #ifdef SHOW_LOADS + INTDBG("Found a user event named %s\n", foo->symbol ); + #endif +diff --git a/src/sw_multiplex.c b/src/sw_multiplex.c +index 22db6c2..4b2109c 100644 +--- a/src/sw_multiplex.c ++++ b/src/sw_multiplex.c +@@ -1136,8 +1136,6 @@ mpx_check( int EventSet ) + if ( strcmp( _papi_hwi_system_info.hw_info.model_string, "POWER6" ) == 0 ) { + unsigned int chk_domain = + PAPI_DOM_USER + PAPI_DOM_KERNEL + PAPI_DOM_SUPERVISOR; +- if ( ESI == NULL ) +- return ( PAPI_ENOEVST ); + + if ( ( ESI->domain.domain & chk_domain ) != chk_domain ) { + PAPIERROR +diff --git a/src/x86_cpuid_info.c b/src/x86_cpuid_info.c +index dacc021..2527f3c 100644 +--- a/src/x86_cpuid_info.c ++++ b/src/x86_cpuid_info.c +@@ -1416,8 +1416,6 @@ init_intel_leaf2( PAPI_mh_info_t * mh_info , int *num_levels) + int size; /* size of the descriptor table */ + int last_level = 0; /* how many levels in the cache hierarchy */ + +- int need_leaf4=0; +- + /* All of Intel's cache info is in 1 call to cpuid + * however it is a table lookup :( + */ +@@ -1459,7 +1457,6 @@ init_intel_leaf2( PAPI_mh_info_t * mh_info , int *num_levels) + if ( i ) { /* skip the low order byte in eax [0]; it's the count (see above) */ + if ( reg.descrip[i] == 0xff ) { + MEMDBG("Warning! PAPI x86_cache: must implement cpuid leaf 4\n"); +- need_leaf4=1; + return PAPI_ENOSUPP; + /* we might continue instead */ + /* in order to get TLB info */ +@@ -1480,9 +1477,6 @@ init_intel_leaf2( PAPI_mh_info_t * mh_info , int *num_levels) + early_exit: + MEMDBG( "# of Levels: %d\n", last_level ); + *num_levels=last_level; +- if (need_leaf4) { +- return PAPI_ENOSUPP; +- } + return PAPI_OK; + } + diff --git a/SOURCES/papi-hsw_ep.patch b/SOURCES/papi-hsw_ep.patch new file mode 100644 index 0000000..2b37e24 --- /dev/null +++ b/SOURCES/papi-hsw_ep.patch @@ -0,0 +1,31 @@ +From e5b1007a1c2ec49548104291f5a4ec5ee4d8ebfc Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Tue, 14 Oct 2014 10:30:17 -0400 +Subject: [PATCH] Recognize hsw_ep from newer versions of libpfm + +A recent September 11, 2014 patch (98c00b) to the upstream libpfm +split out Intel family 6 model 63 into its own name of "hsw_ep". The +papi_events.csv needs to be updated to support that new name. This +should have now impact for older libpfms that still identify Intel +family 6 model 63 as "hswv" and "hsw_ep" map to the same papi presets. + +Signed-off-by: William Cohen +--- + src/papi_events.csv | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index aea3b04..752ec20 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -638,6 +638,7 @@ PRESET,PAPI_TLB_DM,DERIVED_ADD,DTLB_LOAD_MISSES:DEMAND_LD_MISS_CAUSES_A_WALK,DTL + + # Intel Haswell events (and most likely also Sandy Bridge) + CPU,hsw ++CPU,hsw_ep + PRESET,PAPI_TOT_CYC,NOT_DERIVED,CPU_CLK_UNHALTED:THREAD_P + PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED:ANY_P + PRESET,PAPI_REF_CYC,NOT_DERIVED,CPU_CLK_THREAD_UNHALTED:REF_XCLK +-- +1.9.3 + diff --git a/SOURCES/papi-intel.patch b/SOURCES/papi-intel.patch index da2a8a1..4a9bcc6 100644 --- a/SOURCES/papi-intel.patch +++ b/SOURCES/papi-intel.patch @@ -215,3 +215,228 @@ index 42c1da0..0e1163e 100644 -- 1.8.3.1 +commit c50e0dfed7e0624061d81059bbf6157ae6873e11 +Author: Vince Weaver +Date: Wed Mar 26 16:41:34 2014 -0400 + + remove Hawell PAPI_L1_TCA predefined event + + It was making the tests complain a lot, and as far as I can + tell there's no way to make the event. + + It had been set to + + MEM_LOAD_UOPS_RETIRED:L1_HIT:L1_MISS + + but you cannot have multiple umasks on MEM_LOAD_UOPS_RETIRED + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index 22a82ad..e449529 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -641,7 +641,6 @@ PRESET,PAPI_LD_INS,NOT_DERIVED,MEM_UOPS_RETIRED:ALL_LOADS + PRESET,PAPI_SR_INS,NOT_DERIVED,MEM_UOPS_RETIRED:ALL_STORES + PRESET,PAPI_LST_INS,DERIVED_ADD,MEM_UOPS_RETIRED:ALL_LOADS,MEM_UOPS_RETIRED:ALL_STORES + # L1 cache +-PRESET,PAPI_L1_TCA,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_HIT:L1_MISS + PRESET,PAPI_L1_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_HIT + PRESET,PAPI_L1_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_MISS + PRESET,PAPI_L1_ICM,NOT_DERIVED,L2_RQSTS:ALL_CODE_RD +commit a870eef277ea782e15f91582ce87c46652932e77 +Author: James Ralph +Date: Wed Apr 9 16:18:11 2014 -0400 + + Add x87 counts to FP_INS and FP_OPS on [S|I]VB + + In Sandy/Ivy Bridge processors it is safe to assume 3 general counters + and the definition of FP_OPS/INS was only using 2. This commit changes + the definition PAPI_FP_INS/OPS to include FP_COMP_OPS_EXEC:X87 + + The effect appears minimal and improves counts with naively compiled + LAPACK. ( gfortran version 4.6 on an IvyBridge with the default build + paramaters for LAPACK produced no SSE/AVX ins, it did all its work + with X87 ins) + + If issues arise, this is safe to revert. + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index e449529..441844e 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -601,8 +601,8 @@ PRESET,PAPI_LD_INS,NOT_DERIVED,MEM_UOP_RETIRED:ANY_LOADS + PRESET,PAPI_SR_INS,NOT_DERIVED,MEM_UOP_RETIRED:ANY_STORES + # + # Counts scalars only; no SSE or AVX is counted; includes speculative +-PRESET,PAPI_FP_INS,DERIVED_ADD,FP_COMP_OPS_EXE:SSE_SCALAR_DOUBLE,FP_COMP_OPS_EXE:SSE_FP_SCALAR_SINGLE +-PRESET,PAPI_FP_OPS,DERIVED_ADD,FP_COMP_OPS_EXE:SSE_SCALAR_DOUBLE,FP_COMP_OPS_EXE:SSE_FP_SCALAR_SINGLE ++PRESET,PAPI_FP_INS,DERIVED_ADD,FP_COMP_OPS_EXE:SSE_SCALAR_DOUBLE,FP_COMP_OPS_EXE:SSE_FP_SCALAR_SINGLE,FP_COMP_OPS_EXE:X87 ++PRESET,PAPI_FP_OPS,DERIVED_ADD,FP_COMP_OPS_EXE:SSE_SCALAR_DOUBLE,FP_COMP_OPS_EXE:SSE_FP_SCALAR_SINGLE,FP_COMP_OPS_EXE:X87 + # + PRESET,PAPI_SP_OPS,DERIVED_POSTFIX,N0|N1|4|*|N2|8|*|+|+|,FP_COMP_OPS_EXE:SSE_FP_SCALAR_SINGLE,FP_COMP_OPS_EXE:SSE_PACKED_SINGLE,SIMD_FP_256:PACKED_SINGLE + PRESET,PAPI_DP_OPS,DERIVED_POSTFIX,N0|N1|2|*|N2|4|*|+|+|,FP_COMP_OPS_EXE:SSE_SCALAR_DOUBLE,FP_COMP_OPS_EXE:SSE_FP_PACKED_DOUBLE,SIMD_FP_256:PACKED_DOUBLE +commit 4c87d753ab56688acad5bf0cb3b95eae8aa80458 +Author: James Ralph +Date: Fri Jun 27 14:06:17 2014 -0400 + + Update preset mappings for Intel Haswell + + Patch due to Michel Brown @ Bull, many thanks. + ---------------------------------------------- + As I did for some earlier CPUs, I have made an update to the Haswell Preset + Cache Events to provide a more accurate and a more complete set of preset + cache events. + + I have validated with a test program all the events except the I-cache events. + The Haswell CPU used for the test was an “Intel(R) Xeon(R) CPU E5-2683 v3 @ + 2.00GHz” model 63. + + I defined a couple of events that are not currently accepted by the preset + mechanism: PAPI_L2_LDH (Level 2 Cache Load Hits) and PAPI_L3_LDH (Level 3 Cache + Load Hits). I have validated the native events used for these presets. + + I will leave it to you decide whether these presets should be included. + They are in the file; but are commented out. + + The preset file for Haswell is already organized with the L1, L2 and L3 events + grouped together. For the preset definitions I felt it necessary to replace, + I commented them out. For the ones I added I put in a section following the + current group beginning with a “# Added by FMB” comment. + ---------------------------------------------- + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index dbbc8d8..97fd2ca 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -621,6 +621,11 @@ PRESET,PAPI_TLB_DM,DERIVED_ADD,DTLB_LOAD_MISSES:CAUSES_A_WALK,DTLB_STORE_MISSES: + # + # Intel IvyBridge only + CPU,ivb ++# Added by FMB ++PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D:REPLACEMENT ++PRESET,PAPI_L1_LDM,NOT_DERIVED,L2_TRANS:DEMAND_DATA_RD ++PRESET,PAPI_L1_STM,NOT_DERIVED,L2_TRANS:L1D_WB ++PRESET,PAPI_L1_TCM,DERIVED_ADD,L2_RQSTS:ALL_DEMAND_REFERENCES,L2_RQSTS:ALL_CODE_RD + CPU,ivb_ep + # + PRESET,PAPI_L2_TCW,NOT_DERIVED,L2_RQSTS:ALL_RFO +@@ -646,19 +651,42 @@ PRESET,PAPI_L1_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_MISS + PRESET,PAPI_L1_ICM,NOT_DERIVED,L2_RQSTS:ALL_CODE_RD + # L2 cache + PRESET,PAPI_L2_DCA,NOT_DERIVED,L2_RQSTS:ALL_DEMAND_REFERENCES +-PRESET,PAPI_L2_DCH,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_HIT +-PRESET,PAPI_L2_DCM,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_MISS ++#PRESET,PAPI_L2_DCH,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_HIT ++#PRESET,PAPI_L2_DCM,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_MISS + PRESET,PAPI_L2_DCR,NOT_DERIVED,L2_RQSTS:ALL_DEMAND_DATA_RD + PRESET,PAPI_L2_ICH,NOT_DERIVED,L2_RQSTS:CODE_RD_HIT + PRESET,PAPI_L2_ICM,NOT_DERIVED,L2_RQSTS:CODE_RD_MISS + PRESET,PAPI_L2_ICR,NOT_DERIVED,L2_RQSTS:ALL_CODE_RD +-PRESET,PAPI_L2_TCA,NOT_DERIVED,L2_RQSTS:REFERENCES +-PRESET,PAPI_L2_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L2_HIT +-PRESET,PAPI_L2_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L2_MISS ++#PRESET,PAPI_L2_TCA,NOT_DERIVED,L2_RQSTS:REFERENCES ++#PRESET,PAPI_L2_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L2_HIT ++#PRESET,PAPI_L2_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L2_MISS ++# Added by FMB ++PRESET,PAPI_L2_DCM,DERIVED_SUB,LLC_REFERENCES,L2_RQSTS:CODE_RD_MISS ++PRESET,PAPI_L2_DCW,NOT_DERIVED,L2_TRANS:RFO ++PRESET,PAPI_L2_ICA,NOT_DERIVED,L2_RQSTS:ALL_CODE_RD ++#PRESET,PAPI_L2_LDH,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_HIT ++PRESET,PAPI_L2_LDM,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_MISS ++PRESET,PAPI_L2_STM,NOT_DERIVED,L2_RQSTS:DEMAND_RFO_MISS ++PRESET,PAPI_L2_TCA,DERIVED_ADD,L2_RQSTS:ALL_DEMAND_REFERENCES,L2_RQSTS:ALL_CODE_RD ++PRESET,PAPI_L2_TCM,NOT_DERIVED,LLC_REFERENCES ++PRESET,PAPI_L2_TCR,DERIVED_ADD,L2_RQSTS:ALL_DEMAND_DATA_RD,L2_RQSTS:ALL_CODE_RD ++PRESET,PAPI_L2_TCW,NOT_DERIVED,L2_TRANS:RFO + # L3 cache +-PRESET,PAPI_L3_TCA,NOT_DERIVED,LONGEST_LAT_CACHE:REFERENCE +-PRESET,PAPI_L3_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L3_HIT +-PRESET,PAPI_L3_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L3_MISS ++#PRESET,PAPI_L3_TCA,NOT_DERIVED,LONGEST_LAT_CACHE:REFERENCE ++#PRESET,PAPI_L3_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L3_HIT ++#PRESET,PAPI_L3_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L3_MISS ++# Added by FMB ++PRESET,PAPI_L3_DCA,DERIVED_SUB,LLC_REFERENCES,L2_RQSTS:CODE_RD_MISS ++PRESET,PAPI_L3_DCR,NOT_DERIVED,OFFCORE_REQUESTS:DEMAND_DATA_RD ++PRESET,PAPI_L3_DCW,NOT_DERIVED,L2_RQSTS:DEMAND_RFO_MISS ++PRESET,PAPI_L3_ICA,NOT_DERIVED,L2_RQSTS:CODE_RD_MISS ++PRESET,PAPI_L3_ICR,NOT_DERIVED,L2_RQSTS:CODE_RD_MISS ++#PRESET,PAPI_L3_LDH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L3_HIT ++PRESET,PAPI_L3_LDM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L3_MISS ++PRESET,PAPI_L3_TCA,NOT_DERIVED,LLC_REFERENCES ++PRESET,PAPI_L3_TCM,NOT_DERIVED,LLC_MISSES ++PRESET,PAPI_L3_TCR,DERIVED_SUB,LLC_REFERENCES,L2_RQSTS:DEMAND_RFO_MISS ++PRESET,PAPI_L3_TCW,NOT_DERIVED,L2_RQSTS:DEMAND_RFO_MISS + # SMP + PRESET,PAPI_CA_SNP,NOT_DERIVED,OFFCORE_RESPONSE_0:SNP_ANY + PRESET,PAPI_CA_SHR,NOT_DERIVED,OFFCORE_REQUESTS:ALL_DATA_RD +commit bf55b6b72f3ad6df59050739c248bc94ad9c6722 +Author: James Ralph +Date: Thu Jul 24 11:02:36 2014 -0400 + + Update HSW presets + + Thanks to Gary Mohr + ------------------- + Previously we sent updates to the PAPI preset event definitions to improve the + preset cache events on Haswell processors. In checking the latest source, it + looks like the L1 cache events changes did not get applied quite right. Here + is a patch to the latest source that will make it the way we had intended. + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index 97fd2ca..aea3b04 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -646,9 +646,14 @@ PRESET,PAPI_LD_INS,NOT_DERIVED,MEM_UOPS_RETIRED:ALL_LOADS + PRESET,PAPI_SR_INS,NOT_DERIVED,MEM_UOPS_RETIRED:ALL_STORES + PRESET,PAPI_LST_INS,DERIVED_ADD,MEM_UOPS_RETIRED:ALL_LOADS,MEM_UOPS_RETIRED:ALL_STORES + # L1 cache +-PRESET,PAPI_L1_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_HIT +-PRESET,PAPI_L1_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_MISS ++#PRESET,PAPI_L1_TCH,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_HIT ++#PRESET,PAPI_L1_TCM,NOT_DERIVED,MEM_LOAD_UOPS_RETIRED:L1_MISS + PRESET,PAPI_L1_ICM,NOT_DERIVED,L2_RQSTS:ALL_CODE_RD ++# Added by FMB ++PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D:REPLACEMENT ++PRESET,PAPI_L1_LDM,NOT_DERIVED,L2_TRANS:DEMAND_DATA_RD ++PRESET,PAPI_L1_STM,NOT_DERIVED,L2_TRANS:L1D_WB ++PRESET,PAPI_L1_TCM,DERIVED_ADD,L2_RQSTS:ALL_DEMAND_REFERENCES,L2_RQSTS:ALL_CODE_RD + # L2 cache + PRESET,PAPI_L2_DCA,NOT_DERIVED,L2_RQSTS:ALL_DEMAND_REFERENCES + #PRESET,PAPI_L2_DCH,NOT_DERIVED,L2_RQSTS:DEMAND_DATA_RD_HIT +From bb8143e44aa9c249c79c3fd820e55678b01b19fa Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Sun, 28 Sep 2014 11:32:43 -0400 +Subject: [PATCH] Remove stray Intel Haswell events from Intel Ivy Bridge + presets + +Commit 4c87d753ab56688acad5bf0cb3b95eae8aa80458 added some events +meant for Intel Haswell to the Intel Ivy bridge presets. This patch +removes those stray events. Without this patch on Intel Ivy Bridge +machines would see messages like the following: + +PAPI Error: papi_preset: Error finding event L2_TRANS:DEMAND_DATA_RD. +PAPI Error: papi_preset: Error finding event L2_RQSTS:ALL_DEMAND_REFERENCES. +--- + src/papi_events.csv | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/src/papi_events.csv b/src/papi_events.csv +index aea3b04..d6566c0 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -621,11 +621,6 @@ PRESET,PAPI_TLB_DM,DERIVED_ADD,DTLB_LOAD_MISSES:CAUSES_A_WALK,DTLB_STORE_MISSES: + # + # Intel IvyBridge only + CPU,ivb +-# Added by FMB +-PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D:REPLACEMENT +-PRESET,PAPI_L1_LDM,NOT_DERIVED,L2_TRANS:DEMAND_DATA_RD +-PRESET,PAPI_L1_STM,NOT_DERIVED,L2_TRANS:L1D_WB +-PRESET,PAPI_L1_TCM,DERIVED_ADD,L2_RQSTS:ALL_DEMAND_REFERENCES,L2_RQSTS:ALL_CODE_RD + CPU,ivb_ep + # + PRESET,PAPI_L2_TCW,NOT_DERIVED,L2_RQSTS:ALL_RFO +-- +1.9.3 + diff --git a/SOURCES/papi-sys_mem_info.patch b/SOURCES/papi-sys_mem_info.patch new file mode 100644 index 0000000..2e43f2a --- /dev/null +++ b/SOURCES/papi-sys_mem_info.patch @@ -0,0 +1,33 @@ +From 3cf33279bcfc69b41bbfae827e4a1e6b3917d7a2 Mon Sep 17 00:00:00 2001 +From: Carl Love +Date: Fri, 10 Oct 2014 13:07:11 -0500 +Subject: [PATCH] PPC64 sys_mem_info array size is wrong + +The variable sys_mem_info is an array of type PAPI_mh_info_t. It is +statically declared as size 4. The data for POWER8 is statically +declared in entry 4 of the array which is beyond the allocated array. The +array should be declared without a size so the compiler will automatically +determine the correct size based on the number of elements being +initialized. This patch makes the change. + +Signed-off-by: Carl Love +--- + src/linux-memory.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/linux-memory.c b/src/linux-memory.c +index bf6c420..1686299 100644 +--- a/src/linux-memory.c ++++ b/src/linux-memory.c +@@ -315,7 +315,7 @@ ia64_get_memory_info( PAPI_hw_info_t * hw_info ) + + #if defined(__powerpc__) + +-PAPI_mh_info_t sys_mem_info[4] = { ++PAPI_mh_info_t sys_mem_info[] = { + {2, // 970 begin + { + { // level 1 begins +-- +1.8.4.2 + diff --git a/SOURCES/papi-xgene.patch b/SOURCES/papi-xgene.patch new file mode 100644 index 0000000..1318b9b --- /dev/null +++ b/SOURCES/papi-xgene.patch @@ -0,0 +1,34 @@ +diff --git a/src/papi_events.csv b/src/papi_events.csv +index dbbc8d8..1d91bb0 100644 +--- a/src/papi_events.csv ++++ b/src/papi_events.csv +@@ -1497,6 +1497,29 @@ PRESET,PAPI_L2_DCW,NOT_DERIVED,L2D_WRITE_ACCESS + PRESET,PAPI_L2_LDM,NOT_DERIVED,L2D_READ_REFILL + PRESET,PAPI_L2_STM,NOT_DERIVED,L2D_WRITE_REFILL + # ++CPU,arm_xgene ++# ++PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED ++PRESET,PAPI_TOT_CYC,NOT_DERIVED,CPU_CYCLES ++PRESET,PAPI_FP_INS,NOT_DERIVED,INST_SPEC_EXEC_VFP ++PRESET,PAPI_VEC_INS,NOT_DERIVED,INST_SPEC_EXEC_SIMD ++PRESET,PAPI_BR_INS,NOT_DERIVED,INST_SPEC_EXEC_SOFT_PC ++PRESET,PAPI_BR_MSP,NOT_DERIVED,BRANCH_MISPRED ++PRESET,PAPI_LD_INS,NOT_DERIVED,DATA_MEM_READ_ACCESS ++PRESET,PAPI_SR_INS,NOT_DERIVED,DATA_MEM_WRITE_ACCESS ++PRESET,PAPI_L1_DCA,DERIVED_ADD,L1D_READ_ACCESS,L1D_WRITE_ACCESS ++PRESET,PAPI_L1_DCM,DERIVED_ADD,L1D_CACHE_REFILL ++PRESET,PAPI_L1_DCR,NOT_DERIVED,L1D_READ_ACCESS ++PRESET,PAPI_L1_DCW,NOT_DERIVED,L1D_WRITE_ACCESS ++PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE_ACCESS ++PRESET,PAPI_L1_ICM,NOT_DERIVED,L1I_CACHE_REFILL ++PRESET,PAPI_L2_DCH,NOT_DERIVED,L2D_CACHE_ACCESS ++PRESET,PAPI_L2_DCM,NOT_DERIVED,L2D_CACHE_REFILL ++PRESET,PAPI_L2_DCR,NOT_DERIVED,L2D_READ_ACCESS ++PRESET,PAPI_L2_DCW,NOT_DERIVED,L2D_WRITE_ACCESS ++PRESET,PAPI_L2_LDM,NOT_DERIVED,L2D_READ_REFILL ++PRESET,PAPI_L2_STM,NOT_DERIVED,L2D_WRITE_REFILL ++# + CPU,mips_74k + # + PRESET,PAPI_TOT_CYC,NOT_DERIVED,CYCLES diff --git a/SPECS/papi.spec b/SPECS/papi.spec index 4ab8ad0..4db71e6 100644 --- a/SPECS/papi.spec +++ b/SPECS/papi.spec @@ -2,13 +2,18 @@ Summary: Performance Application Programming Interface Name: papi Version: 5.2.0 -Release: 5%{?dist} +Release: 10%{?dist} License: BSD Group: Development/System URL: http://icl.cs.utk.edu/papi/ Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Patch100: papi-intel.patch +Patch200: papi-aarch64.patch +Patch201: papi-xgene.patch +Patch300: papi-coverity.patch +Patch400: papi-hsw_ep.patch +Patch500: papi-sys_mem_info.patch BuildRequires: autoconf BuildRequires: doxygen BuildRequires: ncurses-devel @@ -17,8 +22,8 @@ BuildRequires: kernel-headers >= 2.6.32 BuildRequires: chrpath BuildRequires: lm_sensors-devel %if %{without bundled_libpfm} -BuildRequires: libpfm-devel >= 4.4.0-5 -BuildRequires: libpfm-static >= 4.4.0-5 +BuildRequires: libpfm-devel >= 4.4.0-9 +BuildRequires: libpfm-static >= 4.4.0-9 %endif # Following required for net component BuildRequires: net-tools @@ -59,6 +64,11 @@ the PAPI user-space libraries and interfaces. %prep %setup -q %patch100 -p1 +%patch200 -p1 +%patch201 -p1 +%patch300 -p1 +%patch400 -p1 +%patch500 -p1 %build %if %{without bundled_libpfm} @@ -140,6 +150,22 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.a %changelog +* Thu Oct 16 2014 William Cohen - 5.2.0-10 +- Bump and rebuid for chained build. rhbz1126091 + +* Wed Oct 15 2014 Frank Ch. Eigler - 5.2.0-9 +- Make sys_mem_info size dynamic. Related rhbz1152641. + +* Tue Oct 14 2014 William Cohen - 5.2.0-8 +- Recognize hsw_ep from libpfm. Related rhbz1126090 + +* Thu Sep 25 2014 William Cohen - 5.2.0-7 +- Update papi presets for Intel processors. Resolves rhbz1126090 +- Eliminate some errors found by coverity. Releated rhbz1057778 + +* Thu Sep 4 2014 William Cohen - 5.2.0-6 +- Add ARM aarch64 (APM X-Gene and Cortex A57) support. Resolves rhbz963458. + * Tue Jan 14 2014 William Cohen - 5.2.0-5 - Add presets for Intel Silvermont.