* [PATCH] arch/arm/kernel: use cpu_relax() in halt loops
@ 2010-11-27 20:20 Jonathan Neuschäfer
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Neuschäfer @ 2010-11-27 20:20 UTC (permalink / raw)
To: linux-arm-kernel
Please note that this change is untested.
Signed-off-by: Jonathan Neusch?fer <j.neuschaefer@gmx.net>
---
arch/arm/kernel/process.c | 6 ++++--
arch/arm/kernel/setup.c | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index e76fcaa..4a83fdf 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -124,7 +124,8 @@ void arm_machine_restart(char mode, const char *cmd)
*/
mdelay(1000);
printk("Reboot failed -- System halted\n");
- while (1);
+ while (1)
+ cpu_relax();
}
/*
@@ -235,7 +236,8 @@ void machine_shutdown(void)
void machine_halt(void)
{
machine_shutdown();
- while (1);
+ while (1)
+ cpu_relax();
}
void machine_power_off(void)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 336f14e..0d77329 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -41,6 +41,7 @@
#include <asm/cacheflush.h>
#include <asm/cachetype.h>
#include <asm/tlbflush.h>
+#include <asm/processor.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
@@ -337,7 +338,8 @@ static void __init setup_processor(void)
if (!list) {
printk("CPU configuration botched (ID %08x), unable "
"to continue.\n", read_cpuid_id());
- while (1);
+ while (1)
+ cpu_relax();
}
cpu_name = list->cpu_name;
@@ -434,7 +436,8 @@ static struct machine_desc * __init setup_machine(unsigned int nr)
if (!list) {
printk("Machine configuration botched (nr %d), unable "
"to continue.\n", nr);
- while (1);
+ while (1)
+ cpu_relax();
}
printk("Machine: %s\n", list->name);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] arch/arm/kernel: use cpu_relax() in halt loops
@ 2010-12-14 22:48 Jonathan Neuschäfer
2010-12-14 22:51 ` Russell King - ARM Linux
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Neuschäfer @ 2010-12-14 22:48 UTC (permalink / raw)
To: linux-arm-kernel
Looking throught arch/arm/kernel/ I found some halt loops.
I just thought we could save some power here using cpu_relax(),
or am I missing something?
Signed-off-by: Jonathan Neusch?fer <j.neuschaefer@gmx.net>
---
arch/arm/kernel/process.c | 6 ++++--
arch/arm/kernel/setup.c | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index e76fcaa..4a83fdf 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -124,7 +124,8 @@ void arm_machine_restart(char mode, const char *cmd)
*/
mdelay(1000);
printk("Reboot failed -- System halted\n");
- while (1);
+ while (1)
+ cpu_relax();
}
/*
@@ -235,7 +236,8 @@ void machine_shutdown(void)
void machine_halt(void)
{
machine_shutdown();
- while (1);
+ while (1)
+ cpu_relax();
}
void machine_power_off(void)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 336f14e..0d77329 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -41,6 +41,7 @@
#include <asm/cacheflush.h>
#include <asm/cachetype.h>
#include <asm/tlbflush.h>
+#include <asm/processor.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
@@ -337,7 +338,8 @@ static void __init setup_processor(void)
if (!list) {
printk("CPU configuration botched (ID %08x), unable "
"to continue.\n", read_cpuid_id());
- while (1);
+ while (1)
+ cpu_relax();
}
cpu_name = list->cpu_name;
@@ -434,7 +436,8 @@ static struct machine_desc * __init setup_machine(unsigned int nr)
if (!list) {
printk("Machine configuration botched (nr %d), unable "
"to continue.\n", nr);
- while (1);
+ while (1)
+ cpu_relax();
}
printk("Machine: %s\n", list->name);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] arch/arm/kernel: use cpu_relax() in halt loops
2010-12-14 22:48 Jonathan Neuschäfer
@ 2010-12-14 22:51 ` Russell King - ARM Linux
2010-12-14 23:00 ` Jonathan Neuschäfer
0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2010-12-14 22:51 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 14, 2010 at 11:48:48PM +0100, Jonathan Neusch?fer wrote:
> Looking throught arch/arm/kernel/ I found some halt loops.
> I just thought we could save some power here using cpu_relax(),
> or am I missing something?
#if __LINUX_ARM_ARCH__ == 6
#define cpu_relax() smp_mb()
#else
#define cpu_relax() barrier()
#endif
IOW, it's either a memory barrier or compiler barrier on ARM; it
doesn't do any power saving.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arch/arm/kernel: use cpu_relax() in halt loops
2010-12-14 22:51 ` Russell King - ARM Linux
@ 2010-12-14 23:00 ` Jonathan Neuschäfer
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Neuschäfer @ 2010-12-14 23:00 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 14, 2010 at 10:51:26PM +0000, Russell King - ARM Linux wrote:
> On Tue, Dec 14, 2010 at 11:48:48PM +0100, Jonathan Neusch?fer wrote:
> > Looking throught arch/arm/kernel/ I found some halt loops.
> > I just thought we could save some power here using cpu_relax(),
> > or am I missing something?
>
> #if __LINUX_ARM_ARCH__ == 6
> #define cpu_relax() smp_mb()
> #else
> #define cpu_relax() barrier()
> #endif
>
> IOW, it's either a memory barrier or compiler barrier on ARM; it
> doesn't do any power saving.
Okay, thanks for that explanation.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-14 23:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-27 20:20 [PATCH] arch/arm/kernel: use cpu_relax() in halt loops Jonathan Neuschäfer
-- strict thread matches above, loose matches on Subject: below --
2010-12-14 22:48 Jonathan Neuschäfer
2010-12-14 22:51 ` Russell King - ARM Linux
2010-12-14 23:00 ` Jonathan Neuschäfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).