linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
       [not found] ` <20180923150830.6096-2-npiggin@gmail.com>
@ 2018-09-29  1:37   ` Nicholas Piggin
  2018-10-01 15:24     ` Ley Foon Tan
  0 siblings, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2018-09-29  1:37 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: Guenter Roeck, nios2-dev, linux-mm

Hi,

Did you get a chance to look at these?

This first patch 1/11 solves the lockup problem that Guenter reported
with my changes to core mm code. So I plan to resubmit my patches
to Andrew's -mm tree with this patch to avoid nios2 breakage.

Thanks,
Nick

On Mon, 24 Sep 2018 01:08:20 +1000
Nicholas Piggin <npiggin@gmail.com> wrote:

> Fault paths like do_read_fault will install a Linux pte with the young
> bit clear. The CPU will fault again because the TLB has not been
> updated, this time a valid pte exists so handle_pte_fault will just
> set the young bit with ptep_set_access_flags, which flushes the TLB.
> 
> The TLB is flushed so the next attempt will go to the fast TLB handler
> which loads the TLB with the new Linux pte. The access then proceeds.
> 
> This design is fragile to depend on the young bit being clear after
> the initial Linux fault. A proposed core mm change to immediately set
> the young bit upon such a fault, results in ptep_set_access_flags not
> flushing the TLB because it finds no change to the pte. The spurious
> fault fix path only flushes the TLB if the access was a store. If it
> was a load, then this results in an infinite loop of page faults.
> 
> This change adds a TLB flush in update_mmu_cache, which removes that
> TLB entry upon the first fault. This will cause the fast TLB handler
> to load the new pte and avoid the Linux page fault entirely.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  arch/nios2/mm/cacheflush.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/nios2/mm/cacheflush.c b/arch/nios2/mm/cacheflush.c
> index 506f6e1c86d5..d58e7e80dc0d 100644
> --- a/arch/nios2/mm/cacheflush.c
> +++ b/arch/nios2/mm/cacheflush.c
> @@ -204,6 +204,8 @@ void update_mmu_cache(struct vm_area_struct *vma,
>  	struct page *page;
>  	struct address_space *mapping;
>  
> +	flush_tlb_page(vma, address);
> +
>  	if (!pfn_valid(pfn))
>  		return;
>  
> -- 
> 2.18.0
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-09-29  1:37   ` [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB Nicholas Piggin
@ 2018-10-01 15:24     ` Ley Foon Tan
  2018-10-02  0:06       ` Nicholas Piggin
  2018-10-03  3:52       ` Nicholas Piggin
  0 siblings, 2 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-10-01 15:24 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:
> Hi,
> 
> Did you get a chance to look at these?
> 
> This first patch 1/11 solves the lockup problem that Guenter reported
> with my changes to core mm code. So I plan to resubmit my patches
> to Andrew's -mm tree with this patch to avoid nios2 breakage.
> 
> Thanks,
> Nick

Do you have git repo that contains these patches? If not, can you send
them as attachment to my email?


Regards
Ley Foon
> 
> On Mon, 24 Sep 2018 01:08:20 +1000
> Nicholas Piggin <npiggin@gmail.com> wrote:
> 
> > 
> > Fault paths like do_read_fault will install a Linux pte with the
> > young
> > bit clear. The CPU will fault again because the TLB has not been
> > updated, this time a valid pte exists so handle_pte_fault will just
> > set the young bit with ptep_set_access_flags, which flushes the
> > TLB.
> > 
> > The TLB is flushed so the next attempt will go to the fast TLB
> > handler
> > which loads the TLB with the new Linux pte. The access then
> > proceeds.
> > 
> > This design is fragile to depend on the young bit being clear after
> > the initial Linux fault. A proposed core mm change to immediately
> > set
> > the young bit upon such a fault, results in ptep_set_access_flags
> > not
> > flushing the TLB because it finds no change to the pte. The
> > spurious
> > fault fix path only flushes the TLB if the access was a store. If
> > it
> > was a load, then this results in an infinite loop of page faults.
> > 
> > This change adds a TLB flush in update_mmu_cache, which removes
> > that
> > TLB entry upon the first fault. This will cause the fast TLB
> > handler
> > to load the new pte and avoid the Linux page fault entirely.
> > 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >  arch/nios2/mm/cacheflush.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/nios2/mm/cacheflush.c
> > b/arch/nios2/mm/cacheflush.c
> > index 506f6e1c86d5..d58e7e80dc0d 100644
> > --- a/arch/nios2/mm/cacheflush.c
> > +++ b/arch/nios2/mm/cacheflush.c
> > @@ -204,6 +204,8 @@ void update_mmu_cache(struct vm_area_struct
> > *vma,
> >  	struct page *page;
> >  	struct address_space *mapping;
> >  
> > +	flush_tlb_page(vma, address);
> > +
> >  	if (!pfn_valid(pfn))
> >  		return;
> >  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-10-01 15:24     ` Ley Foon Tan
@ 2018-10-02  0:06       ` Nicholas Piggin
  2018-10-03  3:52       ` Nicholas Piggin
  1 sibling, 0 replies; 8+ messages in thread
From: Nicholas Piggin @ 2018-10-02  0:06 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Mon, 01 Oct 2018 23:24:23 +0800
Ley Foon Tan <ley.foon.tan@intel.com> wrote:

> On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:
> > Hi,
> > 
> > Did you get a chance to look at these?
> > 
> > This first patch 1/11 solves the lockup problem that Guenter reported
> > with my changes to core mm code. So I plan to resubmit my patches
> > to Andrew's -mm tree with this patch to avoid nios2 breakage.
> > 
> > Thanks,
> > Nick  
> 
> Do you have git repo that contains these patches? If not, can you send
> them as attachment to my email?

I can do that, but it would be good to work with inline patches because
that's the usual method (rather than attached patches).

You should be able to just download or save your email and patch it,
export to mbox and `git am` it, etc. So they should be quite easy to
work with.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-10-01 15:24     ` Ley Foon Tan
  2018-10-02  0:06       ` Nicholas Piggin
@ 2018-10-03  3:52       ` Nicholas Piggin
  2018-10-05  1:52         ` Ley Foon Tan
  1 sibling, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2018-10-03  3:52 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Mon, 01 Oct 2018 23:24:23 +0800
Ley Foon Tan <ley.foon.tan@intel.com> wrote:

> On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:
> > Hi,
> > 
> > Did you get a chance to look at these?
> > 
> > This first patch 1/11 solves the lockup problem that Guenter reported
> > with my changes to core mm code. So I plan to resubmit my patches
> > to Andrew's -mm tree with this patch to avoid nios2 breakage.
> > 
> > Thanks,
> > Nick  
> 
> Do you have git repo that contains these patches? If not, can you send
> them as attachment to my email?

Here's a tree with these patches plus 3 of the core mm code changes
which caused nios2 to hang

https://github.com/npiggin/linux/commits/nios2

Thanks,
Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-10-03  3:52       ` Nicholas Piggin
@ 2018-10-05  1:52         ` Ley Foon Tan
  2018-10-08  7:16           ` Nicholas Piggin
  0 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2018-10-05  1:52 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Wed, 2018-10-03 at 13:52 +1000, Nicholas Piggin wrote:
> On Mon, 01 Oct 2018 23:24:23 +0800
> Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> 
> > 
> > On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:
> > > 
> > > Hi,
> > > 
> > > Did you get a chance to look at these?
> > > 
> > > This first patch 1/11 solves the lockup problem that Guenter
> > > reported
> > > with my changes to core mm code. So I plan to resubmit my patches
> > > to Andrew's -mm tree with this patch to avoid nios2 breakage.
> > > 
> > > Thanks,
> > > Nick  
> > Do you have git repo that contains these patches? If not, can you
> > send
> > them as attachment to my email?
> Here's a tree with these patches plus 3 of the core mm code changes
> which caused nios2 to hang
> 
> https://github.com/npiggin/linux/commits/nios2
> 
Hi Nick

Tested your patches on the github branch. Kernel bootup and ethernet
ping are working.

Regards
Ley Foon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-10-05  1:52         ` Ley Foon Tan
@ 2018-10-08  7:16           ` Nicholas Piggin
  2018-10-08 17:02             ` Ley Foon Tan
  0 siblings, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2018-10-08  7:16 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Fri, 05 Oct 2018 09:52:56 +0800
Ley Foon Tan <ley.foon.tan@intel.com> wrote:

> On Wed, 2018-10-03 at 13:52 +1000, Nicholas Piggin wrote:
> > On Mon, 01 Oct 2018 23:24:23 +0800
> > Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> >   
> > > 
> > > On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:  
> > > > 
> > > > Hi,
> > > > 
> > > > Did you get a chance to look at these?
> > > > 
> > > > This first patch 1/11 solves the lockup problem that Guenter
> > > > reported
> > > > with my changes to core mm code. So I plan to resubmit my patches
> > > > to Andrew's -mm tree with this patch to avoid nios2 breakage.
> > > > 
> > > > Thanks,
> > > > Nick    
> > > Do you have git repo that contains these patches? If not, can you
> > > send
> > > them as attachment to my email?  
> > Here's a tree with these patches plus 3 of the core mm code changes
> > which caused nios2 to hang
> > 
> > https://github.com/npiggin/linux/commits/nios2
> >   
> Hi Nick
> 
> Tested your patches on the github branch. Kernel bootup and ethernet
> ping are working.

Hi Ley,

Thank you for testing. I would like to send patch 1 together with my
generic TLB optimisation patches to Andrew. Can I get a Reviewed-by
or ack from you on that?

As to the other nios2 patches, I will leave them to you to merge them
if you want them.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-10-08 17:02             ` Ley Foon Tan
@ 2018-10-08  9:21               ` Nicholas Piggin
  0 siblings, 0 replies; 8+ messages in thread
From: Nicholas Piggin @ 2018-10-08  9:21 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Tue, 09 Oct 2018 01:02:18 +0800
Ley Foon Tan <ley.foon.tan@intel.com> wrote:

> On Mon, 2018-10-08 at 17:16 +1000, Nicholas Piggin wrote:
> > On Fri, 05 Oct 2018 09:52:56 +0800
> > Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> >   
> > > 
> > > On Wed, 2018-10-03 at 13:52 +1000, Nicholas Piggin wrote:  
> > > > 
> > > > On Mon, 01 Oct 2018 23:24:23 +0800
> > > > Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> > > >     
> > > > > 
> > > > > 
> > > > > On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:    
> > > > > > 
> > > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > Did you get a chance to look at these?
> > > > > > 
> > > > > > This first patch 1/11 solves the lockup problem that Guenter
> > > > > > reported
> > > > > > with my changes to core mm code. So I plan to resubmit my
> > > > > > patches
> > > > > > to Andrew's -mm tree with this patch to avoid nios2 breakage.
> > > > > > 
> > > > > > Thanks,
> > > > > > Nick      
> > > > > Do you have git repo that contains these patches? If not, can
> > > > > you
> > > > > send
> > > > > them as attachment to my email?    
> > > > Here's a tree with these patches plus 3 of the core mm code
> > > > changes
> > > > which caused nios2 to hang
> > > > 
> > > > https://github.com/npiggin/linux/commits/nios2
> > > >     
> > > Hi Nick
> > > 
> > > Tested your patches on the github branch. Kernel bootup and
> > > ethernet
> > > ping are working.  
> > Hi Ley,
> > 
> > Thank you for testing. I would like to send patch 1 together with my
> > generic TLB optimisation patches to Andrew. Can I get a Reviewed-by
> > or ack from you on that?  
> For that series,
> Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>

Thank you, I will use it for patch 1 if necessary

> 
> > 
> > As to the other nios2 patches, I will leave them to you to merge them
> > if you want them.  
> I can merge these nios2 patches. BTW, any dependency between these
> nios2 patches with the generic TLB optimisation patches? e.g: patch
> applying sequence.

That would be good. The only dependency is that the generic TLB patches
depend on nios2 patch 1, so you should be able to take them and merge
them now. I will have to take care of the patch 1 dependency when
submitting the generic TLB patches.

Thanks,
Nick


> 
> 
> Regards
> Ley Foon
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB
  2018-10-08  7:16           ` Nicholas Piggin
@ 2018-10-08 17:02             ` Ley Foon Tan
  2018-10-08  9:21               ` Nicholas Piggin
  0 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2018-10-08 17:02 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: Guenter Roeck, nios2-dev, linux-mm

On Mon, 2018-10-08 at 17:16 +1000, Nicholas Piggin wrote:
> On Fri, 05 Oct 2018 09:52:56 +0800
> Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> 
> > 
> > On Wed, 2018-10-03 at 13:52 +1000, Nicholas Piggin wrote:
> > > 
> > > On Mon, 01 Oct 2018 23:24:23 +0800
> > > Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> > >   
> > > > 
> > > > 
> > > > On Sat, 2018-09-29 at 11:37 +1000, Nicholas Piggin wrote:  
> > > > > 
> > > > > 
> > > > > Hi,
> > > > > 
> > > > > Did you get a chance to look at these?
> > > > > 
> > > > > This first patch 1/11 solves the lockup problem that Guenter
> > > > > reported
> > > > > with my changes to core mm code. So I plan to resubmit my
> > > > > patches
> > > > > to Andrew's -mm tree with this patch to avoid nios2 breakage.
> > > > > 
> > > > > Thanks,
> > > > > Nick    
> > > > Do you have git repo that contains these patches? If not, can
> > > > you
> > > > send
> > > > them as attachment to my email?  
> > > Here's a tree with these patches plus 3 of the core mm code
> > > changes
> > > which caused nios2 to hang
> > > 
> > > https://github.com/npiggin/linux/commits/nios2
> > >   
> > Hi Nick
> > 
> > Tested your patches on the github branch. Kernel bootup and
> > ethernet
> > ping are working.
> Hi Ley,
> 
> Thank you for testing. I would like to send patch 1 together with my
> generic TLB optimisation patches to Andrew. Can I get a Reviewed-by
> or ack from you on that?
For that series,
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>

> 
> As to the other nios2 patches, I will leave them to you to merge them
> if you want them.
I can merge these nios2 patches. BTW, any dependency between these
nios2 patches with the generic TLB optimisation patches? e.g: patch
applying sequence.


Regards
Ley Foon

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-08  9:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180923150830.6096-1-npiggin@gmail.com>
     [not found] ` <20180923150830.6096-2-npiggin@gmail.com>
2018-09-29  1:37   ` [RFC PATCH 01/11] nios2: update_mmu_cache clear the old entry from the TLB Nicholas Piggin
2018-10-01 15:24     ` Ley Foon Tan
2018-10-02  0:06       ` Nicholas Piggin
2018-10-03  3:52       ` Nicholas Piggin
2018-10-05  1:52         ` Ley Foon Tan
2018-10-08  7:16           ` Nicholas Piggin
2018-10-08 17:02             ` Ley Foon Tan
2018-10-08  9:21               ` Nicholas Piggin

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).