Fix rhbz2007882, rhbz2007883, and rhbz2007877
This commit is contained in:
		
							parent
							
								
									ab0e12886d
								
							
						
					
					
						commit
						60da07ee04
					
				
							
								
								
									
										139
									
								
								papi-thread_init.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								papi-thread_init.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,139 @@ | |||||||
|  | commit 617eeabe0bbfb5357c10b22ebd72b24a4a872e52 | ||||||
|  | Author: Anthony <adanalis@icl.utk.edu> | ||||||
|  | Date:   Mon Jan 6 15:09:42 2020 -0500 | ||||||
|  | 
 | ||||||
|  |     Updated the variables that are used in the debug messages in accordance to a previous commit that made these variables thread safe. | ||||||
|  | 
 | ||||||
|  | diff --git a/src/papi_internal.c b/src/papi_internal.c
 | ||||||
|  | index f0e457bf7..69b2914d0 100644
 | ||||||
|  | --- a/src/papi_internal.c
 | ||||||
|  | +++ b/src/papi_internal.c
 | ||||||
|  | @@ -114,7 +114,7 @@ _papi_hwi_free_papi_event_string() {
 | ||||||
|  |   | ||||||
|  |  void | ||||||
|  |  _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) { | ||||||
|  | -	INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
 | ||||||
|  | +	INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, _papi_hwi_my_thread->tls_papi_event_code);
 | ||||||
|  |   | ||||||
|  |  	// if call is just to reset and start over, set both flags to show nothing saved yet | ||||||
|  |  	if (update_flag < 0) { | ||||||
|  | @@ -131,7 +131,7 @@ _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) {
 | ||||||
|  |  } | ||||||
|  |  unsigned int | ||||||
|  |  _papi_hwi_get_papi_event_code () { | ||||||
|  | -	INTDBG("papi_event_code: %#x\n", papi_event_code);
 | ||||||
|  | +	INTDBG("papi_event_code: %#x\n", _papi_hwi_my_thread->tls_papi_event_code);
 | ||||||
|  |  	return _papi_hwi_my_thread->tls_papi_event_code; | ||||||
|  |  } | ||||||
|  |  /* Get the index into the ESI->NativeInfoArray for the current PAPI event code */ | ||||||
|  | From 3cc3b6679e1ace7516c3037105ad16410ce7d3db Mon Sep 17 00:00:00 2001 | ||||||
|  | From: William Cohen <wcohen@redhat.com> | ||||||
|  | Date: Wed, 12 Aug 2020 10:12:59 -0400 | ||||||
|  | Subject: [PATCH] Initialize component globals before threads globals | ||||||
|  | 
 | ||||||
|  | An earlier commit (979e80136) swapped the order of initializing | ||||||
|  | globals and threads.  This caused issues with the perf_event, appio, | ||||||
|  | and stealtime components which could be observed with the | ||||||
|  | all_native_events, appio_test_pthreads, and stealtime_basic tests | ||||||
|  | respectively.  The component initialization needs to be performed | ||||||
|  | before the thread initialization. | ||||||
|  | 
 | ||||||
|  | The order of initialization has been changed back to initializing the | ||||||
|  | component then the threads.  One complication is that papi_internal.c | ||||||
|  | had functions (_papi_hwi_set_papi_event_code and | ||||||
|  | _papi_hwi_get_papi_event_code) that required thread local storage that | ||||||
|  | was being setup in commit 979e80136 by the thread initialization. | ||||||
|  | This was the original reason for swapping the order of initialization | ||||||
|  | of component and thread.  Using __thread on the file scope | ||||||
|  | declarations of the variables allow the original order of | ||||||
|  | initialization. | ||||||
|  | ---
 | ||||||
|  |  src/papi.c          | 10 +++++----- | ||||||
|  |  src/papi_internal.c | 21 +++++++++++++-------- | ||||||
|  |  2 files changed, 18 insertions(+), 13 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/src/papi.c b/src/papi.c
 | ||||||
|  | index 33cc29935..107a15044 100644
 | ||||||
|  | --- a/src/papi.c
 | ||||||
|  | +++ b/src/papi.c
 | ||||||
|  | @@ -1151,19 +1151,19 @@ PAPI_library_init( int version )
 | ||||||
|  |  	   papi_return( init_retval ); | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | -	/* Initialize thread globals, including the main threads  */
 | ||||||
|  | +	/* Initialize component globals */
 | ||||||
|  |   | ||||||
|  | -	tmp = _papi_hwi_init_global_threads(  );
 | ||||||
|  | +	tmp = _papi_hwi_init_global(  );
 | ||||||
|  |  	if ( tmp ) { | ||||||
|  |  		init_retval = tmp; | ||||||
|  |  		_papi_hwi_shutdown_global_internal(  ); | ||||||
|  | -   	_in_papi_library_init_cnt--;
 | ||||||
|  | +		_in_papi_library_init_cnt--;
 | ||||||
|  |  		papi_return( init_retval ); | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  | -	/* Initialize component globals */
 | ||||||
|  | +	/* Initialize thread globals, including the main threads  */
 | ||||||
|  |   | ||||||
|  | -	tmp = _papi_hwi_init_global(  );
 | ||||||
|  | +	tmp = _papi_hwi_init_global_threads(  );
 | ||||||
|  |  	if ( tmp ) { | ||||||
|  |  		init_retval = tmp; | ||||||
|  |  		_papi_hwi_shutdown_global_internal(  ); | ||||||
|  | diff --git a/src/papi_internal.c b/src/papi_internal.c
 | ||||||
|  | index 5a1ccd433..bdf30f875 100644
 | ||||||
|  | --- a/src/papi_internal.c
 | ||||||
|  | +++ b/src/papi_internal.c
 | ||||||
|  | @@ -115,27 +115,32 @@ _papi_hwi_free_papi_event_string() {
 | ||||||
|  |  	return; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +// A place to keep the current papi event code so some component functions can fetch its value
 | ||||||
|  | +// The current event code can be stored here prior to component calls and cleared after the component returns
 | ||||||
|  | +static THREAD_LOCAL_STORAGE_KEYWORD unsigned int papi_event_code = -1;
 | ||||||
|  | +static THREAD_LOCAL_STORAGE_KEYWORD int papi_event_code_changed = -1;
 | ||||||
|  | +
 | ||||||
|  |  void | ||||||
|  |  _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) { | ||||||
|  | -	INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, _papi_hwi_my_thread->tls_papi_event_code);
 | ||||||
|  | +	INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
 | ||||||
|  |   | ||||||
|  |  	// if call is just to reset and start over, set both flags to show nothing saved yet | ||||||
|  |  	if (update_flag < 0) { | ||||||
|  | -		_papi_hwi_my_thread->tls_papi_event_code_changed = -1;
 | ||||||
|  | -		_papi_hwi_my_thread->tls_papi_event_code = -1;
 | ||||||
|  | +		papi_event_code_changed = -1;
 | ||||||
|  | +		papi_event_code = -1;
 | ||||||
|  |  		return; | ||||||
|  |  	} | ||||||
|  |   | ||||||
|  |  	// if 0, it is being set prior to calling a component, if >0 it is being changed by the component | ||||||
|  | -	_papi_hwi_my_thread->tls_papi_event_code_changed = update_flag;
 | ||||||
|  | +	papi_event_code_changed = update_flag;
 | ||||||
|  |  	// save the event code passed in | ||||||
|  | -	_papi_hwi_my_thread->tls_papi_event_code = event_code;
 | ||||||
|  | +	papi_event_code = event_code;
 | ||||||
|  |  	return; | ||||||
|  |  } | ||||||
|  |  unsigned int | ||||||
|  |  _papi_hwi_get_papi_event_code () { | ||||||
|  | -	INTDBG("papi_event_code: %#x\n", _papi_hwi_my_thread->tls_papi_event_code);
 | ||||||
|  | -	return _papi_hwi_my_thread->tls_papi_event_code;
 | ||||||
|  | +	INTDBG("papi_event_code: %#x\n", papi_event_code);
 | ||||||
|  | +	return papi_event_code;
 | ||||||
|  |  } | ||||||
|  |  /* Get the index into the ESI->NativeInfoArray for the current PAPI event code */ | ||||||
|  |  int | ||||||
|  | @@ -560,7 +565,7 @@ _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char
 | ||||||
|  |   | ||||||
|  |    int result; | ||||||
|  |   | ||||||
|  | -  if (_papi_hwi_my_thread->tls_papi_event_code_changed > 0) {
 | ||||||
|  | +  if (papi_event_code_changed > 0) {
 | ||||||
|  |  	  result = _papi_hwi_get_papi_event_code(); | ||||||
|  |  	  INTDBG("EXIT: papi_event_code: %#x set by the component\n", result); | ||||||
|  |  	  return result; | ||||||
|  | -- 
 | ||||||
|  | 2.26.2 | ||||||
|  | 
 | ||||||
| @ -11,7 +11,7 @@ | |||||||
| Summary: Performance Application Programming Interface | Summary: Performance Application Programming Interface | ||||||
| Name: papi | Name: papi | ||||||
| Version: 6.0.0 | Version: 6.0.0 | ||||||
| Release: 9%{?dist} | Release: 10%{?dist} | ||||||
| License: BSD | License: BSD | ||||||
| Requires: papi-libs = %{version}-%{release} | Requires: papi-libs = %{version}-%{release} | ||||||
| URL: http://icl.cs.utk.edu/papi/ | URL: http://icl.cs.utk.edu/papi/ | ||||||
| @ -21,6 +21,7 @@ Patch2: papi-a64fx.patch | |||||||
| Patch3: papi-no-iozone.patch | Patch3: papi-no-iozone.patch | ||||||
| Patch4: papi-config.patch | Patch4: papi-config.patch | ||||||
| Patch5: papi-nostatic.patch | Patch5: papi-nostatic.patch | ||||||
|  | Patch6: papi-init_thread.patch | ||||||
| BuildRequires: make | BuildRequires: make | ||||||
| BuildRequires: autoconf | BuildRequires: autoconf | ||||||
| BuildRequires: doxygen | BuildRequires: doxygen | ||||||
| @ -93,6 +94,7 @@ the PAPI user-space libraries and interfaces. | |||||||
| %patch3 -p1 | %patch3 -p1 | ||||||
| %patch4 -p1 | %patch4 -p1 | ||||||
| %patch5 -p1 | %patch5 -p1 | ||||||
|  | %patch6 -p1 -b .thread | ||||||
| 
 | 
 | ||||||
| %build | %build | ||||||
| # This package fails to build with LTO due to undefined symbols.  LTO | # This package fails to build with LTO due to undefined symbols.  LTO | ||||||
| @ -191,6 +193,9 @@ find %{buildroot} -type f -executable ! -iname "*.py" ! -iname "*.sh" | xargs ch | |||||||
| %endif | %endif | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Fri Nov 19 2021 William Cohen <wcohen@redhat.com> - 6.0.0-10 | ||||||
|  | - Correct initialization for stealtime component. | ||||||
|  | 
 | ||||||
| * Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.0-9 | * Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.0-9 | ||||||
| - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild | - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user