@@ -2992,14 +2992,29 @@ int get_mp(int cpu, struct msr_counter *mp, unsigned long long *counterp)
2992
2992
return 0 ;
2993
2993
}
2994
2994
2995
- unsigned long long get_uncore_mhz (int package , int die )
2995
+ unsigned long long get_legacy_uncore_mhz (int package )
2996
2996
{
2997
2997
char path [128 ];
2998
+ int die ;
2999
+ static int warn_once ;
2998
3000
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 );
3001
3008
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 ;
3003
3018
}
3004
3019
3005
3020
int get_epb (int cpu )
@@ -3631,9 +3646,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
3631
3646
p -> pkg_temp_c = tj_max - ((msr >> 16 ) & 0x7F );
3632
3647
}
3633
3648
3634
- /* n.b. assume die0 uncore frequency applies to whole package */
3635
3649
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 );
3637
3651
3638
3652
if (DO_BIC (BIC_GFX_rc6 ))
3639
3653
p -> gfx_rc6_ms = gfx_info [GFX_rc6 ].val_ull ;
@@ -5300,22 +5314,22 @@ static void probe_intel_uncore_frequency_legacy(void)
5300
5314
int i , j ;
5301
5315
char path [256 ];
5302
5316
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
-
5311
5317
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 ) {
5313
5319
int k , l ;
5314
5320
char path_base [128 ];
5315
5321
5316
5322
sprintf (path_base , "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d" , i ,
5317
5323
j );
5318
5324
5325
+ if (access (path_base , R_OK ))
5326
+ continue ;
5327
+
5328
+ BIC_PRESENT (BIC_UNCORE_MHZ );
5329
+
5330
+ if (quiet )
5331
+ return ;
5332
+
5319
5333
sprintf (path , "%s/min_freq_khz" , path_base );
5320
5334
k = read_sysfs_int (path );
5321
5335
sprintf (path , "%s/max_freq_khz" , path_base );
@@ -5480,7 +5494,6 @@ static void probe_graphics(void)
5480
5494
else if (!access ("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz" , R_OK ))
5481
5495
gfx_info [GFX_MHz ].path = "/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz" ;
5482
5496
5483
-
5484
5497
if (!access ("/sys/class/drm/card0/gt_act_freq_mhz" , R_OK ))
5485
5498
gfx_info [GFX_ACTMHz ].path = "/sys/class/drm/card0/gt_act_freq_mhz" ;
5486
5499
else if (!access ("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz" , R_OK ))
0 commit comments