Gitweb: http://git.kernel.org/linus/11805bcfa411c816b7c76fc40724be6733c74ffc
Commit: 11805bcfa411c816b7c76fc40724be6733c74ffc
Parent: 48ab7e09e0a7c00a217f87e4b57dfbee9c603e79
Author: Catalin Marinas <catalin.marinas@arm.com>
AuthorDate: Tue Jan 26 19:09:42 2010 +0100
Committer: Russell King <rmk+kernel@arm.linux.org.uk>
CommitDate: Mon Feb 15 21:39:51 2010 +0000
ARM: 5905/1: ARM: Global ASID allocation on SMP
The current ASID allocation algorithm doesn't ensure the notification
of the other CPUs when the ASID rolls over. This may lead to two
processes using the same ASID (but different generation) or multiple
threads of the same process using different ASIDs.
This patch adds the broadcasting of the ASID rollover event to the
other CPUs. To avoid a race on multiple CPUs modifying "cpu_last_asid"
during the handling of the broadcast, the ASID numbering now starts at
"smp_processor_id() + 1". At rollover, the cpu_last_asid will be set
to NR_CPUS.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/include/asm/mmu.h | 1 +
arch/arm/include/asm/mmu_context.h | 15 ++++
arch/arm/mm/context.c | 124 ++++++++++++++++++++++++++++++++----
3 files changed, 126 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index b561584..68870c7 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -6,6 +6,7 @@
typedef struct {
#ifdef CONFIG_CPU_HAS_ASID
unsigned int id;
+ spinlock_t id_lock;
#endif
unsigned int kvm_seq;
} mm_context_t;
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index de6cefb..a0b3cac 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -43,12 +43,23 @@ void __check_kvm_seq(struct mm_struct *mm);
#define ASID_FIRST_VERSION (1 << ...