@@ -3509,6 +3509,7 @@ dump_sysfs_cstate_config(void)
char path[64];
char name_buf[16];
char desc[64];
+ char cpuidle_buf[64];
FILE *input;
int state;
char *sp;
@@ -3516,6 +3517,35 @@ dump_sysfs_cstate_config(void)
if (!DO_BIC(BIC_sysfs))
return;
+ if (access("/sys/devices/system/cpu/cpuidle", R_OK)) {
+ fprintf(outf, "cpuidle not loaded\n");
+ return;
+ }
+
+ sprintf(path, "/sys/devices/system/cpu/cpuidle/current_driver");
+ input = fopen(path, "r");
+ if (input == NULL) {
+ fprintf(outf, "NSFOD %s\n", path);
+ return;
+ }
+ if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input))
+ err(1, "%s: failed to read file", path);
+ fclose(input);
+
+ fprintf(outf, "cpuidle driver: %s", cpuidle_buf);
+
+ sprintf(path, "/sys/devices/system/cpu/cpuidle/current_governor_ro");
+ input = fopen(path, "r");
+ if (input == NULL) {
+ fprintf(outf, "NSFOD %s\n", path);
+ return;
+ }
+ if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input))
+ err(1, "%s: failed to read file", path);
+ fclose(input);
+
+ fprintf(outf, "cpuidle governor: %s", cpuidle_buf);
+
for (state = 0; state < 10; ++state) {
sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",