Skip to contentSkip to conversation

--auto-tune without debugfs

Powertop Boris ARZUR 1 participant 1 message Jul 6, 2016

lore
Share & tools
lore

Boris ARZUR

author
#0 lore raw

Dear Powertop Team,

I use your utility at boot time to auto-tune my laptop.
When using a grsec kernel, debugfs may not be available. This causes your utility to complain & exit.
I use this very simple patch to force your wonderful tool to ignore that problem when auto-tuning.

Thank you and best regard,
Boris.

src/main.cpp +11 -6
@@ -311,7 +311,7 @@ static int get_nr_open(void) {
 	return nr_open;
 }
 
-static void powertop_init(void)
+static void powertop_init(int auto_tune)
 {
 	static char initialized = 0;
 	int ret;
@@ -339,9 +339,14 @@ static void powertop_init(void)
 			ret = system("mount -t debugfs debugfs /sys/kernel/debug > /dev/null 2>&1");
 		}
 		if (ret != 0) {
-			printf(_("Failed to mount debugfs!\n"));
-			printf(_("exiting...\n"));
-			exit(EXIT_FAILURE);
+			if (!auto_tune) {
+				fprintf(stderr, _("Failed to mount debugfs!\n"));
+				fprintf(stderr, _("exiting...\n"));
+				exit(EXIT_FAILURE);
+			} else {
+				fprintf(stderr, _("Failed to mount debugfs!\n"));
+				fprintf(stderr, _("Should still be able to auto tune...\n"));
+			}
 		}
 	}
 
@@ -414,7 +419,7 @@ int main(int argc, char **argv)
 			ui_notify_user = ui_notify_user_console;
 			break;
 		case 'c':
-			powertop_init();
+			powertop_init(0);
 			calibrate();
 			break;
 		case 'C':		/* csv report */
@@ -470,7 +475,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	powertop_init();
+	powertop_init(auto_tune);
 
 	if (reporttype != REPORT_OFF)
 		make_report(time_out, workload, iterations, filename);