Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-25 Thread Minchan Kim
On Mon, Nov 23, 2020 at 06:13:34PM -0700, Yu Zhao wrote: > On Mon, Nov 23, 2020 at 09:17:51PM +, Will Deacon wrote: > > On Mon, Nov 23, 2020 at 01:04:03PM -0700, Yu Zhao wrote: > > > On Mon, Nov 23, 2020 at 06:35:55PM +, Will Deacon wrote: > > > > On Fri, Nov 20, 2020 at 01:40:05PM -0700,

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-24 Thread Peter Zijlstra
On Fri, Nov 20, 2020 at 01:40:05PM -0700, Yu Zhao wrote: > It seems to me ARM's interpretation of tlb->fullmm is a special case, > not the other way around. I don't think ARM is special here, IIRC there were more architectures that did that.

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-24 Thread Will Deacon
On Mon, Nov 23, 2020 at 06:13:34PM -0700, Yu Zhao wrote: > On Mon, Nov 23, 2020 at 09:17:51PM +, Will Deacon wrote: > > On Mon, Nov 23, 2020 at 01:04:03PM -0700, Yu Zhao wrote: > > > On Mon, Nov 23, 2020 at 06:35:55PM +, Will Deacon wrote: > > > > On Fri, Nov 20, 2020 at 01:40:05PM -0700,

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-23 Thread Yu Zhao
On Mon, Nov 23, 2020 at 09:17:51PM +, Will Deacon wrote: > On Mon, Nov 23, 2020 at 01:04:03PM -0700, Yu Zhao wrote: > > On Mon, Nov 23, 2020 at 06:35:55PM +, Will Deacon wrote: > > > On Fri, Nov 20, 2020 at 01:40:05PM -0700, Yu Zhao wrote: > > > > On Fri, Nov 20, 2020 at 02:35:57PM +,

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-23 Thread Will Deacon
On Mon, Nov 23, 2020 at 01:04:03PM -0700, Yu Zhao wrote: > On Mon, Nov 23, 2020 at 06:35:55PM +, Will Deacon wrote: > > On Fri, Nov 20, 2020 at 01:40:05PM -0700, Yu Zhao wrote: > > > On Fri, Nov 20, 2020 at 02:35:57PM +, Will Deacon wrote: > > > > clear_refs_write() uses the 'fullmm' API

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-23 Thread Yu Zhao
On Mon, Nov 23, 2020 at 06:35:55PM +, Will Deacon wrote: > On Fri, Nov 20, 2020 at 01:40:05PM -0700, Yu Zhao wrote: > > On Fri, Nov 20, 2020 at 02:35:57PM +, Will Deacon wrote: > > > clear_refs_write() uses the 'fullmm' API for invalidating TLBs after > > > updating the page-tables for the

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-23 Thread Will Deacon
On Fri, Nov 20, 2020 at 01:40:05PM -0700, Yu Zhao wrote: > On Fri, Nov 20, 2020 at 02:35:57PM +, Will Deacon wrote: > > clear_refs_write() uses the 'fullmm' API for invalidating TLBs after > > updating the page-tables for the current mm. However, since the mm is not > > being freed, this can

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-20 Thread Yu Zhao
On Fri, Nov 20, 2020 at 02:35:57PM +, Will Deacon wrote: > clear_refs_write() uses the 'fullmm' API for invalidating TLBs after > updating the page-tables for the current mm. However, since the mm is not > being freed, this can result in stale TLB entries on architectures which > elide

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-20 Thread Linus Torvalds
On Fri, Nov 20, 2020 at 9:41 AM Linus Torvalds wrote: > > This code sequence looks bogus to begin with. Oh, never mind. I was reading the patches out of order, because 4/6 showed up later in my inbox since it had other replies. You seem to have fixed that bogosity in 4/6. Linus

Re: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-20 Thread Linus Torvalds
On Fri, Nov 20, 2020 at 6:36 AM Will Deacon wrote: > > Ensure that TLB invalidation is performed after updating soft-dirty > entries via clear_refs_write() by using the non-fullmm API to MMU gather. This code sequence looks bogus to begin with. It does that tlb_gather_mmu(, mm,

[PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling

2020-11-20 Thread Will Deacon
clear_refs_write() uses the 'fullmm' API for invalidating TLBs after updating the page-tables for the current mm. However, since the mm is not being freed, this can result in stale TLB entries on architectures which elide 'fullmm' invalidation. Ensure that TLB invalidation is performed after