From: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
To: Alistair Popple <alistair@popple.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: mpe@ellerman.id.au, benh@kernel.crashing.org,
andrew.donnellan@au1.ibm.com, clombard@linux.vnet.ibm.com,
vaibhav@linux.vnet.ibm.com
Subject: Re: [PATCH v3 1/2] powerpc/mm: Export flush_all_mm()
Date: Wed, 13 Sep 2017 10:34:40 +0200 [thread overview]
Message-ID: <648a876c-e187-423a-c3b9-f3a995afdb7d@linux.vnet.ibm.com> (raw)
In-Reply-To: <2900303.PDvBtpZXzq@new-mexico>
Le 13/09/2017 à 06:04, Alistair Popple a écrit :
>> +static inline void hash__local_flush_all_mm(struct mm_struct *mm)
>> +{
>> + /*
>> + * There's no Page Walk Cache for hash, so what is needed is
>> + * the same as flush_tlb_mm(), which doesn't really make sense
>> + * with hash. So the only thing we could do is flush the
>> + * entire LPID! Punt for now, as it's not being used.
>> + */
>
> Do you think it is worth putting a WARN_ON_ONCE here if we're asserting this
> isn't used on hash?
I toyed with the idea. The reason I didn't add it was because
hash__local_flush_tlb_mm() and hash__flush_tlb_mm() don't have one, yet
it's also not supported. And I had faith in a developer thinking about
using it would see the comment.
I was actually pretty close to have hash__local_flush_all_mm() call
directly hash__local_flush_tlb_mm(), since the "all" stands for "pwc and
tlb" and pwc doesn't exist for hash. But that doesn't do us any good for
the time being.
Michael: any preference?
Side note: I'm under the impression that flush_tlb_mm() may be called on
hash, even though it does nothing. kernel/fork.c, dup_mmap() and
potentially another (through cscope).
Fred
> Otherwise looks good and is also needed for NPU.
>
> Reviewed-By: Alistair Popple <alistair@popple.id.au>
>
>> +}
>> +
>> +static inline void hash__flush_all_mm(struct mm_struct *mm)
>> +{
>> + /*
>> + * There's no Page Walk Cache for hash, so what is needed is
>> + * the same as flush_tlb_mm(), which doesn't really make sense
>> + * with hash. So the only thing we could do is flush the
>> + * entire LPID! Punt for now, as it's not being used.
>> + */
>> +}
>> +
>> static inline void hash__local_flush_tlb_page(struct vm_area_struct *vma,
>> unsigned long vmaddr)
>> {
>> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
>> index 9b433a624bf3..af06c6fe8a9f 100644
>> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
>> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
>> @@ -21,17 +21,20 @@ extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long sta
>> extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
>>
>> extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
>> +extern void radix__local_flush_all_mm(struct mm_struct *mm);
>> extern void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
>> extern void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
>> int psize);
>> extern void radix__tlb_flush(struct mmu_gather *tlb);
>> #ifdef CONFIG_SMP
>> extern void radix__flush_tlb_mm(struct mm_struct *mm);
>> +extern void radix__flush_all_mm(struct mm_struct *mm);
>> extern void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
>> extern void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
>> int psize);
>> #else
>> #define radix__flush_tlb_mm(mm) radix__local_flush_tlb_mm(mm)
>> +#define radix__flush_all_mm(mm) radix__local_flush_all_mm(mm)
>> #define radix__flush_tlb_page(vma,addr) radix__local_flush_tlb_page(vma,addr)
>> #define radix__flush_tlb_page_psize(mm,addr,p) radix__local_flush_tlb_page_psize(mm,addr,p)
>> #endif
>> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h
>> index 72b925f97bab..70760d018bcd 100644
>> --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h
>> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h
>> @@ -57,6 +57,13 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma,
>> return hash__local_flush_tlb_page(vma, vmaddr);
>> }
>>
>> +static inline void local_flush_all_mm(struct mm_struct *mm)
>> +{
>> + if (radix_enabled())
>> + return radix__local_flush_all_mm(mm);
>> + return hash__local_flush_all_mm(mm);
>> +}
>> +
>> static inline void tlb_flush(struct mmu_gather *tlb)
>> {
>> if (radix_enabled())
>> @@ -79,9 +86,17 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
>> return radix__flush_tlb_page(vma, vmaddr);
>> return hash__flush_tlb_page(vma, vmaddr);
>> }
>> +
>> +static inline void flush_all_mm(struct mm_struct *mm)
>> +{
>> + if (radix_enabled())
>> + return radix__flush_all_mm(mm);
>> + return hash__flush_all_mm(mm);
>> +}
>> #else
>> #define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
>> #define flush_tlb_page(vma, addr) local_flush_tlb_page(vma, addr)
>> +#define flush_all_mm(mm) local_flush_all_mm(mm)
>> #endif /* CONFIG_SMP */
>> /*
>> * flush the page walk cache for the address
>> diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
>> index b3e849c4886e..5a1f46eff3a2 100644
>> --- a/arch/powerpc/mm/tlb-radix.c
>> +++ b/arch/powerpc/mm/tlb-radix.c
>> @@ -144,7 +144,7 @@ void radix__local_flush_tlb_mm(struct mm_struct *mm)
>> EXPORT_SYMBOL(radix__local_flush_tlb_mm);
>>
>> #ifndef CONFIG_SMP
>> -static void radix__local_flush_all_mm(struct mm_struct *mm)
>> +void radix__local_flush_all_mm(struct mm_struct *mm)
>> {
>> unsigned long pid;
>>
>> @@ -154,6 +154,7 @@ static void radix__local_flush_all_mm(struct mm_struct *mm)
>> _tlbiel_pid(pid, RIC_FLUSH_ALL);
>> preempt_enable();
>> }
>> +EXPORT_SYMBOL(radix__local_flush_all_mm);
>> #endif /* CONFIG_SMP */
>>
>> void radix__local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
>> @@ -200,7 +201,7 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
>> }
>> EXPORT_SYMBOL(radix__flush_tlb_mm);
>>
>> -static void radix__flush_all_mm(struct mm_struct *mm)
>> +void radix__flush_all_mm(struct mm_struct *mm)
>> {
>> unsigned long pid;
>>
>> @@ -216,6 +217,7 @@ static void radix__flush_all_mm(struct mm_struct *mm)
>> no_context:
>> preempt_enable();
>> }
>> +EXPORT_SYMBOL(radix__flush_all_mm);
>>
>> void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr)
>> {
>>
>
next prev parent reply other threads:[~2017-09-13 8:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-03 18:15 [PATCH v3 1/2] powerpc/mm: Export flush_all_mm() Frederic Barrat
2017-09-03 18:15 ` [PATCH v3 2/2] cxl: Enable global TLBIs for cxl contexts Frederic Barrat
2017-09-08 6:56 ` Nicholas Piggin
2017-09-08 7:34 ` Frederic Barrat
2017-09-08 10:54 ` Nicholas Piggin
2017-09-08 11:18 ` Nicholas Piggin
2017-09-13 3:53 ` Alistair Popple
2017-09-13 3:58 ` Alistair Popple
2017-09-13 4:04 ` [PATCH v3 1/2] powerpc/mm: Export flush_all_mm() Alistair Popple
2017-09-13 8:34 ` Frederic Barrat [this message]
2017-10-05 4:21 ` [v3,1/2] " Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=648a876c-e187-423a-c3b9-f3a995afdb7d@linux.vnet.ibm.com \
--to=fbarrat@linux.vnet.ibm.com \
--cc=alistair@popple.id.au \
--cc=andrew.donnellan@au1.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=clombard@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=vaibhav@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).