aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/mmu_context.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2010-08-24 03:26:21 -0400
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2010-08-24 03:26:34 -0400
commit050eef364ad700590a605a0749f825cab4834b1e (patch)
tree2714c9cf7edcbf394971cc2c929e5ab2ea34d6a6 /arch/s390/include/asm/mmu_context.h
parent7af048dc7639db5202c56fecf2346c310647a218 (diff)
[S390] fix tlb flushing vs. concurrent /proc accesses
The tlb flushing code uses the mm_users field of the mm_struct to decide if each page table entry needs to be flushed individually with IPTE or if a global flush for the mm_struct is sufficient after all page table updates have been done. The comment for mm_users says "How many users with user space?" but the /proc code increases mm_users after it found the process structure by pid without creating a new user process. Which makes mm_users useless for the decision between the two tlb flusing methods. The current code can be confused to not flush tlb entries by a concurrent access to /proc files if e.g. a fork is in progres. The solution for this problem is to make the tlb flushing logic independent from the mm_users field. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/mmu_context.h')
-rw-r--r--arch/s390/include/asm/mmu_context.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index 976e273988c2..a6f0e7cc9cde 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -11,11 +11,14 @@
11 11
12#include <asm/pgalloc.h> 12#include <asm/pgalloc.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14#include <asm/tlbflush.h>
14#include <asm-generic/mm_hooks.h> 15#include <asm-generic/mm_hooks.h>
15 16
16static inline int init_new_context(struct task_struct *tsk, 17static inline int init_new_context(struct task_struct *tsk,
17 struct mm_struct *mm) 18 struct mm_struct *mm)
18{ 19{
20 atomic_set(&mm->context.attach_count, 0);
21 mm->context.flush_mm = 0;
19 mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; 22 mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS;
20#ifdef CONFIG_64BIT 23#ifdef CONFIG_64BIT
21 mm->context.asce_bits |= _ASCE_TYPE_REGION3; 24 mm->context.asce_bits |= _ASCE_TYPE_REGION3;
@@ -76,6 +79,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
76{ 79{
77 cpumask_set_cpu(smp_processor_id(), mm_cpumask(next)); 80 cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
78 update_mm(next, tsk); 81 update_mm(next, tsk);
82 atomic_dec(&prev->context.attach_count);
83 WARN_ON(atomic_read(&prev->context.attach_count) < 0);
84 atomic_inc(&next->context.attach_count);
85 /* Check for TLBs not flushed yet */
86 if (next->context.flush_mm)
87 __tlb_flush_mm(next);
79} 88}
80 89
81#define enter_lazy_tlb(mm,tsk) do { } while (0) 90#define enter_lazy_tlb(mm,tsk) do { } while (0)