Hi,
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
Thanks,
Catalin
Catalin Marinas (4):
sched: Introduce the finish_arch_post_lock_switch() scheduler hook
ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on ASID-capable CPUs
ARM: Remove current_mm per-cpu variable
ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on pre-ARMv6 CPUs
Will Deacon (2):
ARM: Use TTBR1 instead of reserved context ID
ARM: Allow ASID 0 to be allocated to tasks
arch/arm/include/asm/mmu_context.h | 104 +++++++++++++++++++++++++++---------
arch/arm/include/asm/system.h | 7 ---
arch/arm/include/asm/thread_info.h | 1 +
arch/arm/mm/context.c | 63 +++++++++++-----------
arch/arm/mm/proc-v7-2level.S | 9 +---
kernel/sched/core.c | 1 +
kernel/sched/sched.h | 3 +
7 files changed, 117 insertions(+), 71 deletions(-)
This hook is called by the scheduler after rq->lock has been released
and interrupts enabled. It will be used in subsequent patches on the ARM
architecture.
Reviewed-by: Will Deacon <redacted>
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Cc: Ingo Molnar <redacted>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
kernel/sched/core.c | 1 +
kernel/sched/sched.h | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
Since the ASIDs must be unique to an mm across all the CPUs in a system,
the __new_context() function needs to broadcast a context reset event to
all the CPUs during ASID allocation if a roll-over occurred. Such IPIs
cannot be issued with interrupts disabled and ARM had to define
__ARCH_WANT_INTERRUPTS_ON_CTXSW.
This patch changes the check_context() function to
check_and_switch_context() called from switch_mm(). In case of
ASID-capable CPUs (ARMv6 onwards), if a new ASID is needed and the
interrupts are disabled, it defers the __new_context() and
cpu_switch_mm() calls to the post-lock switch hook where the interrupts
are enabled. Setting the reserved TTBR0 was also moved to
check_and_switch_context() from cpu_v7_switch_mm().
Reviewed-by: Will Deacon <redacted>
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm/include/asm/mmu_context.h | 72 ++++++++++++++++++++++++++++--------
arch/arm/include/asm/system.h | 2 +
arch/arm/include/asm/thread_info.h | 1 +
arch/arm/mm/context.c | 4 +-
arch/arm/mm/proc-v7-2level.S | 3 -
5 files changed, 61 insertions(+), 21 deletions(-)
This patch removes the __ARCH_WANT_INTERRUPTS_ON_CTXSW definition for
ARMv5 and earlier processors. On such processors, the context switch
requires a full cache flush. To avoid high interrupt latencies, this
patch defers the mm switching to the post-lock switch hook if the
interrupts are disabled.
Reviewed-by: Will Deacon <redacted>
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm/include/asm/mmu_context.h | 31 ++++++++++++++++++++++++++-----
arch/arm/include/asm/system.h | 9 ---------
2 files changed, 26 insertions(+), 14 deletions(-)
The current_mm variable was used to store the new mm between the
switch_mm() and switch_to() calls where an IPI to reset the context
could have set the wrong mm. Since the interrupts are disabled during
context switch, there is no need for this variable, current->active_mm
already points to the current mm when interrupts are re-enabled.
Reviewed-by: Will Deacon <redacted>
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm/include/asm/mmu_context.h | 7 -------
arch/arm/mm/context.c | 12 +-----------
2 files changed, 1 insertions(+), 18 deletions(-)
From: Will Deacon <redacted>
Now that ASID 0 is no longer used as a reserved value, allow it to be
allocated to tasks.
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Signed-off-by: Will Deacon <redacted>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm/mm/context.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
From: Will Deacon <redacted>
On ARMv7 CPUs that cache first level page table entries (like the
Cortex-A15), using a reserved ASID while changing the TTBR or flushing
the TLB is unsafe.
This is because the CPU may cache the first level entry as the result of
a speculative memory access while the reserved ASID is assigned. After
the process owning the page tables dies, the memory will be reallocated
and may be written with junk values which can be interpreted as global,
valid PTEs by the processor. This will result in the TLB being populated
with bogus global entries.
This patch avoids the use of a reserved context ID in the v7 switch_mm
and ASID rollover code by temporarily using the swapper_pg_dir pointed
at by TTBR1, which contains only global entries that are not tagged
with ASIDs.
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Signed-off-by: Will Deacon <redacted>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm/mm/context.c | 45 +++++++++++++++++++++++++----------------
arch/arm/mm/proc-v7-2level.S | 10 +++-----
2 files changed, 31 insertions(+), 24 deletions(-)
@@ -51,9 +63,7 @@ void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)staticvoidflush_context(void){-/* set the reserved ASID before flushing the TLB */-cpu_set_asid(0);-isb();+cpu_set_reserved_ttbr0();local_flush_tlb_all();if(icache_is_vivt_asid_tagged()){__flush_icache_all();
@@ -114,8 +124,7 @@ static void reset_context(void *info)set_mm_context(mm,asid);/* set the new ASID */-cpu_set_asid(mm->context.id);-isb();+cpu_switch_mm(mm->pgd,mm);}#else
From: Peter Zijlstra <peterz@infradead.org> Date: 2012-01-23 09:15:41
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
Hi,
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
I'm fine either way, I'll probably ask Ingo to pull your tree so that I
can stack some other patches on top.
On Mon, Jan 23, 2012 at 09:15:31AM +0000, Peter Zijlstra wrote:
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
quoted
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
I'm fine either way, I'll probably ask Ingo to pull your tree so that I
can stack some other patches on top.
In which case I would need Russell's acked-by.
Thanks.
--
Catalin
From: Russell King - ARM Linux <hidden> Date: 2012-01-23 09:48:21
On Mon, Jan 23, 2012 at 09:26:24AM +0000, Catalin Marinas wrote:
On Mon, Jan 23, 2012 at 09:15:31AM +0000, Peter Zijlstra wrote:
quoted
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
quoted
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
I'm fine either way, I'll probably ask Ingo to pull your tree so that I
can stack some other patches on top.
In which case I would need Russell's acked-by.
That depends on knowing what CPU architectures this has been tested on,
and whether anyone external has tested it. It's definitely a change
which needs some tested-by tags on it.
On Mon, Jan 23, 2012 at 09:47:59AM +0000, Russell King - ARM Linux wrote:
On Mon, Jan 23, 2012 at 09:26:24AM +0000, Catalin Marinas wrote:
quoted
On Mon, Jan 23, 2012 at 09:15:31AM +0000, Peter Zijlstra wrote:
quoted
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
quoted
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
I'm fine either way, I'll probably ask Ingo to pull your tree so that I
can stack some other patches on top.
In which case I would need Russell's acked-by.
That depends on knowing what CPU architectures this has been tested on,
and whether anyone external has tested it. It's definitely a change
which needs some tested-by tags on it.
I agree. On my side, I tested it on:
Versatile Express + Cortex-A9 (SMP configuration, ASIDs)
Versatile PB926 (UP configuration, no ASIDs)
--
Catalin
From: Will Deacon <hidden> Date: 2012-01-24 15:15:14
On Mon, Jan 23, 2012 at 09:53:38AM +0000, Catalin Marinas wrote:
On Mon, Jan 23, 2012 at 09:47:59AM +0000, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 23, 2012 at 09:26:24AM +0000, Catalin Marinas wrote:
quoted
On Mon, Jan 23, 2012 at 09:15:31AM +0000, Peter Zijlstra wrote:
quoted
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
quoted
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
I'm fine either way, I'll probably ask Ingo to pull your tree so that I
can stack some other patches on top.
In which case I would need Russell's acked-by.
That depends on knowing what CPU architectures this has been tested on,
and whether anyone external has tested it. It's definitely a change
which needs some tested-by tags on it.
I agree. On my side, I tested it on:
Versatile Express + Cortex-A9 (SMP configuration, ASIDs)
Versatile PB926 (UP configuration, no ASIDs)
For what it's worth, I've also tested this on:
Realview PB1176 (UP, ASIDs)
Cortex-A5 (SMP, ASIDs)
Cortex-A7 (SMP, ASIDs)
and I haven't seen any problems with native, parallel kernel builds. I don't
have anything prior to ARMv5 available, but at least we seem to have covered
v5-v7.
Will
From: Marc Zyngier <hidden> Date: 2012-01-25 10:32:23
On 24/01/12 15:14, Will Deacon wrote:
On Mon, Jan 23, 2012 at 09:53:38AM +0000, Catalin Marinas wrote:
quoted
On Mon, Jan 23, 2012 at 09:47:59AM +0000, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 23, 2012 at 09:26:24AM +0000, Catalin Marinas wrote:
quoted
On Mon, Jan 23, 2012 at 09:15:31AM +0000, Peter Zijlstra wrote:
quoted
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
quoted
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
I'm fine either way, I'll probably ask Ingo to pull your tree so that I
can stack some other patches on top.
In which case I would need Russell's acked-by.
That depends on knowing what CPU architectures this has been tested on,
and whether anyone external has tested it. It's definitely a change
which needs some tested-by tags on it.
I agree. On my side, I tested it on:
Versatile Express + Cortex-A9 (SMP configuration, ASIDs)
Versatile PB926 (UP configuration, no ASIDs)
For what it's worth, I've also tested this on:
Realview PB1176 (UP, ASIDs)
Cortex-A5 (SMP, ASIDs)
Cortex-A7 (SMP, ASIDs)
and I haven't seen any problems with native, parallel kernel builds. I don't
have anything prior to ARMv5 available, but at least we seem to have covered
v5-v7.
Probably redundant with the above, but nonetheless tested on:
Realview PB11MP (SMP, ASIDs)
Realview PBA8 (UP, ASIDs)
Panda OMAP4 (SMP, ASIDs)
using parallel kernel builds.
M.
--
Jazz is not dead. It just smells funny...
From: Peter Zijlstra <peterz@infradead.org> Date: 2012-02-16 13:58:30
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
Hi,
This is version 3 of the set of patches removing
__ARCH_WANT_INTERRUPTS_ON_CTXSW on ARM. The series was rebased on top of
3.3-rc1 and fixed the conflicts with the kernel/sched/ changes and the
ARM LPAE patches. There are no functional changes from v2. I plan to
push this to -next and get it ready for 3.4-rc1.
Question for Peter/Ingo - how do we merge the first patch that
introduces finish_arch_post_lock_switch? Do you pick it up or I can
merge it via rmk (with your ack)?
Russell, what's the status of these patches? I'd like to see them land
in 3.4 if possible.
If you take them in your arm tree, I can ask Ingo to pull from there and
then I can build on them from there..
From: Peter Zijlstra <peterz@infradead.org> Date: 2012-02-27 14:48:28
On Fri, 2012-01-20 at 17:42 +0000, Catalin Marinas wrote:
This hook is called by the scheduler after rq->lock has been released
and interrupts enabled. It will be used in subsequent patches on the ARM
architecture.
Reviewed-by: Will Deacon <redacted>
Reviewed-by: Frank Rowand <redacted>
Cc: Russell King <redacted>
Cc: Ingo Molnar <redacted>