lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 6 Jun 2007 13:54:51 -0700
From:	Venki Pallipadi <venkatesh.pallipadi@...el.com>
To:	Len Brown <lenb@...nel.org>
Cc:	Adam Belay <abelay@...ell.com>, Len Brown <len.brown@...el.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...l.org>,
	Shaohua Li <shaohua.li@...el.com>, linux-acpi@...r.kernel.org
Subject: [PATCH 6/8] cpuidle: make cpuidle sysfs driver/governor switch off by default



Make default cpuidle sysfs to show current_governor and current_driver in
read-only mode. More elaborate available_governors and available_drivers with
writeable current_governor and current_driver interface only appear with
"cpuidle_sysfs_switch" boot parameter.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>

Index: linux-2.6.22-rc-mm/drivers/cpuidle/cpuidle.c
===================================================================
--- linux-2.6.22-rc-mm.orig/drivers/cpuidle/cpuidle.c	2007-06-05 17:52:32.000000000 -0700
+++ linux-2.6.22-rc-mm/drivers/cpuidle/cpuidle.c	2007-06-06 10:57:41.000000000 -0700
@@ -25,7 +25,6 @@
 LIST_HEAD(cpuidle_detected_devices);
 static void (*pm_idle_old)(void);
 
-
 /**
  * cpuidle_idle_call - the main idle loop
  *
Index: linux-2.6.22-rc-mm/drivers/cpuidle/sysfs.c
===================================================================
--- linux-2.6.22-rc-mm.orig/drivers/cpuidle/sysfs.c	2007-06-05 17:52:56.000000000 -0700
+++ linux-2.6.22-rc-mm/drivers/cpuidle/sysfs.c	2007-06-06 11:29:50.000000000 -0700
@@ -13,6 +13,14 @@
 
 #include "cpuidle.h"
 
+static unsigned int sysfs_switch;
+static int __init cpuidle_sysfs_setup(char *unused)
+{
+	sysfs_switch = 1;
+	return 1;
+}
+__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
+
 static ssize_t show_available_drivers(struct sys_device *dev, char *buf)
 {
 	ssize_t i = 0;
@@ -127,6 +135,15 @@
 	return count;
 }
 
+static SYSDEV_ATTR(current_driver_ro, 0444, show_current_driver, NULL);
+static SYSDEV_ATTR(current_governor_ro, 0444, show_current_governor, NULL);
+
+static struct attribute *cpuclass_default_attrs[] = {
+	&attr_current_driver_ro.attr,
+	&attr_current_governor_ro.attr,
+	NULL
+};
+
 static SYSDEV_ATTR(available_drivers, 0444, show_available_drivers, NULL);
 static SYSDEV_ATTR(available_governors, 0444, show_available_governors, NULL);
 static SYSDEV_ATTR(current_driver, 0644, show_current_driver,
@@ -134,7 +151,7 @@
 static SYSDEV_ATTR(current_governor, 0644, show_current_governor,
 	store_current_governor);
 
-static struct attribute *cpuclass_default_attrs[] = {
+static struct attribute *cpuclass_switch_attrs[] = {
 	&attr_available_drivers.attr,
 	&attr_available_governors.attr,
 	&attr_current_driver.attr,
@@ -152,6 +169,9 @@
  */
 int cpuidle_add_class_sysfs(struct sysdev_class *cls)
 {
+	if (sysfs_switch)
+		cpuclass_attr_group.attrs = cpuclass_switch_attrs;
+
 	return sysfs_create_group(&cls->kset.kobj, &cpuclass_attr_group);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ