<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BenV&#039;s notes &#187; powersave</title>
	<atom:link href="http://notes.benv.junerules.com/tag/powersave/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.benv.junerules.com</link>
	<description>Rants and notes</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:36:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>P4-Clockfuck</title>
		<link>http://notes.benv.junerules.com/all/software/p4-clockfuck/</link>
		<comments>http://notes.benv.junerules.com/all/software/p4-clockfuck/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 22:27:22 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[p4-clockmod]]></category>
		<category><![CDATA[powersave]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=349</guid>
		<description><![CDATA[You know what&#8217;s really annoying? Try this: root@Uil:/sys/devices/system/cpu/cpu0/cpufreq:0&#62;echo ondemand &#62; scaling_governor root@Uil:/sys/devices/system/cpu/cpu0/cpufreq:0&#62;dmesg &#91;1325843.712549&#93; ondemand governor failed, too long transition latency of HW, fallback to performance governor Apparently this is caused by the p4-clockmod module. You know, this piece of junk: Also known as &#8220;CONFIG_X86_P4_CLOCKMOD&#8220;. The reason? Well, the ondemand and the conservative governors want to [...]]]></description>
			<content:encoded><![CDATA[<p>You know what&#8217;s really annoying?</p>
<p>Try this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>Uil:<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>devices<span style="color: #000000; font-weight: bold;">/</span>system<span style="color: #000000; font-weight: bold;">/</span>cpu<span style="color: #000000; font-weight: bold;">/</span>cpu0<span style="color: #000000; font-weight: bold;">/</span>cpufreq:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">echo</span> ondemand <span style="color: #000000; font-weight: bold;">&gt;</span> scaling_governor <br />
root<span style="color: #000000; font-weight: bold;">@</span>Uil:<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>devices<span style="color: #000000; font-weight: bold;">/</span>system<span style="color: #000000; font-weight: bold;">/</span>cpu<span style="color: #000000; font-weight: bold;">/</span>cpu0<span style="color: #000000; font-weight: bold;">/</span>cpufreq:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">dmesg</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1325843.712549</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ondemand governor failed, too long transition latency of HW, fallback to performance governor</div></div>
<p>Apparently this is caused by the <span style="color:#FF00FF">p4-clockmod</span> module.<br />
You know, this piece of junk:<br />
<div id="attachment_350" class="wp-caption alignnone" style="width: 390px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2009/09/p4-clockmod.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2009/09/p4-clockmod.png" alt="p4-clockmod" title="p4-clockmod" width="380" height="30" class="size-full wp-image-350" /></a><p class="wp-caption-text">p4-clockmod</p></div><br />
Also known as &#8220;<span style="color:#00FFFF">CONFIG_X86_P4_CLOCKMOD</span>&#8220;.</p>
<p>The reason?<br />
Well, the ondemand and the conservative governors want to be able to switch to a different speed before their calculations become invalid.<br />
The p4-clockmod thing apparently makes the latency of switching so <b>BIG </b> that it becomes impossible. Or so they think.<br />
Which leaves only the sucky powersave and performance governors. (and of course userspace).</p>
<p>The kernel menuconfig help states:</p>
<blockquote><p>This driver should be only used in exceptional<br />
circumstances when very low power is needed because it causes severe<br />
slowdowns and noticeable latencies.  Normally Speedstep should be used<br />
instead.</p></blockquote>
<p>Lovely. I&#8217;ll keep that in mind, thanks.<br />
*enables <span style="color:#00FFFF">CONFIG_X86_ACPI_CPUFREQ</span> instead*</p>
<p>Note that when they&#8217;re both compiled in (as opposed to modules) the retarded thing seems to go for the clockmod. Just great.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/p4-clockfuck/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xen and Power Saving</title>
		<link>http://notes.benv.junerules.com/all/software/xen-and-power-saving/</link>
		<comments>http://notes.benv.junerules.com/all/software/xen-and-power-saving/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 23:23:26 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[powersave]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xenpm]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=329</guid>
		<description><![CDATA[Or more specific: CPU frequency scaling. On my laptop this is one of the first things I enabled to make my battery last longer. Now that we&#8217;re going to put a server in a rack where they will bill us depending on the amount of power consumed, this sounds like a welcome thing to have [...]]]></description>
			<content:encoded><![CDATA[<p>Or more specific: CPU frequency scaling.</p>
<p>On my laptop this is one of the first things I enabled to make my battery last longer.<br />
Now that we&#8217;re going to put a server in a rack where they will bill us depending on the amount of power consumed, this sounds like a welcome thing to have enabled.</p>
<p>Our latest Xen install has Xen 3.4, on which they&#8217;ve enabled it by default. Isn&#8217;t that nice?<br />
So basically, if your processor etc is good enough to support it, you can mess around with it using the <span style="color:#FF00FF">xenpm</span> tool.</p>
<p>For instance we can check the parameters for CPU 0 like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>xenbro:~<span style="color: #666666; font-style: italic;"># xenpm get-cpufreq-para 0</span><br />
cpu <span style="color: #c20cb9; font-weight: bold;">id</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span style="color: #000000;">0</span><br />
affected_cpus &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0</span> <span style="color: #000000;">1</span> <span style="color: #000000;">2</span> <span style="color: #000000;">3</span><br />
cpuinfo frequency &nbsp; &nbsp;: max <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2600000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> min <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">800000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> cur <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">800000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
scaling_driver &nbsp; &nbsp; &nbsp; : <br />
scaling_avail_gov &nbsp; &nbsp;: userspace performance powersave ondemand<br />
current_governor &nbsp; &nbsp; : ondemand<br />
&nbsp; ondemand specific &nbsp;:<br />
&nbsp; &nbsp; sampling_rate &nbsp; &nbsp;: max <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">10000000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> min <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">10000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> cur <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">20000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
&nbsp; &nbsp; up_threshold &nbsp; &nbsp; : <span style="color: #000000;">80</span><br />
scaling_avail_freq &nbsp; : <span style="color: #000000;">2600000</span> <span style="color: #000000;">1900000</span> <span style="color: #000000;">1400000</span> <span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">800000</span><br />
scaling frequency &nbsp; &nbsp;: max <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2600000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> min <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">800000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> cur <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">800000</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<p>As you can see, it&#8217;s very much like the whole <span style="color:#FF0000">cpufreq</span> ordeal. It has an <span style="color:#00FFFF">ondemand</span> governor, a <span style="color:#00FFFF">powersave</span> one, etc. Right now this CPU is using the ondemand governor, which will ramp up the clock when demand increases.<br />
However, since this is a quad core and not a real quad processor machine we can only change the governor for all 4 cores at the same time, not for individual ones. (would be cool to have 1 core burning away power while the rest idles by&#8230;.).</p>
<p>Anyway, the <span style="color:#FF00FF">xenpm</span> tool allows us to monitor and change various aspects of this.<br />
For instance this will do a little benchmark and show the processor states during the benchmark.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>xenbro:~<span style="color: #666666; font-style: italic;"># xenpm start 10</span><br />
Timeout <span style="color: #000000; font-weight: bold;">set</span> to <span style="color: #000000;">10</span> seconds<br />
Start sampling, waiting <span style="color: #000000; font-weight: bold;">for</span> CTRL-C or SIGINT or SIGALARM signal ...<br />
Elapsed <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span>: <span style="color: #000000;">10003</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
CPU0: &nbsp; Residency<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Avg Res<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; C0 &nbsp; &nbsp;<span style="color: #000000;">49</span> &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">0.50</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.04</span><br />
&nbsp; C1 &nbsp; &nbsp;<span style="color: #000000;">9953</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">99.50</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">7.19</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; Avg freq &nbsp; &nbsp; &nbsp;<span style="color: #000000;">800000</span> &nbsp;KHz<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
CPU1: &nbsp; Residency<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Avg Res<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; C0 &nbsp; &nbsp;<span style="color: #000000;">13</span> &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">0.14</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.07</span><br />
&nbsp; C1 &nbsp; &nbsp;<span style="color: #000000;">9989</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">99.86</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">48.49</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; Avg freq &nbsp; &nbsp; &nbsp;<span style="color: #000000;">800000</span> &nbsp;KHz<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
CPU2: &nbsp; Residency<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Avg Res<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; C0 &nbsp; &nbsp;<span style="color: #000000;">83</span> &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">0.83</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.21</span><br />
&nbsp; C1 &nbsp; &nbsp;<span style="color: #000000;">9919</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">99.17</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">25.05</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; Avg freq &nbsp; &nbsp; &nbsp;<span style="color: #000000;">800000</span> &nbsp;KHz<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
CPU3: &nbsp; Residency<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Avg Res<span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; C0 &nbsp; &nbsp;<span style="color: #000000;">28</span> &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">0.28</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.10</span><br />
&nbsp; C1 &nbsp; &nbsp;<span style="color: #000000;">9973</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">99.72</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">33.92</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; Avg freq &nbsp; &nbsp; &nbsp;<span style="color: #000000;">800000</span> &nbsp;KHz</div></div>
<p>As you can see my processor is mostly idle.<br />
<span style="color:#FFF033">State C0</span> is the most active state, <span style="color:#FFF033">C1</span> is sleeping with use of the HLT instruction.<br />
Your processor can have many more states, like my laptop which has 4.</p>
<p>Anyway, I put the change to ondemand governor in my /etc/rc.d/rc.local, so let&#8217;s hope it helps.</p>
<p>To read some more about the details of this stuff you can check out the <a href="http://wiki.xensource.com/xenwiki/xenpm">Xenpm wiki page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/xen-and-power-saving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
