Message ID | 20180614124931.703e5b54@roar.ozlabs.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jun 14, 2018 at 11:49 AM Nicholas Piggin <npiggin@gmail.com> wrote: > > +#ifndef pte_free_tlb > #define pte_free_tlb(tlb, ptep, address) \ > do { \ > __tlb_adjust_range(tlb, address, PAGE_SIZE); \ > __pte_free_tlb(tlb, ptep, address); \ > } while (0) > +#endif Do you really want to / need to take over the whole pte_free_tlb macro? I was hoping that you'd just replace the __tlv_adjust_range() instead. Something like - replace the __tlb_adjust_range(tlb, address, PAGE_SIZE); with a "page directory" version: __tlb_free_directory(tlb, address, size); - have the default implementation for that be the old code: #ifndef __tlb_free_directory #define __tlb_free_directory(tlb,addr,size) __tlb_adjust_range(tlb, addr, PAGE_SIZE) #endif and that way architectures can now just hook into that "__tlb_free_directory()" thing. Hmm? Linus
On Thu, 14 Jun 2018 15:15:47 +0900 Linus Torvalds <torvalds@linux-foundation.org> wrote: > On Thu, Jun 14, 2018 at 11:49 AM Nicholas Piggin <npiggin@gmail.com> wrote: > > > > +#ifndef pte_free_tlb > > #define pte_free_tlb(tlb, ptep, address) \ > > do { \ > > __tlb_adjust_range(tlb, address, PAGE_SIZE); \ > > __pte_free_tlb(tlb, ptep, address); \ > > } while (0) > > +#endif > > Do you really want to / need to take over the whole pte_free_tlb macro? > > I was hoping that you'd just replace the __tlv_adjust_range() instead. > > Something like > > - replace the > > __tlb_adjust_range(tlb, address, PAGE_SIZE); > > with a "page directory" version: > > __tlb_free_directory(tlb, address, size); > > - have the default implementation for that be the old code: > > #ifndef __tlb_free_directory > #define __tlb_free_directory(tlb,addr,size) > __tlb_adjust_range(tlb, addr, PAGE_SIZE) > #endif > > and that way architectures can now just hook into that > "__tlb_free_directory()" thing. > > Hmm? Isn't it just easier and less indirection for the arch to just take over the pte_free_tlb instead? I don't see what the __tlb_free_directory gets you except having to follow another macro -- if the arch has something special they want to do there, just do it in their __pte_free_tlb and call it pte_free_tlb instead. Thanks, Nick > > Linus
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index faddde44de8c..fa44321bc8dd 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -262,36 +262,49 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb, * architecture to do its own odd thing, not cause pain for others * http://lkml.kernel.org/r/CA+55aFzBggoXtNXQeng5d_mRoDnaMBE5Y+URs+PHR67nUpMtaw@mail.gmail.com * + * Powerpc (Book3S 64-bit) with the radix MMU has an architected "page + * walk cache" that is invalidated with a specific instruction. It uses + * need_flush_all to issue this instruction, which is set by its own + * __p??_free_tlb functions. + * * For now w.r.t page table cache, mark the range_size as PAGE_SIZE */ +#ifndef pte_free_tlb #define pte_free_tlb(tlb, ptep, address) \ do { \ __tlb_adjust_range(tlb, address, PAGE_SIZE); \ __pte_free_tlb(tlb, ptep, address); \ } while (0) +#endif +#ifndef pmd_free_tlb #define pmd_free_tlb(tlb, pmdp, address) \ do { \ - __tlb_adjust_range(tlb, address, PAGE_SIZE); \ + __tlb_adjust_range(tlb, address, PAGE_SIZE); \ __pmd_free_tlb(tlb, pmdp, address); \ } while (0) +#endif #ifndef __ARCH_HAS_4LEVEL_HACK +#ifndef pud_free_tlb #define pud_free_tlb(tlb, pudp, address) \ do { \ __tlb_adjust_range(tlb, address, PAGE_SIZE); \ __pud_free_tlb(tlb, pudp, address); \ } while (0) #endif +#endif #ifndef __ARCH_HAS_5LEVEL_HACK +#ifndef p4d_free_tlb #define p4d_free_tlb(tlb, pudp, address) \ do { \ - __tlb_adjust_range(tlb, address, PAGE_SIZE); \ + __tlb_adjust_range(tlb, address, PAGE_SIZE); \ __p4d_free_tlb(tlb, pudp, address); \ } while (0) #endif +#endif #define tlb_migrate_finish(mm) do {} while (0)