Re: Make CPU use the C2 state

2014-01-18 Thread John Rogers
On Mon, Jan 13, 2014 at 9:20 AM, Philip Guenther guent...@gmail.com wrote:
 C0 is the only state where the CPU does real work; the higher C-states
 only make sense for when the CPU is idle, so your question presumably
 is does the CPU get put into a higher C-state when idle.  Well,
 5.4-current uses the MWAIT instruction for the idle loop when
 available, which uses the C1 state by default.

 Have people found 5.4-current to use less power/run cooler since the
 MWAIT change in early October?

 The MWAIT instruction can put the CPU into a higher C-state if the CPU
 supports it, but we don't use or expose that yet.  I have no interest
 in adding Yet Another Knob, but maybe making the decision based off
 the existing hw.setperf sysctl would be reasonable and sufficient,
 overloading the range to not just change the speed but also use a
 deeper C-state hw.setperf is smaller, ala
C3 - 0-33
C2 - 34-65
C1 - 66-100

 Or maybe that's a bad idea.

Thanks for the explanation, it was very informative. This would most
likely solve my problem. But as other people have said it probably
should be a separate sysctl if implemented.

John



Re: Make CPU use the C2 state

2014-01-18 Thread Theo de Raadt
 But as other people have said it probably should be a separate
 sysctl if implemented.

I completely doubt that.  We've encountered this before on other processor
families, and always chosen to dumb down all the speed/power knobs to 1
user controllable knob.



Re: Make CPU use the C2 state

2014-01-15 Thread Juan Francisco Cantero Hurtado
On Mon, Jan 13, 2014 at 12:20:27AM -0800, Philip Guenther wrote:
 On Sun, Jan 12, 2014 at 11:16 PM, John Rogers microspar...@gmail.com wrote:
  I'm not an expert on this but my theory is that the problem is not
  that the CPU is running too fast but rather that it is running in a
  high power state, presumably C0. Do you know if apmd adjusts the
  c-state?
 
 C0 is the only state where the CPU does real work; the higher C-states
 only make sense for when the CPU is idle, so your question presumably
 is does the CPU get put into a higher C-state when idle.  Well,
 5.4-current uses the MWAIT instruction for the idle loop when
 available, which uses the C1 state by default.
 
 Have people found 5.4-current to use less power/run cooler since the
 MWAIT change in early October?
 
 The MWAIT instruction can put the CPU into a higher C-state if the CPU
 supports it, but we don't use or expose that yet.  I have no interest
 in adding Yet Another Knob, but maybe making the decision based off
 the existing hw.setperf sysctl would be reasonable and sufficient,
 overloading the range to not just change the speed but also use a
 deeper C-state hw.setperf is smaller, ala
C3 - 0-33
C2 - 34-65
C1 - 66-100
 
 Or maybe that's a bad idea.

The problem is C-states slows down additional components, not just the
CPU speed. Some users only want to change the CPU speed and others want
to increase the battery life of their laptops even if the laptop runs
slightly slower. Inevitably, you will need add also a new sysctl entry
to enable/disable the c-states, something like hw.setperf.c-states.

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: Make CPU use the C2 state

2014-01-15 Thread Ted Unangst
On Thu, Jan 16, 2014 at 04:20, Juan Francisco Cantero Hurtado wrote:
 CPU speed. Some users only want to change the CPU speed and others want
 to increase the battery life of their laptops even if the laptop runs
 slightly slower. Inevitably, you will need add also a new sysctl entry

heh, well, it is inevitable that some users will *want* a new sysctl,
but whether we need to provide it is a separate matter. :)



Re: Make CPU use the C2 state

2014-01-13 Thread Philip Guenther
On Sun, Jan 12, 2014 at 11:16 PM, John Rogers microspar...@gmail.com wrote:
 I'm not an expert on this but my theory is that the problem is not
 that the CPU is running too fast but rather that it is running in a
 high power state, presumably C0. Do you know if apmd adjusts the
 c-state?

C0 is the only state where the CPU does real work; the higher C-states
only make sense for when the CPU is idle, so your question presumably
is does the CPU get put into a higher C-state when idle.  Well,
5.4-current uses the MWAIT instruction for the idle loop when
available, which uses the C1 state by default.

Have people found 5.4-current to use less power/run cooler since the
MWAIT change in early October?

The MWAIT instruction can put the CPU into a higher C-state if the CPU
supports it, but we don't use or expose that yet.  I have no interest
in adding Yet Another Knob, but maybe making the decision based off
the existing hw.setperf sysctl would be reasonable and sufficient,
overloading the range to not just change the speed but also use a
deeper C-state hw.setperf is smaller, ala
   C3 - 0-33
   C2 - 34-65
   C1 - 66-100

Or maybe that's a bad idea.


Philip Guenther



Make CPU use the C2 state

2014-01-12 Thread John Rogers
Hi.

I have installed OpenBSD 5.4 on a laptop. So far everything runs fine
but I have the problem that it runs fairly hot even in idle.

I used to run FreeBSD on it before and it behaved very similar then,
until I read [1]. Setting performance_cx_lowest=C2 and
economy_cx_lowest=C2 did wonder to this machine and effectively
lowered the temperature and fan speed to acceptable levels. My
understanding is that this uses ACPI to make the processor run in at
least C2 state which makes it wake up somewhat slower but in general
decreases power usage.

My question is if I can do something similar with OpenBSD. I've read
through the source code to acpicpu(4) [2] and it mentions c-states
here and there, but I'm not used to the OpenBSD kernel source code and
is unable to tell how I can utilize it.

John


[1] https://wiki.freebsd.org/TuningPowerConsumption
[2] http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/acpi/acpicpu.c?rev=HEAD



Re: Make CPU use the C2 state

2014-01-12 Thread Juan Francisco Cantero Hurtado
On Sun, Jan 12, 2014 at 05:29:02PM +0100, John Rogers wrote:
 Hi.
 
 I have installed OpenBSD 5.4 on a laptop. So far everything runs fine
 but I have the problem that it runs fairly hot even in idle.
 
 I used to run FreeBSD on it before and it behaved very similar then,
 until I read [1]. Setting performance_cx_lowest=C2 and
 economy_cx_lowest=C2 did wonder to this machine and effectively
 lowered the temperature and fan speed to acceptable levels. My
 understanding is that this uses ACPI to make the processor run in at
 least C2 state which makes it wake up somewhat slower but in general
 decreases power usage.
 
 My question is if I can do something similar with OpenBSD. I've read
 through the source code to acpicpu(4) [2] and it mentions c-states
 here and there, but I'm not used to the OpenBSD kernel source code and
 is unable to tell how I can utilize it.
 
 John
 
 
 [1] https://wiki.freebsd.org/TuningPowerConsumption
 [2] http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/acpi/acpicpu.c?rev=HEAD
 

Try apmd(8).

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: Make CPU use the C2 state

2014-01-12 Thread John Rogers
On Mon, Jan 13, 2014 at 4:10 AM, Juan Francisco Cantero Hurtado
i...@juanfra.info wrote:
 On Sun, Jan 12, 2014 at 05:29:02PM +0100, John Rogers wrote:
 Hi.

 I have installed OpenBSD 5.4 on a laptop. So far everything runs fine
 but I have the problem that it runs fairly hot even in idle.

 I used to run FreeBSD on it before and it behaved very similar then,
 until I read [1]. Setting performance_cx_lowest=C2 and
 economy_cx_lowest=C2 did wonder to this machine and effectively
 lowered the temperature and fan speed to acceptable levels. My
 understanding is that this uses ACPI to make the processor run in at
 least C2 state which makes it wake up somewhat slower but in general
 decreases power usage.

 My question is if I can do something similar with OpenBSD. I've read
 through the source code to acpicpu(4) [2] and it mentions c-states
 here and there, but I'm not used to the OpenBSD kernel source code and
 is unable to tell how I can utilize it.

 John


 [1] https://wiki.freebsd.org/TuningPowerConsumption
 [2] http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/acpi/acpicpu.c?rev=HEAD


 Try apmd(8).

Thanks for the suggestion. I have added apmd_flags=-C to
/etc/rc.conf.local. It looks like it has some effect on the machine
but it is still running at much higher temperature in idle compared to
what is normal for it.

I'm not an expert on this but my theory is that the problem is not
that the CPU is running too fast but rather that it is running in a
high power state, presumably C0. Do you know if apmd adjusts the
c-state?

John