diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-04-10 03:09:37 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-12 14:09:38 -0400 |
commit | a741e67969577163a4cfc78d7fd2753219087ef1 (patch) | |
tree | bac4162aaf15367e896429afa60465e201c9204c /arch/powerpc/mm/hugetlbpage.c | |
parent | e4ee3891db35aa9a069bb403c2a66a8fbfa274d6 (diff) |
[POWERPC] Make tlb flush batch use lazy MMU mode
The current tlb flush code on powerpc 64 bits has a subtle race since we
lost the page table lock due to the possible faulting in of new PTEs
after a previous one has been removed but before the corresponding hash
entry has been evicted, which can leads to all sort of fatal problems.
This patch reworks the batch code completely. It doesn't use the mmu_gather
stuff anymore. Instead, we use the lazy mmu hooks that were added by the
paravirt code. They have the nice property that the enter/leave lazy mmu
mode pair is always fully contained by the PTE lock for a given range
of PTEs. Thus we can guarantee that all batches are flushed on a given
CPU before it drops that lock.
We also generalize batching for any PTE update that require a flush.
Batching is now enabled on a CPU by arch_enter_lazy_mmu_mode() and
disabled by arch_leave_lazy_mmu_mode(). The code epects that this is
always contained within a PTE lock section so no preemption can happen
and no PTE insertion in that range from another CPU. When batching
is enabled on a CPU, every PTE updates that need a hash flush will
use the batch for that flush.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm/hugetlbpage.c')
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index f6ffaaa7a5bf..8508f973d9cc 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -316,12 +316,11 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | |||
316 | { | 316 | { |
317 | if (pte_present(*ptep)) { | 317 | if (pte_present(*ptep)) { |
318 | /* We open-code pte_clear because we need to pass the right | 318 | /* We open-code pte_clear because we need to pass the right |
319 | * argument to hpte_update (huge / !huge) | 319 | * argument to hpte_need_flush (huge / !huge). Might not be |
320 | * necessary anymore if we make hpte_need_flush() get the | ||
321 | * page size from the slices | ||
320 | */ | 322 | */ |
321 | unsigned long old = pte_update(ptep, ~0UL); | 323 | pte_update(mm, addr & HPAGE_MASK, ptep, ~0UL, 1); |
322 | if (old & _PAGE_HASHPTE) | ||
323 | hpte_update(mm, addr & HPAGE_MASK, ptep, old, 1); | ||
324 | flush_tlb_pending(); | ||
325 | } | 324 | } |
326 | *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); | 325 | *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); |
327 | } | 326 | } |
@@ -329,12 +328,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | |||
329 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | 328 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, |
330 | pte_t *ptep) | 329 | pte_t *ptep) |
331 | { | 330 | { |
332 | unsigned long old = pte_update(ptep, ~0UL); | 331 | unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1); |
333 | |||
334 | if (old & _PAGE_HASHPTE) | ||
335 | hpte_update(mm, addr & HPAGE_MASK, ptep, old, 1); | ||
336 | *ptep = __pte(0); | ||
337 | |||
338 | return __pte(old); | 332 | return __pte(old); |
339 | } | 333 | } |
340 | 334 | ||