From: Nicolas Pitre <hidden> Date: 2014-01-27 06:24:14
As everyone should know by now, we want to integrate the cpuidle
governor with the scheduler for a more efficient idling of CPUs.
In order to help the transition, this small patch series moves the
existing interaction with cpuidle from architecture code to generic
core code. No functional change should have occurred yet.
The ARM, PPC, SH and X86 architectures are concerned. Small cleanups
to ARM and ARM64 are also included. I don't know yet the best path for
those patches to get into mainline, but it is probably best if they
stay together. So ACKs from architecture maintainers would be greatly
appreciated.
arch/arm/kernel/process.c | 21 +++---------
arch/arm/kernel/setup.c | 7 ++++
arch/arm64/kernel/process.c | 5 ---
arch/arm64/kernel/setup.c | 7 ++++
arch/powerpc/platforms/pseries/processor_idle.c | 5 +++
arch/powerpc/platforms/pseries/setup.c | 34 ++++++++-----------
arch/sh/kernel/idle.c | 4 +--
arch/x86/kernel/process.c | 5 +--
include/linux/cpu.h | 1 -
kernel/Makefile | 1 -
kernel/cpu/Makefile | 1 -
kernel/sched/Makefile | 2 +-
kernel/{cpu => sched}/idle.c | 6 ++--
13 files changed, 44 insertions(+), 55 deletions(-)
Nicolas
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:24:16
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm/kernel/process.c | 5 -----
arch/arm/kernel/setup.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:24:19
The core idle loop now takes care of it.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/x86/kernel/process.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:24:20
The core idle loop now takes care of it. However a few things need
checking:
- Invocation of cpuidle_idle_call() in pseries_lpar_idle() happened
through arch_cpu_idle() and was therefore always preceded by a call
to ppc64_runlatch_off(). To preserve this property now that
cpuidle_idle_call() is invoked directly from core code, a call to
ppc64_runlatch_off() has been added to idle_loop_prolog() in
platforms/pseries/processor_idle.c.
- Similarly, cpuidle_idle_call() was followed by ppc64_runlatch_off()
so a call to the later has been added to idle_loop_epilog().
- And since arch_cpu_idle() always made sure to re-enable IRQs if they
were not enabled, this is now
done in idle_loop_epilog() as well.
The above was made in order to keep the execution flow close to the
original. I don't know if that was strictly necessary. Someone well
aquainted with the platform details might find some room for possible
optimizations.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/powerpc/platforms/pseries/processor_idle.c | 5 ++++
arch/powerpc/platforms/pseries/setup.c | 34 ++++++++++---------------
2 files changed, 19 insertions(+), 20 deletions(-)
@@ -356,29 +355,24 @@ early_initcall(alloc_dispatch_log_kmem_cache);staticvoidpseries_lpar_idle(void){-/* This would call on the cpuidle framework, and the back-end pseries-*drivertogotoidlestates+/*+*Defaulthandlertogointolowthreadpriorityandpossibly+*lowpowermodebycedeingprocessortohypervisor*/-if(cpuidle_idle_call()){-/* On error, execute default handler-*togointolowthreadpriorityandpossibly-*lowpowermodebycedeingprocessortohypervisor-*/-/* Indicate to hypervisor that we are idle. */-get_lppaca()->idle=1;+/* Indicate to hypervisor that we are idle. */+get_lppaca()->idle=1;-/*-*Yieldtheprocessortothehypervisor.Wereturnif-*anexternalinterruptoccurs(whicharedrivenprior-*toreturninghere)orifaprodoccursfromanother-*processor.Whenreturninghere,externalinterrupts-*areenabled.-*/-cede_processor();+/*+*Yieldtheprocessortothehypervisor.Wereturnif+*anexternalinterruptoccurs(whicharedrivenprior+*toreturninghere)orifaprodoccursfromanother+*processor.Whenreturninghere,externalinterrupts+*areenabled.+*/+cede_processor();-get_lppaca()->idle=0;-}+get_lppaca()->idle=0;}/*
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:24:21
Integration of cpuidle with the scheduler requires that the idle loop be
closely integrated with the scheduler proper. Moving cpu/idle.c into the
sched directory will allow for a smoother integration, and eliminate a
subdirectory which contained only one source file.
Signed-off-by: Nicolas Pitre <redacted>
---
kernel/Makefile | 1 -
kernel/cpu/Makefile | 1 -
kernel/sched/Makefile | 2 +-
kernel/{cpu => sched}/idle.c | 0
4 files changed, 1 insertion(+), 3 deletions(-)
delete mode 100644 kernel/cpu/Makefile
rename kernel/{cpu => sched}/idle.c (100%)
diff --git a/kernel/cpu/idle.c b/kernel/sched/idle.csimilarity index 100%rename from kernel/cpu/idle.crename to kernel/sched/idle.c
--
1.8.4.108.g55ea5f6
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:25:22
The core idle loop now takes care of it.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/sh/kernel/idle.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:25:50
The core idle loop now takes care of it.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm/kernel/process.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:25:51
In order to integrate cpuidle with the scheduler, we must have a better
proximity in the core code with what cpuidle is doing and not delegate
such interaction to arch code.
Architectures implementing arch_cpu_idle() should simply enter
a cheap idle mode in the absence of a proper cpuidle driver.
Signed-off-by: Nicolas Pitre <redacted>
---
kernel/cpu/idle.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:26:34
... so we can get rid of it entirely.
Signed-off-by: Nicolas Pitre <redacted>
---
include/linux/cpu.h | 1 -
kernel/cpu/idle.c | 2 --
2 files changed, 3 deletions(-)
From: Nicolas Pitre <hidden> Date: 2014-01-27 06:26:56
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
given that FIQs are not currently used on ARM64.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm64/kernel/process.c | 5 -----
arch/arm64/kernel/setup.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
From: Daniel Lezcano <hidden> Date: 2014-01-27 08:22:59
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
From: Daniel Lezcano <hidden> Date: 2014-01-27 08:23:49
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
given that FIQs are not currently used on ARM64.
Signed-off-by: Nicolas Pitre <redacted>
From: Daniel Lezcano <hidden> Date: 2014-01-27 08:32:22
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
In order to integrate cpuidle with the scheduler, we must have a better
proximity in the core code with what cpuidle is doing and not delegate
such interaction to arch code.
Architectures implementing arch_cpu_idle() should simply enter
a cheap idle mode in the absence of a proper cpuidle driver.
Signed-off-by: Nicolas Pitre <redacted>
This patch without the next ones will lead to an extra call to
cpuidle_idle_call.
cpuidle_idle_call
arch_cpu_idle
cpuidle_idle_call
x86_idle
But I guess it is acceptable as it is fixed with the next patches of the
serie.
Acked-by: Daniel Lezcano <redacted>
From: Daniel Lezcano <hidden> Date: 2014-01-27 08:35:06
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
The core idle loop now takes care of it. However a few things need
checking:
- Invocation of cpuidle_idle_call() in pseries_lpar_idle() happened
through arch_cpu_idle() and was therefore always preceded by a call
to ppc64_runlatch_off(). To preserve this property now that
cpuidle_idle_call() is invoked directly from core code, a call to
ppc64_runlatch_off() has been added to idle_loop_prolog() in
platforms/pseries/processor_idle.c.
- Similarly, cpuidle_idle_call() was followed by ppc64_runlatch_off()
so a call to the later has been added to idle_loop_epilog().
- And since arch_cpu_idle() always made sure to re-enable IRQs if they
were not enabled, this is now
done in idle_loop_epilog() as well.
The above was made in order to keep the execution flow close to the
original. I don't know if that was strictly necessary. Someone well
aquainted with the platform details might find some room for possible
optimizations.
Signed-off-by: Nicolas Pitre <redacted>
@@ -356,29 +355,24 @@ early_initcall(alloc_dispatch_log_kmem_cache);staticvoidpseries_lpar_idle(void){-/* This would call on the cpuidle framework, and the back-end pseries-*drivertogotoidlestates+/*+*Defaulthandlertogointolowthreadpriorityandpossibly+*lowpowermodebycedeingprocessortohypervisor*/-if(cpuidle_idle_call()){-/* On error, execute default handler-*togointolowthreadpriorityandpossibly-*lowpowermodebycedeingprocessortohypervisor-*/-/* Indicate to hypervisor that we are idle. */-get_lppaca()->idle=1;+/* Indicate to hypervisor that we are idle. */+get_lppaca()->idle=1;-/*-*Yieldtheprocessortothehypervisor.Wereturnif-*anexternalinterruptoccurs(whicharedrivenprior-*toreturninghere)orifaprodoccursfromanother-*processor.Whenreturninghere,externalinterrupts-*areenabled.-*/-cede_processor();+/*+*Yieldtheprocessortothehypervisor.Wereturnif+*anexternalinterruptoccurs(whicharedrivenprior+*toreturninghere)orifaprodoccursfromanother+*processor.Whenreturninghere,externalinterrupts+*areenabled.+*/+cede_processor();-get_lppaca()->idle=0;-}+get_lppaca()->idle=0;}/*
From: Preeti U Murthy <hidden> Date: 2014-01-27 12:03:51
Hi Nicolas,
On 01/27/2014 11:38 AM, Nicolas Pitre wrote:
quoted hunk
The core idle loop now takes care of it. However a few things need
checking:
- Invocation of cpuidle_idle_call() in pseries_lpar_idle() happened
through arch_cpu_idle() and was therefore always preceded by a call
to ppc64_runlatch_off(). To preserve this property now that
cpuidle_idle_call() is invoked directly from core code, a call to
ppc64_runlatch_off() has been added to idle_loop_prolog() in
platforms/pseries/processor_idle.c.
- Similarly, cpuidle_idle_call() was followed by ppc64_runlatch_off()
so a call to the later has been added to idle_loop_epilog().
- And since arch_cpu_idle() always made sure to re-enable IRQs if they
were not enabled, this is now
done in idle_loop_epilog() as well.
The above was made in order to keep the execution flow close to the
original. I don't know if that was strictly necessary. Someone well
aquainted with the platform details might find some room for possible
optimizations.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/powerpc/platforms/pseries/processor_idle.c | 5 ++++
arch/powerpc/platforms/pseries/setup.c | 34 ++++++++++---------------
2 files changed, 19 insertions(+), 20 deletions(-)
@@ -356,29 +355,24 @@ early_initcall(alloc_dispatch_log_kmem_cache);staticvoidpseries_lpar_idle(void){-/* This would call on the cpuidle framework, and the back-end pseries-*drivertogotoidlestates+/*+*Defaulthandlertogointolowthreadpriorityandpossibly+*lowpowermodebycedeingprocessortohypervisor*/-if(cpuidle_idle_call()){-/* On error, execute default handler-*togointolowthreadpriorityandpossibly-*lowpowermodebycedeingprocessortohypervisor-*/-/* Indicate to hypervisor that we are idle. */-get_lppaca()->idle=1;+/* Indicate to hypervisor that we are idle. */+get_lppaca()->idle=1;-/*-*Yieldtheprocessortothehypervisor.Wereturnif-*anexternalinterruptoccurs(whicharedrivenprior-*toreturninghere)orifaprodoccursfromanother-*processor.Whenreturninghere,externalinterrupts-*areenabled.-*/-cede_processor();+/*+*Yieldtheprocessortothehypervisor.Wereturnif+*anexternalinterruptoccurs(whicharedrivenprior+*toreturninghere)orifaprodoccursfromanother+*processor.Whenreturninghere,externalinterrupts+*areenabled.+*/+cede_processor();-get_lppaca()->idle=0;-}+get_lppaca()->idle=0;}/*
Reviewed-by: Preeti U Murthy <redacted>
The consequence of this would be for other Power platforms like PowerNV,
we will need to invoke ppc_runlatch_off() and ppc_runlatch_on() in each
of the idle routines since the idle_loop_prologue() and
idle_loop_epilogue() are not invoked by them, but we will take care of this.
Regards
Preeti U Murthy
From: Russell King - ARM Linux <hidden> Date: 2014-01-27 12:45:41
On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
quoted hunk
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm/kernel/process.c | 5 -----
arch/arm/kernel/setup.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
@@ -789,6 +789,13 @@ static int __init init_machine_late(void)}late_initcall(init_machine_late);+staticint__initinit_fiq_boot_cpu(void)+{+local_fiq_enable();+return0;+}+late_initcall(init_fiq_boot_cpu);
arch_cpu_idle_prepare() gets called from the swapper thread, and changes
the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
init thread, and changes the init thread's CPSR, which will already have
FIQs enabled by way of how kernel threads are created.
Hence, the above code fragment has no effect what so ever, and those
platforms using FIQs will not have FIQs delivered if they're idle
(because the swapper will have FIQs masked at the CPU.)
NAK.
--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
From: Peter Zijlstra <peterz@infradead.org> Date: 2014-01-27 12:48:07
On Mon, Jan 27, 2014 at 01:08:15AM -0500, Nicolas Pitre wrote:
As everyone should know by now, we want to integrate the cpuidle
governor with the scheduler for a more efficient idling of CPUs.
In order to help the transition, this small patch series moves the
existing interaction with cpuidle from architecture code to generic
core code. No functional change should have occurred yet.
The ARM, PPC, SH and X86 architectures are concerned. Small cleanups
to ARM and ARM64 are also included. I don't know yet the best path for
those patches to get into mainline, but it is probably best if they
stay together. So ACKs from architecture maintainers would be greatly
appreciated.
arch/arm/kernel/process.c | 21 +++---------
arch/arm/kernel/setup.c | 7 ++++
arch/arm64/kernel/process.c | 5 ---
arch/arm64/kernel/setup.c | 7 ++++
arch/powerpc/platforms/pseries/processor_idle.c | 5 +++
arch/powerpc/platforms/pseries/setup.c | 34 ++++++++-----------
arch/sh/kernel/idle.c | 4 +--
arch/x86/kernel/process.c | 5 +--
include/linux/cpu.h | 1 -
kernel/Makefile | 1 -
kernel/cpu/Makefile | 1 -
kernel/sched/Makefile | 2 +-
kernel/{cpu => sched}/idle.c | 6 ++--
13 files changed, 44 insertions(+), 55 deletions(-)
Thomas, any objections to this? It looks like a sensible thing to do.
On Mon, Jan 27, 2014 at 06:08:17AM +0000, Nicolas Pitre wrote:
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
given that FIQs are not currently used on ARM64.
Signed-off-by: Nicolas Pitre <redacted>
For arm64, we could simply remove any reference to FIQs. I'm not aware
of anyone using them.
--
Catalin
From: Nicolas Pitre <hidden> Date: 2014-01-27 15:46:05
On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:
On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm/kernel/process.c | 5 -----
arch/arm/kernel/setup.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
@@ -789,6 +789,13 @@ static int __init init_machine_late(void)}late_initcall(init_machine_late);+staticint__initinit_fiq_boot_cpu(void)+{+local_fiq_enable();+return0;+}+late_initcall(init_fiq_boot_cpu);
arch_cpu_idle_prepare() gets called from the swapper thread, and changes
the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
init thread, and changes the init thread's CPSR, which will already have
FIQs enabled by way of how kernel threads are created.
Hence, the above code fragment has no effect what so ever, and those
platforms using FIQs will not have FIQs delivered if they're idle
(because the swapper will have FIQs masked at the CPU.)
You're right.
What about moving local_fiq_enable() to trap_init() then?
Nicolas
From: Nicolas Pitre <hidden> Date: 2014-01-27 15:51:07
On Mon, 27 Jan 2014, Catalin Marinas wrote:
On Mon, Jan 27, 2014 at 06:08:17AM +0000, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
given that FIQs are not currently used on ARM64.
Signed-off-by: Nicolas Pitre <redacted>
For arm64, we could simply remove any reference to FIQs. I'm not aware
of anyone using them.
OK. What if I sumply remove arch_cpu_idle_prepare() and let you do the
remove the rest?
IMHO I'd simply remove local_fiq_{enable/disable}() from
arm64/kernel/smp.c and leave the infrastructure in place in case someone
needs it eventually. In which case I could include that into my patch
as well.
Nicolas
On Mon, Jan 27, 2014 at 03:51:02PM +0000, Nicolas Pitre wrote:
On Mon, 27 Jan 2014, Catalin Marinas wrote:
quoted
On Mon, Jan 27, 2014 at 06:08:17AM +0000, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
given that FIQs are not currently used on ARM64.
Signed-off-by: Nicolas Pitre <redacted>
For arm64, we could simply remove any reference to FIQs. I'm not aware
of anyone using them.
OK. What if I sumply remove arch_cpu_idle_prepare() and let you do the
remove the rest?
IMHO I'd simply remove local_fiq_{enable/disable}() from
arm64/kernel/smp.c and leave the infrastructure in place in case someone
needs it eventually. In which case I could include that into my patch
as well.
Sounds good. We can keep the local_fiq_*() functions but remove about 4
calling sites (process.c and smp.c) until needed.
Thanks.
--
Catalin
From: Russell King - ARM Linux <hidden> Date: 2014-01-27 16:07:27
On Mon, Jan 27, 2014 at 10:45:59AM -0500, Nicolas Pitre wrote:
On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm/kernel/process.c | 5 -----
arch/arm/kernel/setup.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
@@ -789,6 +789,13 @@ static int __init init_machine_late(void)}late_initcall(init_machine_late);+staticint__initinit_fiq_boot_cpu(void)+{+local_fiq_enable();+return0;+}+late_initcall(init_fiq_boot_cpu);
arch_cpu_idle_prepare() gets called from the swapper thread, and changes
the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
init thread, and changes the init thread's CPSR, which will already have
FIQs enabled by way of how kernel threads are created.
Hence, the above code fragment has no effect what so ever, and those
platforms using FIQs will not have FIQs delivered if they're idle
(because the swapper will have FIQs masked at the CPU.)
You're right.
What about moving local_fiq_enable() to trap_init() then?
That's potentially unsafe, as we haven't touched any of the IRQ
controllers at that point - we can't guarantee what state they'd be
in. Given that the default FIQ is to just return, a FIQ being raised
at that point will end up with an infinite loop re-entering the FIQ
handler.
--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
From: Russell King - ARM Linux <hidden> Date: 2014-01-27 16:07:49
On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
Reviewed-by: Daniel Lezcano <redacted>
What kind of review did you do when giving that attributation?
--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
From: Daniel Lezcano <hidden> Date: 2014-01-27 17:12:55
On 01/27/2014 05:07 PM, Russell King - ARM Linux wrote:
On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:
quoted
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
Reviewed-by: Daniel Lezcano <redacted>
What kind of review did you do when giving that attributation?
From: Russell King - ARM Linux <hidden> Date: 2014-01-27 17:21:33
On Mon, Jan 27, 2014 at 06:12:53PM +0100, Daniel Lezcano wrote:
On 01/27/2014 05:07 PM, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:
quoted
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
Reviewed-by: Daniel Lezcano <redacted>
What kind of review did you do when giving that attributation?
I did the review to the best of my knowledge and with good will.
I read your comment on this patch and I learnt one more thing.
Today, I am smarter than yesterday and dumber than tomorrow :)
Just be aware that putting a comment along with the reviewed-by tag
is always a good idea. I know that's a little more work, but this has
been raised a number of times by various people over the years.
A reviewed-by tag on its own doesn't mean much, as it could mean that
you've just glanced over the code and decided "yea, it looks okay", or
it could mean that you've spent all day verifying that the code change
is indeed correct.
Consequently, some will ignore emails which just contain a reviewed-by
attributation.
--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
From: Daniel Lezcano <hidden> Date: 2014-01-27 17:30:50
On 01/27/2014 06:21 PM, Russell King - ARM Linux wrote:
On Mon, Jan 27, 2014 at 06:12:53PM +0100, Daniel Lezcano wrote:
quoted
On 01/27/2014 05:07 PM, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 27, 2014 at 09:22:55AM +0100, Daniel Lezcano wrote:
quoted
On 01/27/2014 07:08 AM, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
Reviewed-by: Daniel Lezcano <redacted>
What kind of review did you do when giving that attributation?
I did the review to the best of my knowledge and with good will.
I read your comment on this patch and I learnt one more thing.
Today, I am smarter than yesterday and dumber than tomorrow :)
Just be aware that putting a comment along with the reviewed-by tag
is always a good idea. I know that's a little more work, but this has
been raised a number of times by various people over the years.
A reviewed-by tag on its own doesn't mean much, as it could mean that
you've just glanced over the code and decided "yea, it looks okay", or
it could mean that you've spent all day verifying that the code change
is indeed correct.
Consequently, some will ignore emails which just contain a reviewed-by
attributation.
From: Peter Zijlstra <peterz@infradead.org> Date: 2014-01-27 17:36:30
On Mon, Jan 27, 2014 at 05:21:10PM +0000, Russell King - ARM Linux wrote:
A reviewed-by tag on its own doesn't mean much, as it could mean that
you've just glanced over the code and decided "yea, it looks okay", or
it could mean that you've spent all day verifying that the code change
is indeed correct.
One should use Acked-by for the 'yea, it looks okay' thing.
From: Nicolas Pitre <hidden> Date: 2014-01-27 17:37:05
On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:
On Mon, Jan 27, 2014 at 10:45:59AM -0500, Nicolas Pitre wrote:
quoted
On Mon, 27 Jan 2014, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 27, 2014 at 01:08:16AM -0500, Nicolas Pitre wrote:
quoted
ARM and ARM64 are the only two architectures implementing
arch_cpu_idle_prepare() simply to call local_fiq_enable().
We have secondary_start_kernel() already calling local_fiq_enable() and
this is done a second time in arch_cpu_idle_prepare() in that case. And
enabling FIQs has nothing to do with idling the CPU to start with.
So let's introduce init_fiq_boot_cpu() to take care of FIQs on the boot
CPU and remove arch_cpu_idle_prepare(). This is now done a bit earlier
at late_initcall time but this shouldn't make a difference in practice
i.e. when FIQs are actually used.
Signed-off-by: Nicolas Pitre <redacted>
---
arch/arm/kernel/process.c | 5 -----
arch/arm/kernel/setup.c | 7 +++++++
2 files changed, 7 insertions(+), 5 deletions(-)
@@ -789,6 +789,13 @@ static int __init init_machine_late(void)}late_initcall(init_machine_late);+staticint__initinit_fiq_boot_cpu(void)+{+local_fiq_enable();+return0;+}+late_initcall(init_fiq_boot_cpu);
arch_cpu_idle_prepare() gets called from the swapper thread, and changes
the swapper thread's CPSR. init_fiq_boot_cpu() gets called from PID1, the
init thread, and changes the init thread's CPSR, which will already have
FIQs enabled by way of how kernel threads are created.
Hence, the above code fragment has no effect what so ever, and those
platforms using FIQs will not have FIQs delivered if they're idle
(because the swapper will have FIQs masked at the CPU.)
You're right.
What about moving local_fiq_enable() to trap_init() then?
That's potentially unsafe, as we haven't touched any of the IRQ
controllers at that point - we can't guarantee what state they'd be
in. Given that the default FIQ is to just return, a FIQ being raised
at that point will end up with an infinite loop re-entering the FIQ
handler.
Okay... I don't see any obvious way to work around that besides adding
another explicit hook, which arch_cpu_idle_prepare() incidentally
already is. So, unless you have a better idea, I'll drop this patch and
leave ARM as the only user of arch_cpu_idle_prepare().
Nicolas