From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: akpm@linux-foundation.org, npiggin@gmail.com, mpe@ellerman.id.au,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH 1/2] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush
Date: Tue, 17 Dec 2019 16:18:40 +0530 [thread overview]
Message-ID: <3d250b04-a78d-20a7-d41e-50e48e08d1cb@linux.ibm.com> (raw)
In-Reply-To: <20191217090914.GX2844@hirez.programming.kicks-ass.net>
On 12/17/19 2:39 PM, Peter Zijlstra wrote:
> On Tue, Dec 17, 2019 at 12:47:12PM +0530, Aneesh Kumar K.V wrote:
>> Architectures for which we have hardware walkers of Linux page table should
>> flush TLB on mmu gather batch allocation failures and batch flush. Some
>> architectures like POWER supports multiple translation modes (hash and radix)
>> and in the case of POWER only radix translation mode needs the above TLBI.
>> This is because for hash translation mode kernel wants to avoid this extra
>> flush since there are no hardware walkers of linux page table. With radix
>> translation, the hardware also walks linux page table and with that, kernel
>> needs to make sure to TLB invalidate page walk cache before page table pages are
>> freed.
>
>> Based on changes from Peter Zijlstra <peterz@infradead.org>
>
> AFAICT it is all my patch ;-)
Yes. I moved the changes you had to upstream. I can update the From: in
the next version if you are ok with that?
>
> Anyway, this commit:
>
>> More details in
>> commit: d86564a2f085 ("mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE")
>
> states that you do an explicit invalidate in __p*_free_tlb(), which, if
> I'm not mistaken is still there:
>
> arch/powerpc/include/asm/nohash/pgalloc.h: tlb_flush_pgtable(tlb, address);
>
nohash is not really radix. So we still do the tlb flush from the
pte_free_tlb for nohash and for PPC-radix, we let tlb_table_invalidate
to flush that.
> Or am I reading this wrong? I'm thinking you can remove that now.
>
>> diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
>> index b2c0be93929d..feea1a09bbce 100644
>> --- a/arch/powerpc/include/asm/tlb.h
>> +++ b/arch/powerpc/include/asm/tlb.h
>> @@ -27,6 +27,10 @@
>> #define tlb_flush tlb_flush
>> extern void tlb_flush(struct mmu_gather *tlb);
>>
>> +#ifdef CONFIG_HAVE_RCU_TABLE_FREE
> /*
> * PPC-Hash does not use the linux page-tables, so we can avoid
> * the TLBI for page-table freeing, PPC-Radix otoh does use the
> * page-tables and needs the TLBI.
> */
>> +#define tlb_needs_table_invalidate() radix_enabled()
>> +#endif
>
> Also, are you really sure about the !SMP case? Esp. on Radix I'm
> thinking that the PWC (page-walk-cache) can give trouble even on UP,
> when we get preempted in the middle of mmu_gather. Hmm?
>
Yes, looking at !SMP I guess we do have issue there. we do free the
pagetable pages directly in __p*_free_tlb() with the current code. That
will definitely not work. Are you suggesting we enable
HAVE_RCU_TABLE_FREE even for !SMP?
>> /* Get the generic bits... */
>> #include <asm-generic/tlb.h>
>
>
-aneesh
next prev parent reply other threads:[~2019-12-17 10:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 7:17 Aneesh Kumar K.V
2019-12-17 7:17 ` [RFC PATCH 2/2] mm/mmu_gather: Avoid multiple page walk cache flush Aneesh Kumar K.V
2019-12-17 8:58 ` Peter Zijlstra
2019-12-17 10:15 ` Aneesh Kumar K.V
2019-12-17 12:34 ` Peter Zijlstra
2019-12-17 20:12 ` [PATCH] asm-generic/tlb: Avoid potential double flush Peter Zijlstra
2019-12-17 9:09 ` [RFC PATCH 1/2] mm/mmu_gather: Invalidate TLB correctly on batch allocation failure and flush Peter Zijlstra
2019-12-17 10:48 ` Aneesh Kumar K.V [this message]
2019-12-17 12:35 ` Peter Zijlstra
2019-12-18 5:22 ` Aneesh Kumar K.V
2019-12-18 9:01 ` Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2019-12-17 7:16 Aneesh Kumar K.V
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=3d250b04-a78d-20a7-d41e-50e48e08d1cb@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
/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