@@ -2992,14 +2992,29 @@ int get_mp(int cpu, struct msr_counter *mp, unsigned long long *counterp)
29922992	return  0 ;
29932993}
29942994
2995- unsigned long long  get_uncore_mhz (int  package ,  int   die )
2995+ unsigned long long  get_legacy_uncore_mhz (int  package )
29962996{
29972997	char  path [128 ];
2998+ 	int  die ;
2999+ 	static  int  warn_once ;
29983000
2999- 	sprintf (path , "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d/current_freq_khz" , package ,
3000- 		die );
3001+ 	/* 
3002+ 	 * for this package, use the first die_id that exists 
3003+ 	 */ 
3004+ 	for  (die  =  0 ; die  <= topo .max_die_id ; ++ die ) {
3005+ 
3006+ 		sprintf (path , "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d/current_freq_khz" ,
3007+ 			package , die );
30013008
3002- 	return  (snapshot_sysfs_counter (path ) / 1000 );
3009+ 		if  (access (path , R_OK ) ==  0 )
3010+ 			return  (snapshot_sysfs_counter (path ) / 1000 );
3011+ 	}
3012+ 	if  (!warn_once ) {
3013+ 		warnx ("BUG: %s: No %s" , __func__ , path );
3014+ 		warn_once  =  1 ;
3015+ 	}
3016+ 
3017+ 	return  0 ;
30033018}
30043019
30053020int  get_epb (int  cpu )
@@ -3631,9 +3646,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
36313646		p -> pkg_temp_c  =  tj_max  -  ((msr  >> 16 ) &  0x7F );
36323647	}
36333648
3634- 	/* n.b. assume die0 uncore frequency applies to whole package */ 
36353649	if  (DO_BIC (BIC_UNCORE_MHZ ))
3636- 		p -> uncore_mhz  =  get_uncore_mhz (p -> package_id ,  0 );
3650+ 		p -> uncore_mhz  =  get_legacy_uncore_mhz (p -> package_id );
36373651
36383652	if  (DO_BIC (BIC_GFX_rc6 ))
36393653		p -> gfx_rc6_ms  =  gfx_info [GFX_rc6 ].val_ull ;
@@ -5300,22 +5314,22 @@ static void probe_intel_uncore_frequency_legacy(void)
53005314	int  i , j ;
53015315	char  path [256 ];
53025316
5303- 	if  (access ("/sys/devices/system/cpu/intel_uncore_frequency/package_00_die_00/current_freq_khz" , R_OK ))
5304- 		return ;
5305- 
5306- 	BIC_PRESENT (BIC_UNCORE_MHZ );
5307- 
5308- 	if  (quiet )
5309- 		return ;
5310- 
53115317	for  (i  =  0 ; i  <  topo .num_packages ; ++ i ) {
5312- 		for  (j  =  0 ; j  <  topo .num_die ; ++ j ) {
5318+ 		for  (j  =  0 ; j  <=  topo .max_die_id ; ++ j ) {
53135319			int  k , l ;
53145320			char  path_base [128 ];
53155321
53165322			sprintf (path_base , "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d" , i ,
53175323				j );
53185324
5325+ 			if  (access (path_base , R_OK ))
5326+ 				continue ;
5327+ 
5328+ 			BIC_PRESENT (BIC_UNCORE_MHZ );
5329+ 
5330+ 			if  (quiet )
5331+ 				return ;
5332+ 
53195333			sprintf (path , "%s/min_freq_khz" , path_base );
53205334			k  =  read_sysfs_int (path );
53215335			sprintf (path , "%s/max_freq_khz" , path_base );
@@ -5480,7 +5494,6 @@ static void probe_graphics(void)
54805494	else  if  (!access ("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz" , R_OK ))
54815495		gfx_info [GFX_MHz ].path  =  "/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz" ;
54825496
5483- 
54845497	if  (!access ("/sys/class/drm/card0/gt_act_freq_mhz" , R_OK ))
54855498		gfx_info [GFX_ACTMHz ].path  =  "/sys/class/drm/card0/gt_act_freq_mhz" ;
54865499	else  if  (!access ("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz" , R_OK ))
0 commit comments