mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 05:02:31 +00:00
tools/power/turbostat: Support alternative graphics sysfs knobs
/sys/class/graphics/fb0/device/drm/card0/ and /sys/class/drm/card0/ point to the same device node. But in some cases, one exists and the other one does not. Prefer to use /sys/class/drm/card0/, and fall back to /sys/class/graphics/fb0/device/drm/card0/. This recovers the "GFXMHz" and "GFXAMHz" columns on some platforms like a SPR server. Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
b98a6d7876
commit
2c019d6579
@ -3188,8 +3188,8 @@ int snapshot_gfx_rc6_ms(void)
|
||||
/*
|
||||
* snapshot_gfx_mhz()
|
||||
*
|
||||
* record snapshot of
|
||||
* /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz
|
||||
* fall back to /sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz
|
||||
* when /sys/class/drm/card0/gt_cur_freq_mhz is not available.
|
||||
*
|
||||
* return 1 if config change requires a restart, else return 0
|
||||
*/
|
||||
@ -3198,9 +3198,11 @@ int snapshot_gfx_mhz(void)
|
||||
static FILE *fp;
|
||||
int retval;
|
||||
|
||||
if (fp == NULL)
|
||||
fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", "r");
|
||||
else {
|
||||
if (fp == NULL) {
|
||||
fp = fopen("/sys/class/drm/card0/gt_cur_freq_mhz", "r");
|
||||
if (!fp)
|
||||
fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", "r");
|
||||
} else {
|
||||
rewind(fp);
|
||||
fflush(fp);
|
||||
}
|
||||
@ -3215,8 +3217,8 @@ int snapshot_gfx_mhz(void)
|
||||
/*
|
||||
* snapshot_gfx_cur_mhz()
|
||||
*
|
||||
* record snapshot of
|
||||
* /sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz
|
||||
* fall back to /sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz
|
||||
* when /sys/class/drm/card0/gt_act_freq_mhz is not available.
|
||||
*
|
||||
* return 1 if config change requires a restart, else return 0
|
||||
*/
|
||||
@ -3225,9 +3227,11 @@ int snapshot_gfx_act_mhz(void)
|
||||
static FILE *fp;
|
||||
int retval;
|
||||
|
||||
if (fp == NULL)
|
||||
fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", "r");
|
||||
else {
|
||||
if (fp == NULL) {
|
||||
fp = fopen("/sys/class/drm/card0/gt_act_freq_mhz", "r");
|
||||
if (!fp)
|
||||
fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", "r");
|
||||
} else {
|
||||
rewind(fp);
|
||||
fflush(fp);
|
||||
}
|
||||
@ -5804,10 +5808,12 @@ void process_cpuid()
|
||||
if (!access("/sys/class/drm/card0/power/rc6_residency_ms", R_OK))
|
||||
BIC_PRESENT(BIC_GFX_rc6);
|
||||
|
||||
if (!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
|
||||
if (!access("/sys/class/drm/card0/gt_cur_freq_mhz", R_OK) ||
|
||||
!access("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", R_OK))
|
||||
BIC_PRESENT(BIC_GFXMHz);
|
||||
|
||||
if (!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
|
||||
if (!access("/sys/class/drm/card0/gt_act_freq_mhz", R_OK) ||
|
||||
!access("/sys/class/graphics/fb0/device/drm/card0/gt_act_freq_mhz", R_OK))
|
||||
BIC_PRESENT(BIC_GFXACTMHz);
|
||||
|
||||
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
|
||||
|
Loading…
Reference in New Issue
Block a user