cpuidle: quarter term report

Blog post by yongcong on Fri, 2012-06-22 15:42

I completed my 1/4 goal ahead of proposal schedule. By the original plan, I should investigate whether we need necessary changes to x86 idle routine and x86 architecture specific instruction usage. The results were reported to gsoc maillist on 3rd Jun. Here are the copied results:
1. no need to change x86 idle routine
2. monitor/mwait works perfectly. I have measured the power consumption when using idle implemented with "monitor/mwait", it's the same as the version implemented with "hlt".

After then, I wrote one haiku normal kernel module to change the idle routine during module initialization --"hlt" version => "mwait" version. It works too. My experiment goes further after that, make the cpu always enter the deepest sandybridge c-states using "mwait" instruction, it did show an impressive power saving.

Then it's time to design and implement the generic idle framework. After more code reading and careful consideration, the framework will be designed as following(this design was sent out a few days ago to gsoc mailist):

1. one generic cpuidle kernel module(similar as the bus_manager module)
which handle with idle routine, statics collection, etc. When loading, it
will enumerate drivers/cpuidle/ for available lowlevel idle implementaions

2. various lowlevel idle modules which implement the idle states entering
routines.

3. one cpuidle raw driver which will load the generic cpuidle kernel module
during initialization. This driver will export the userspace interface and
publish devices under /dev/

4. one userspace which interface with the cpuidle raw driver, it's used to
report statics, information

NOTE:4 is optional if we don't want the cstates statics report. Then 3 can also be removed if we add the cpuidle generic module auto loading logic to somewhere. We can easily change or remove 3 and 4 according to haiku reviewers when the cpuidle is merged to haiku master branch in the future.

Before Mid-term evaluation, the cpuidle framework should be ready. And if everything goes fine, we can saw a basic intel native idle implementation using the "mwait" instruction

Comments

Re: cpuidle: quarter term report

that are very good news, since i hope that haiku will run in not too far future on devices for whom the power-consumption is quite important.
Once haiku is ported to raspberry, i really think to build an ebook-reader (wiht eink display or mirasol) based on raspberry and running haiku.

Re: cpuidle: quarter term report

cipri wrote:

i really think to build an ebook-reader (wiht eink display or mirasol) based on raspberry and running haiku.

Heh I've had pretty much the same idea, would be so sweet!

Re: cpuidle: quarter term report

Very nice report and nice to hear that everything is going well.

Re: cpuidle: quarter term report

Sounds like everything is moving along nicely, however since I am pretty much lost on these kinds of things I was wondering if your work here also includes automatic change of cpu frequency based upon cpu demand? Sorry if it's a stupid question.

Re: cpuidle: quarter term report

Do you mean as in scaling down the frequency to save battery a la Speedstep? If so, Haiku already has a driver for that as far as Intel CPUs go. If you mean the "Turbo" mechanism in i7s and such, that's a different story. However, neither one is covered by or related to this project, the main issue being tackled here is that newer CPUs have a more power-efficient way of going into a sleep mode when nothing is actually executing (aka the CPU is idle), and this project implements support for that..

Re: cpuidle: quarter term report

Yes I mean as in speedstep, and I did try the CPUFrequency preference app but as I recall nothing happened, that was quite some time ago though so maybe it works just fine on my system now.

So it's probably a good time for me to stop using Haiku in a VM and boot into my Haiku partition again to see how it performs on 'the metal', particularly the speedstep mode.

Re: cpuidle: quarter term report

For me this program also does not work. And I normally install Haiku.

Re: cpuidle: quarter term report

What about with Cool'n'Quiet and PowerNow!?