Skip to contentSkip to conversation

cpuidle take2: Basic documentation for cpuidle

PATCH In review Venkatesh Pallipadi 2 participants 2 messages Feb 22, 2007 – Feb 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 cpuidle take2: Basic documentation for cpuidle

Documentation for cpuidle infrastructure

Documentation/cpuidle/core.txt new file +17 -0
Index: linux-2.6.21-rc-mm/Documentation/cpuidle/core.txt
===================================================================
@@ -0,0 +1,17 @@
+
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle
+
+General Information:
+
+Various CPUs today support multiple idle levels that are differentiated
+by varying exit latencies and power consumption during idle.
+cpuidle is a generic in-kernel infrastructure that separates
+idle policy (governor) from idle mechanism (driver) and provides a
+standardized infrastructure to support independent development of
+governors and drivers.
+
+cpuidle resides under /drivers/cpuidle.
+
+
Documentation/cpuidle/driver.txt new file +24 -0
Index: linux-2.6.21-rc-mm/Documentation/cpuidle/driver.txt
===================================================================
@@ -0,0 +1,24 @@
+
+
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle drivers
+
+
+
+
+cpuidle driver supports capability detection for a particular system. The
+init and exit routines will be called for each online CPU, with a percpu
+cpuidle_driver object and driver should fill in cpuidle_states inside
+cpuidle_driver depending on the CPU capability.
+
+Driver can handle dynamic state changes (like battery<->AC), by calling
+force_redetect interface.
+
+It is possible to have more than one driver registered at the same time and
+user can switch between drivers using /sysfs interface.
+
+Interfaces:
+int cpuidle_register_driver(struct cpuidle_driver *drv);
+void cpuidle_unregister_driver(struct cpuidle_driver *drv);
+int cpuidle_force_redetect(struct cpuidle_device *dev);
Documentation/cpuidle/sysfs.txt new file +27 -0
Index: linux-2.6.21-rc-mm/Documentation/cpuidle/sysfs.txt
===================================================================
@@ -0,0 +1,27 @@
+
+
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle sysfs
+
+System global cpuidle information are under
+/sys/devices/system/cpu/cpuidle
+
+The current interfaces in this directory has self-explanatory names:
+* available_drivers
+* available_governors
+* current_driver
+* current_governor
+
+Per logical CPU specific cpuidle information are under
+/sys/devices/system/cpu/cpuX/cpuidle
+for each online cpu X
+
+Under this percpu directory, there is a directory for each idle state supported
+by the driver, which in turn has
+* latency
+* power
+* time
+* usage
+
+
Documentation/cpuidle/governor.txt new file +24 -0
Index: linux-2.6.21-rc-mm/Documentation/cpuidle/governor.txt
===================================================================
@@ -0,0 +1,24 @@
+
+
+
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle governors
+
+
+
+
+cpuidle governor is policy routine that decides what idle state to enter at
+any given time. cpuidle core uses different callbacks to governor while
+handling idle entry.
+* select_state callback where governor can determine next idle state to enter
+* prepare_idle callback is called before entering an idle state
+* scan callback is called after a driver forces redetection of the states
+
+More than one governor can be registered at the same time and
+user can switch between drivers using /sysfs interface.
+
+Interfaces:
+int cpuidle_register_governor(struct cpuidle_governor *gov);
+void cpuidle_unregister_governor(struct cpuidle_governor *gov);
+
#1 lore raw

Hi!

Quoted 16 lines

Documentation for cpuidle infrastructure

Index: linux-2.6.21-rc-mm/Documentation/cpuidle/core.txt
===================================================================

Documentation/cpuidle/core.txt new file +5 -0
@@ -0,0 +1,17 @@
+
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle
+

Documentation/cpuidle/core.txt line 15

Quoted 10 lines
Documentation/cpuidle/core.txt new file +10 -0
+General Information:
+
+Various CPUs today support multiple idle levels that are differentiated
+by varying exit latencies and power consumption during idle.
+cpuidle is a generic in-kernel infrastructure that separates
+idle policy (governor) from idle mechanism (driver) and provides a
+standardized infrastructure to support independent development of
+governors and drivers.
+
+cpuidle resides under /drivers/cpuidle.

Drop leading slash? Merge this to some other docs, since it is so short?

Quoted 8 lines

Index: linux-2.6.21-rc-mm/Documentation/cpuidle/driver.txt
===================================================================

Documentation/cpuidle/driver.txt new file +3 -0
@@ -0,0 +1,24 @@
+
+
+		Supporting multiple CPU idle levels in kernel

Documentation/cpuidle/driver.txt line 13

Quoted 10 lines
Documentation/cpuidle/driver.txt new file +10 -0
+
+				cpuidle drivers
+
+
+
+
+cpuidle driver supports capability detection for a particular system. The
+init and exit routines will be called for each online CPU, with a percpu
+cpuidle_driver object and driver should fill in cpuidle_states inside
+cpuidle_driver depending on the CPU capability.

Huh, perhaps it would be nice to explain what the driver does?

Now we know that it does...

Documentation/cpuidle/driver.txt line 24

Quoted 10 lines
Documentation/cpuidle/driver.txt new file +10 -0
+Driver can handle dynamic state changes (like battery<->AC), by calling
+force_redetect interface.
+
+It is possible to have more than one driver registered at the same time and
+user can switch between drivers using /sysfs interface.
+
+Interfaces:
+int cpuidle_register_driver(struct cpuidle_driver *drv);
+void cpuidle_unregister_driver(struct cpuidle_driver *drv);
+int cpuidle_force_redetect(struct cpuidle_device *dev);

register, unregister and redetect... but that somehow does not seem complete?

Documentation/cpuidle/sysfs.txt line 8

Quoted 13 lines

Index: linux-2.6.21-rc-mm/Documentation/cpuidle/sysfs.txt
===================================================================

Documentation/cpuidle/sysfs.txt new file +8 -0
@@ -0,0 +1,27 @@
+
+
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle sysfs
+
+System global cpuidle information are under
+/sys/devices/system/cpu/cpuidle

"information is"? (Not 100% sure).

Documentation/cpuidle/sysfs.txt line 25

Quoted 6 lines
Documentation/cpuidle/sysfs.txt new file +6 -0
+Under this percpu directory, there is a directory for each idle state supported
+by the driver, which in turn has
+* latency
+* power
+* time
+* usage

This should say... latency (in microseconds), power (in miliwats), and explain what time (which units?) and usage means. (Total time spent in that state, usage == number of enters into that state?)

Documentation/cpuidle/sysfs.txt line 25

Quoted 11 lines
Documentation/cpuidle/sysfs.txt new file +11 -0
+		Supporting multiple CPU idle levels in kernel
+
+				cpuidle governors
+
+
+cpuidle governor is policy routine that decides what idle state to enter at
+any given time. cpuidle core uses different callbacks to governor while
+handling idle entry.
+* select_state callback where governor can determine next idle state to enter
+* prepare_idle callback is called before entering an idle state
+* scan callback is called after a driver forces redetection of the states

Can we get some visual separation between functions and their descriptions?

scan() callback?

scan -- callback?

Documentation/cpuidle/sysfs.txt line 27

Quoted 2 lines
Documentation/cpuidle/sysfs.txt new file +2 -0
+More than one governor can be registered at the same time and
+user can switch between drivers using /sysfs interface.

<describe interface here>?

Explain why we want more than one governor?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html