Add idle power save for ppc 4xx
PATCH 1/1 Add idle power save for ppc 4xx
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f # Parent 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc 4xx
This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
I have tested this on hardware & KVM virtual guest.
arch/powerpc/kernel/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).o
arch/powerpc/kernel/idle_4xx.c new file +24 -0
@@ -0,0 +1,24 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle () +{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE ); +local_irq_disable (); +}
arch/powerpc/kernel/setup_32.c +4 -0
@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)
include/asm-powerpc/machdep.h +1 -0
@@ -266,6 +266,7 @@ extern void power4_idle(void);extern void power4_idle (void );extern void power4_cpu_offline_powersave (void );extern void ppc6xx_idle (void ); +extern void ppc4xx_idle (void );/* * ppc_md contains a copy of the machine description structure for the
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 37 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/idle_4xx.c new file +5
-0@@ -0,0 +1,24 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +*
arch/powerpc/kernel/idle_4xx.c line 15
Quoted 10 lines
arch/powerpc/kernel/idle_4xx.c new file +10
-0+* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle ()
void ppc4xx_idle(void)
arch/powerpc/kernel/idle_4xx.c line 22
Quoted 7 lines
arch/powerpc/kernel/idle_4xx.c new file +7
-0+{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE );
Why don't you |MSR_WE|MSR_EE at the same time?
arch/powerpc/kernel/idle_4xx.c line 24
Quoted 2 lines
arch/powerpc/kernel/idle_4xx.c new file +2
-0+local_irq_disable (); +}
None of the other power_save() implementations need this. In fact many of them don't even seem to return; they just loop around mtmsr.
Quoted 4 lines
arch/powerpc/kernel/setup_32.c void __init machine_init(unsigned long d · line 141
Quoted 10 lines
arch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif if (ppc_md.progress)
This belongs in the platform setup code.
Signature · 13 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 51 lines · Hollis Blanchard
Quoted 37 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/idle_4xx.c new file +5
-0@@ -0,0 +1,24 @@ +/* +* This file contains the power_save function for 4xx CPUs +* +* added by Jerone Young <[email protected]> +* arch/powerpc/kernel/idle_4xx.c line 15
Quoted 10 lines
arch/powerpc/kernel/idle_4xx.c new file +10
-0+* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle ()void
ppc4xx_idle(void)
Quoted 9 lines
arch/powerpc/kernel/idle_4xx.c line 22
Quoted 7 lines
arch/powerpc/kernel/idle_4xx.c new file +7
-0+{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE );Why don't you |MSR_WE|MSR_EE at the same time?
You technically can do this. But the question is do all 4xx cpus use MSR_EE to enable interrupts? I can assume they do (from what I know), but figured it would be safer to make the local_irq_enable() call. I can change it to just set the MSR_EE bit though, since all 4xx cpus (as far as I know) use it.
Quoted 6 lines
arch/powerpc/kernel/idle_4xx.c line 24
Quoted 3 lines
arch/powerpc/kernel/idle_4xx.c new file +2
-0+local_irq_disable (); +}None of the other
power_save()implementations need this. In fact many of them don't even seem to return; they just loop around mtmsr.
Sure it can be removed. Though with the comment in the mach_dep structure about power_save. It specifically says that interrupts are off when it is called. So I was following it here mainly. But I can remove the disabling of interrupts, since mtmsr is the only used under power_save.
Quoted 14 lines
Quoted 14 lines
arch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif
Quoted 3 lines
arch/powerpc/kernel/setup_32.c void __init machine_init(unsigned long d · line 141
Quoted 1 line
arch/powerpc/kernel/setup_32.c +0
-0if (ppc_md.progress)This belongs in the platform setup code.
I'll move this to the 4xx platform setup code.
Quoted 1 line
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 12 lines · On Mon, 31 Mar 2008 11:52:02 -0500 Jerone Young <[email protected]> wrote:
Quoted 11 lines
void
ppc4xx_idle(void)arch/powerpc/kernel/idle_4xx.c line 22
Quoted 7 lines
arch/powerpc/kernel/idle_4xx.c new file +7
-0+{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE );Why don't you |MSR_WE|MSR_EE at the same time?
Quoted 2 lines
You technically can do this. But the question is do all 4xx cpus use
MSR_EEto enable interrupts? I can assume they do (from what I know),
They do for enabling external interrupts of normal priority. MSR_CE might also be used/needed if someone has the watchdog enabled or has an external device with the UIC pin mapped as a CE.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 11 lines · Jerone Young
Quoted 10 lines
arch/powerpc/kernel/idle_4xx.c line 22
Quoted 8 lines
arch/powerpc/kernel/idle_4xx.c new file +7
-0+{ + unsigned long msr_save; + + /* set wait state MSR */ + local_irq_enable(); + msr_save = mfmsr(); + mtmsr(msr_save|MSR_WE);Why don't you |MSR_WE|MSR_EE at the same time?
Quoted 5 lines
You technically can do this. But the question is do all 4xx cpus use
MSR_EEto enable interrupts? I can assume they do (from what I know), but figured it would be safer to make thelocal_irq_enable()call. I can change it to just set theMSR_EEbit though, since all 4xx cpus (as far as I know) use it.
For correctness reasons, you actually have to set both EE and WE simultaneously. Otherwise, an interrupt can come in between the two mtmsr(), mark some thread as runnable and then go to sleep here without ever checking need_resched() until the next interrupt, which may take an indefinite time.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
+ local_irq_disable();
+}
Quoted 8 lines
Quoted 2 lines
None of the other
power_save()implementations need this. In fact many of them don't even seem to return; they just loop around mtmsr.Sure it can be removed. Though with the comment in the
mach_depstructure aboutpower_save. It specifically says that interrupts are off when it is called. So I was following it here mainly. But I can remove the disabling of interrupts, since mtmsr is the only used underpower_save.
With the current code, it shouldn't matter, because cpu_idle enables the interrupts right after calling ppc_md->power_save(), but it would be reasonable to disable the interrupts here anyway, if only to make the function return with the same state that it was entered.
IMHO, the function should be
void ppc4xx_idle()
{
unsigned long msr_save;
msr_save = mfmsr();
/* enter idle mode */
mtmsr(msr_save|MSR_WE|MSR_EE);
/* disable interrupts again */
mtmsr(msr_save);
}Arnd <><
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 10 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the power_save function instead of always making it the default?
arch/powerpc/kernel/idle_4xx.c
Quoted 17 lines
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/idle_4xx.c new file +0
-0
Can this be added to sysdev/ppc4xx_soc.c instead?
arch/powerpc/kernel/idle_4xx.c line 24
Quoted 13 lines
arch/powerpc/kernel/idle_4xx.c new file +13
-0+#include <asm/processor.h> +#include <asm/machdep.h> + +void ppc4xx_idle () +{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE ); +local_irq_disable (); +}
I agree with Hollis on both the MSR_WE|MSR_EE and removing the local_irq_disable changes.
arch/powerpc/kernel/setup_32.c void __init machine_init(unsigned long d · line 139
Quoted 12 lines
arch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif
I agree this belongs in platform setup code. Finding the right spot for it might be a bit of a challenge.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 12 lines · On Mon, 31 Mar 2008 12:07:17 -0500 Josh Boyer <[email protected]> wrote:
Quoted 10 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
Quoted 8 lines
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?
Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A Kconfig option might be warranted though.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 20 lines · Josh Boyer
Quoted 17 lines · On Mon, 31 Mar 2008 12:07:17 -0500 Josh Boyer <[email protected]> wrote:
Quoted 10 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
Quoted 7 lines
Quoted 3 lines
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.
I'll go with the Kconfig option.
Quoted 2 lines
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 25 lines · Jerone Young
Quoted 24 lines · Josh Boyer
Quoted 20 lines · On Mon, 31 Mar 2008 12:07:17 -0500 Josh Boyer <[email protected]> wrote:
Quoted 10 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?
Quoted 5 lines
Quoted 3 lines
Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.I'll go with the
Kconfigoption.
Go with a device-tree check. The pseries kernel supports both bare-metal and hypervisor in the same kernel image, and it works out which it's running on by looking at the device-tree. This seems equivalent to me?
cheers
Signature · 8 lines
Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 8 lines · Michael Ellerman
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.
Quoted 5 lines
Quoted 1 line
I'll go with the
Kconfigoption.Go with a device-tree check. The pseries kernel supports both bare-metal and hypervisor in the same kernel image, and it works out which it's running on by looking at the device-tree. This seems equivalent to me?
After some back and forth on IRC, we decided on that as well. I love being right, then wrong, then right again.
/me needs more sleep.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 11 lines · Josh Boyer
Quoted 10 lines · Michael Ellerman
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.I'll go with the
Kconfigoption.
Quoted 8 lines
Quoted 3 lines
Go with a device-tree check. The pseries kernel supports both bare-metal and hypervisor in the same kernel image, and it works out which it's running on by looking at the device-tree. This seems equivalent to me?
After some back and forth on IRC, we decided on that as well. I love being right, then wrong, then right again.
/me needs more sleep.
Better to be right twice rather than once, no?
cheers
Signature · 8 lines
Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 14 lines · Josh Boyer
Quoted 13 lines · Michael Ellerman
Quoted 12 lines
Quoted 10 lines
Quoted 6 lines
I'm assuming you pass a dtb to the virtual guest when you start it up.
Could you define a property in the CPU node there that can be parsed to
use thepower_savefunction instead of always making it the default?Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.I'll go with the
Kconfigoption.
Quoted 8 lines
Quoted 5 lines
Go with a device-tree check. The pseries kernel supports both bare- metal
and hypervisor in the same kernel image, and it works out which it's running on by looking at the device-tree. This seems equivalent to me?After some back and forth on IRC, we decided on that as well. I love being right, then wrong, then right again.
Awesome, can you summarize for the rest of us?
-JX
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 22 lines · Jimi Xenidis
Quoted 20 lines · Josh Boyer
Quoted 18 lines · Michael Ellerman
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I'm assuming you pass a dtb to the virtual guest when you start it up.
Could you define a property in the CPU node there that can be parsed to
use thepower_savefunction instead of always making it the default?Quoted 5 lines
Quoted 3 lines
Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.I'll go with the
Kconfigoption.Go with a device-tree check. The pseries kernel supports both bare- metal
and hypervisor in the same kernel image, and it works out which it's running on by looking at the device-tree. This seems equivalent to me?
Quoted 4 lines
Quoted 2 lines
After some back and forth on IRC, we decided on that as well. I love being right, then wrong, then right again.
Awesome, can you summarize for the rest of us?
A node or property will be in the device tree that the guests can use to determine if it's running under a hypervisor or not.
The details are yet to be worked out, so there isn't much more of a summary yet. There was also some conversation about having an "idle=" kernel parameter similar to the PA-Semi port that would allow toggling of it as well.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 15 lines · Josh Boyer
Quoted 12 lines · On Mon, 31 Mar 2008 12:07:17 -0500 Josh Boyer <[email protected]> wrote:
Quoted 11 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]> # Date 1206969060 18000 # Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
I have tested this on hardware & KVM virtual guest.
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
So it slightly helps hardware, and it helps virtualization a *lot*. What's the problem?
Quoted 7 lines
Quoted 3 lines
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?Actually, you probably don't want this as a property in the device tree.
It doesn't describe hardware. AKconfigoption might be warranted
though.
There will be a device tree binding for hypervisor properties, so if it's not always enabled, having a hypervisor node (for any hypervisor) in the device tree would be an indicator. Far better than a Kconfig option, at any rate.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 19 lines · Hollis Blanchard
Quoted 17 lines · Josh Boyer
Quoted 14 lines · On Mon, 31 Mar 2008 12:07:17 -0500 Josh Boyer <[email protected]> wrote:
Quoted 12 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]> # Date 1206969060 18000 # Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
So it slightly helps hardware, and it helps virtualization a *lot*. What's the problem?
There's 0 publicly available documentation on exactly what "Wait State Enable" means other than the description for the MSR register bit in the 4xx UM. I'm a very paranoid person.
Explain to me what it really provides with some kind of concrete numbers on real hardware and I'll think about it as the default. Until then, I think a Kconfig option (or DT property) is acceptable for now. I didn't say "no", I just said "make it optional."
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?
Quoted 8 lines
Quoted 3 lines
Actually, you probably don't want this as a property in the device tree.
It doesn't describe hardware. AKconfigoption might be warranted
though.There will be a device tree binding for hypervisor properties, so if it's not always enabled, having a hypervisor node (for any hypervisor) in the device tree would be an indicator. Far better than a
Kconfigoption, at any rate.
But you want this in the guests, right? Not the hypervisor...
josh
Quoted 28 lines · Josh Boyer
Quoted 19 lines · Hollis Blanchard
Quoted 17 lines · Josh Boyer
Quoted 14 lines · On Mon, 31 Mar 2008 12:07:17 -0500 Josh Boyer <[email protected]> wrote:
Quoted 12 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]> # Date 1206969060 18000 # Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
So it slightly helps hardware, and it helps virtualization a *lot*. What's the problem?
Quoted 8 lines
There's 0 publicly available documentation on exactly what "Wait State Enable" means other than the description for the MSR register bit in the 4xx UM. I'm a very paranoid person.
Explain to me what it really provides with some kind of concrete numbers on real hardware and I'll think about it as the default. Until then, I think a
Kconfigoption (or DT property) is acceptable for now. I didn't say "no", I just said "make it optional."
You can be paranoid about all new features, and then new development ceases.
Did your project that measured it report any suspicious problems?
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?Actually, you probably don't want this as a property in the device tree.
It doesn't describe hardware. AKconfigoption might be warranted
though.
Quoted 6 lines
Quoted 4 lines
There will be a device tree binding for hypervisor properties, so if it's not always enabled, having a hypervisor node (for any hypervisor) in the device tree would be an indicator. Far better than a
Kconfigoption, at any rate.But you want this in the guests, right? Not the hypervisor...
Not sure what you mean. The hypervisor will create device tree properties for the guests, so the guest could use that property to initialize the power_save hook.
Signature · 13 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 3 lines · Josh Boyer
Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.
In general it is valid to have properties in the device tree that describe the hypervisor or the kernel's interface to it, since they are aspects of the platform, i.e. the virtual "hardware" that the kernel is running on.
Paul.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 10 lines · On Tue, 1 Apr 2008 15:00:38 +1100 Paul Mackerras <[email protected]> wrote:
Quoted 3 lines · Josh Boyer
Actually, you probably don't want this as a property in the device tree. It doesn't describe hardware. A
Kconfigoption might be warranted though.In general it is valid to have properties in the device tree that describe the hypervisor or the kernel's interface to it, since they are aspects of the platform, i.e. the virtual "hardware" that the kernel is running on.
Yep, we reached that conclusion already.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 32 lines · Josh Boyer
Quoted 10 lines · Jerone Young
# HG changeset patch
# User Jerone Young <[email protected]>
# Date 1206969060 18000
# Node ID10aea37177130bbe5de7bee6ec06d9010bc5da1f# Parent1506aa38ddabb0bf73fff3ac3f3db5f9ef6458ccAdd idle power save for ppc 4xxThis patch sets the wait state MSR when
power_saveis called incpu_idleloop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.I have tested this on hardware & KVM virtual guest.
I'm not overly thrilled with adding this to all of 4xx. It doesn't actually save much power at all (1% on a project that actually measured it with an amp meter recently) and there's really no other benefit to doing it outside of the virtual guest case.
I'm assuming you pass a dtb to the virtual guest when you start it up. Could you define a property in the CPU node there that can be parsed to use the
power_savefunction instead of always making it the default?Quoted 11 lines
Signed-off-by Jerone Young <[email protected]>arch/powerpc/kernel/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsy obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o +obj-$(CONFIG_4xx) += idle_4xx.o obj-$(CONFIG_TAU) += tau_6xx.o
Quoted 8 lines
arch/powerpc/kernel/idle_4xx.c
Quoted 6 lines
arch/powerpc/kernel/Makefile +0
-0obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \ swsusp_$(CONFIG_WORD_SIZE).oarch/powerpc/kernel/idle_4xx.c new file +0
-0Can this be added to
sysdev/ppc4xx_soc.cinstead?
Probably. Though the other platforms have there power_save code in idle_<platform>.S files, as they are in assembly.
Also I don't appear to have ppc4xx_soc.c in my source (using 2.6.25-rc6).
Quoted 17 lines
Quoted 4 lines
arch/powerpc/kernel/idle_4xx.c new file +3
-0+#include <asm/processor.h> +#include <asm/machdep.h> +arch/powerpc/kernel/idle_4xx.c line 24
Quoted 10 lines
arch/powerpc/kernel/idle_4xx.c new file +10
-0+void ppc4xx_idle () +{ +unsigned long msr_save; + +/* set wait state MSR */ +local_irq_enable (); + msr_save =mfmsr (); +mtmsr (msr_save|MSR_WE ); +local_irq_disable (); +}I agree with Hollis on both the MSR_WE|MSR_EE and removing the
local_irq_disablechanges.
You mention adding MSR_CE in a followup email. I'll add that to and remove local_irq_disable.
Quoted 17 lines
arch/powerpc/kernel/setup_32.c void __init machine_init(unsigned long d · line 139
Quoted 13 lines
arch/powerpc/kernel/setup_32.c +4
-0@@ -132,6 +132,10 @@ void __init machine_init(unsigned long dif (cpu_has_feature (CPU_FTR_CAN_DOZE ) ||cpu_has_feature (CPU_FTR_CAN_NAP )) ppc_md.power_save = ppc6xx_idle; +#endif + +#ifdef CONFIG_4xx + ppc_md.power_save = ppc4xx_idle;#endif I agree this belongs in platform setup code. Finding the right spot for it might be a bit of a challenge.
Quoted 2 lines
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 9 lines · Jerone Young
Quoted 6 lines
arch/powerpc/kernel/idle_4xx.c
Quoted 4 lines
arch/powerpc/kernel/idle_4xx.c new file +0
-0Can this be added to
sysdev/ppc4xx_soc.cinstead?Probably. Though the other platforms have there
power_savecode in idle_<platform>.S files, as they are in assembly.
No, just two of them do. Cell, pseries, and pasemi all have them under the platform directory.
Quoted 2 lines
Also I don't appear to have
ppc4xx_soc.cin my source (using 2.6.25-rc6).
You're working against a very old tree, relatively speaking. Use either my for-2.6.26 branch in my git tree, or the linux-next tree.
josh
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel