Add idle wait support for 44x platforms
Subsystems (2)
PATCH v5 1/1 Add idle wait support for 44x platforms
2 files changed, 77 insertions(+), 1 deletion(-)
arch/powerpc/platforms/44x/Makefile | 2arch/powerpc/platforms/44x/idle.c | 76 +++++++++++++++++++++++++++++++++++
Updates: Now setting MSR_WE is now default
Tested on hardware platforms bamboo & sequioa and appears things are working fine on actually hardware!
This patch adds the ability for the CPU to go into wait state while in cpu_idle loop. This helps virtulization solutions know when the guest Linux kernel is in an idle state. There are two ways to do it.
Command line
idle=spin <-- CPU will spin
idle=wait <-- set CPU into wait state when idle (default)
arch/powerpc/platforms/44x/Makefile +1 -1
@@ -1,4 +1,4 @@ obj-$(CONFIG_44x) := misc_44x.o -obj-$(CONFIG_44x) := misc_44x.o +obj-$(CONFIG_44x) := misc_44x.o idle.o obj-$(CONFIG_EBONY) += ebony.o obj-$(CONFIG_TAISHAN) += taishan.o obj-$(CONFIG_BAMBOO) += bamboo.o
arch/powerpc/platforms/44x/idle.c new file +76 -0
76 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
Quoted 14 lines · On Tuesday 08 April 2008 11:49:14 Jerone Young wrote:
2 files changed, 77 insertions(+), 1 deletion(-)
arch/powerpc/platforms/44x/Makefile| 2arch/powerpc/platforms/44x/idle.c| 76
+++++++++++++++++++++++++++++++++++Updates: Now setting
MSR_WEis now default
Tested on hardware platforms bamboo & sequioa and appears things are working fine on actually hardware!This patch adds the ability for the CPU to go into wait state while in
cpu_idleloop. This helps virtulization solutions know when the guest Linux kernel is in an idle state. There are two ways to do it.
Quoted 6 lines
Command line
idle=spin <-- CPU will spin
idle=wait <-- set CPU into wait state when idle (default)Signed-off-by Jerone Young <[email protected]>
Signature · 12 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
In reply to Jerone YoungQuoted 9 lines · On Tue, 08 Apr 2008 11:49:14 -0500 Jerone Young <[email protected]> wrote:
2 files changed, 77 insertions(+), 1 deletion(-)
arch/powerpc/platforms/44x/Makefile| 2arch/powerpc/platforms/44x/idle.c| 76 +++++++++++++++++++++++++++++++++++Updates: Now setting
MSR_WEis now default
Tested on hardware platforms bamboo & sequioa and appears things are working fine on actually hardware!
Quoted 8 lines
This patch adds the ability for the CPU to go into wait state while in
cpu_idleloop. This helps virtulization solutions know when the guest Linux kernel is in an idle state. There are two ways to do it.Command line
idle=spin <-- CPU will spin
idle=wait <-- set CPU into wait state when idle (default)Signed-off-by Jerone Young <[email protected]>
Looks great. I'll add it to my tree shortly.
josh
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
In reply to Jerone YoungQuoted 19 lines · Jerone Young
arch/powerpc/platforms/44x/idle.c new file +19
-0+static struct sleep_mode modes[] = { + { .name = "wait", .entry = &ppc44x_idle }, + { .name = "spin", .entry = NULL }, +}; + +int __init ppc44x_idle_init (void ) +{ + void *func = modes[current_mode].entry; + ppc_md.power_save = func; + return 0; +} + +arch_initcall (ppc44x_idle_init); + +static int __init idle_param (char *p) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(modes); i++) {
arch/powerpc/platforms/44x/idle.c line 76
Quoted 10 lines
arch/powerpc/platforms/44x/idle.c new file +10
-0+ if (!strcmp(modes[i].name, p)) { + current_mode = i; + break; + } + } + + return 0; +} + +early_param ("idle" , idle_param);
ok, sorry to steal the show again, now that everyone seems to be happy with the current code, but isn't this equivalent to the simpler
static int __init idle_param(char *p)
{
if (!strcmp(modes[i].name, "spin"))
ppc_md.power_save = NULL;
}early_param("idle", idle_param);
if you statically initialize the ppc_md.power_save function to ppc44x_idle in the platform setup files?
Arnd <><
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
Quoted 25 lines · Arnd Bergmann
Quoted 24 lines · Jerone Young
arch/powerpc/platforms/44x/idle.c new file +24
-0+static struct sleep_mode modes[] = { + { .name ="wait" , .entry = &ppc44x_idle }, + { .name ="spin" , .entry =NULL }, +}; + +int __init ppc44x_idle_init (void ) +{ +void *func = modes[current_mode].entry; + ppc_md.power_save = func; +return 0 ; +} + +arch_initcall (ppc44x_idle_init); + +static int __init idle_param (char *p) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (modes); i++) { +if (!strcmp (modes[i].name, p)) { + current_mode = i; +break ; + } + }
Quoted 8 lines
arch/powerpc/platforms/44x/idle.c line 76
Quoted 5 lines
arch/powerpc/platforms/44x/idle.c new file +5
-0+ +return 0 ; +} + +early_param ("idle" , idle_param);ok, sorry to steal the show again, now that everyone seems to be happy with the current code, but isn't this equivalent to the simple
Well it could be this simple. But the current code leaves a lot more room to add different type waits or spins if need be (if they are ever needed ... though none off the top of my head at the moment)...but it does allow you to create another wait state for whatever reason a lot easier.
So I really don't think this needs to change. Unless everyone really feels that it just has to be.
Quoted 10 lines
static int
__initidle_param(char *p){ if (!strcmp(modes[i].name, "spin")) ppc_md.power_save = NULL; }
early_param("idle", idle_param);if you statically initialize the ppc_md.power_save function to
ppc44x_idlein the platform setup files?
The idea is to not statically initialize ppc_md.power_save to ppc44x_idle in each platform setup file.
Quoted 2 lines
Arnd <><
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
Quoted 8 lines · Jerone Young
Well it could be this simple. But the current code leaves a lot more room to add different type waits or spins if need be (if they are ever needed ... though none off the top of my head at the moment)...but it does allow you to create another wait state for whatever reason a lot easier.
So I really don't think this needs to change. Unless everyone really feels that it just has to be.
No, it doesn't need to change, the current patch is entirely correct, just a little bit more complicated than it needs to be, and I try not to have code in anticipation of something getting more complicated in the future, you can always add the complexity at the point where you need it.
Quoted 8 lines
Quoted 8 lines
static int
__initidle_param(char *p)
{
if (!strcmp(modes[i].name, "spin"))
ppc_md.power_save = NULL;
}early_param("idle", idle_param);
Quoted 6 lines
Quoted 2 lines
if you statically initialize the ppc_md.power_save function to
ppc44x_idlein the platform setup files?The idea is to not statically initialize ppc_md.power_save to
ppc44x_idlein each platform setup file.
Why not? Unlike the platform_initcall, it wouldn't cost anything and your current code has the same effect in the end, but in a less obvious way.
Arnd <><
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
Quoted 10 lines · Arnd Bergmann
Quoted 10 lines
Quoted 9 lines
static int
__initidle_param(char *p){ if (!strcmp(modes[i].name, "spin")) ppc_md.power_save = NULL; }
early_param("idle", idle_param);if you statically initialize the ppc_md.power_save function to
ppc44x_idlein the platform setup files?
Quoted 6 lines
Quoted 3 lines
The idea is to not statically initialize ppc_md.power_save to
ppc44x_idlein each platform setup file.Why not? Unlike the
platform_initcall, it wouldn't cost anything and your current code has the same effect in the end, but in a less obvious way.
This is likely something that has evolved from the original patch which added a machine_late_initcall(<machine>, ppc44x_idle_init) to every platform.c file. It made the original patch overly complicated as opposed to adding a single arch_initcall in a common file. That was also before we decided to make "wait" the default, which made things much easier to deal with.
I'll take the blame for the way the minorly suboptimal state the patch is, as Jerone had to jump through several hoops already at my request. I agree it's cleaner to do as you suggest in the long run, and may well make some changes along those lines myself.
josh
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] [v5] Add idle wait support for 44x
In reply to Arnd BergmannQuoted 7 lines · Arnd Bergmann
Quoted 6 lines · Jerone Young
Well it could be this simple. But the current code leaves a lot more room to add different type waits or spins if need be (if they are ever needed ... though none off the top of my head at the moment)...but it does allow you to create another wait state for whatever reason a lot easier.
Quoted 8 lines
Quoted 2 lines
So I really don't think this needs to change. Unless everyone really feels that it just has to be.
No, it doesn't need to change, the current patch is entirely correct, just a little bit more complicated than it needs to be, and I try not to have code in anticipation of something getting more complicated in the future, you can always add the complexity at the point where you need it.
That piece of code came across from the platforms/pasemi version, where we for a while had more than two kinds of idle loops (doze/nap/sleep/rvwinkle). Turns out doze does well enough that the others weren't really needed so I never submitted support for the deeper sleep modes.
-Olof