All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry
@ 2017-07-08 12:45 Benjamin Herrenschmidt
  2017-07-10  3:51 ` Michael Ellerman
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2017-07-08 12:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Aneesh Kumar K.V, Michael Neuling

On radix, the process table entry we want to clear when
destroying a context is entry 0, not entry 1

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/mm/mmu_context_book3s64.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
index 79d8c8a..9404b5e 100644
--- a/arch/powerpc/mm/mmu_context_book3s64.c
+++ b/arch/powerpc/mm/mmu_context_book3s64.c
@@ -226,9 +226,15 @@ void destroy_context(struct mm_struct *mm)
 	mm->context.cop_lockp = NULL;
 #endif /* CONFIG_PPC_ICSWX */
 
-	if (radix_enabled())
-		process_tb[mm->context.id].prtb1 = 0;
-	else
+	if (radix_enabled()) {
+		/*
+		 * Radix doesn't have a valid bit in the process table
+		 * entries. However we know that at least P9 implementation
+		 * will avoid caching an entry with an invalid RTS field,
+		 * and 0 is invalid. So this will do.
+		 */
+		process_tb[mm->context.id].prtb0 = 0;
+	} else
 		subpage_prot_free(mm);
 	destroy_pagetable_page(mm);
 	__destroy_context(mm->context.id);

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

* Re: [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry
  2017-07-08 12:45 [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry Benjamin Herrenschmidt
@ 2017-07-10  3:51 ` Michael Ellerman
  2017-07-10  3:59   ` Benjamin Herrenschmidt
  2017-07-10  4:26 ` Nicholas Piggin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Michael Ellerman @ 2017-07-10  3:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Michael Neuling, Aneesh Kumar K.V

Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> On radix, the process table entry we want to clear when
> destroying a context is entry 0, not entry 1

.. but has no real world consequence? Or causes the system to instantly
catch fire?


I'll tag it:

Fixes: 7e381c0ff618 ("powerpc/mm/radix: Add mmu context handling callback for radix")

cheers

> diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
> index 79d8c8a..9404b5e 100644
> --- a/arch/powerpc/mm/mmu_context_book3s64.c
> +++ b/arch/powerpc/mm/mmu_context_book3s64.c
> @@ -226,9 +226,15 @@ void destroy_context(struct mm_struct *mm)
>  	mm->context.cop_lockp = NULL;
>  #endif /* CONFIG_PPC_ICSWX */
>  
> -	if (radix_enabled())
> -		process_tb[mm->context.id].prtb1 = 0;
> -	else
> +	if (radix_enabled()) {
> +		/*
> +		 * Radix doesn't have a valid bit in the process table
> +		 * entries. However we know that at least P9 implementation
> +		 * will avoid caching an entry with an invalid RTS field,
> +		 * and 0 is invalid. So this will do.
> +		 */
> +		process_tb[mm->context.id].prtb0 = 0;
> +	} else
>  		subpage_prot_free(mm);
>  	destroy_pagetable_page(mm);
>  	__destroy_context(mm->context.id);

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

* Re: [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry
  2017-07-10  3:51 ` Michael Ellerman
@ 2017-07-10  3:59   ` Benjamin Herrenschmidt
  2017-07-10 10:36     ` Michael Ellerman
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2017-07-10  3:59 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: Michael Neuling, Aneesh Kumar K.V

On Mon, 2017-07-10 at 13:51 +1000, Michael Ellerman wrote:
> Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> 
> > On radix, the process table entry we want to clear when
> > destroying a context is entry 0, not entry 1
> 
> .. but has no real world consequence? Or causes the system to instantly
> catch fire?

It has no *immediate* consequence on P9 , but it can cause other bugs
to become worse (such as the KVM issue I'm chasing).
> 
> I'll tag it:
> 
> Fixes: 7e381c0ff618 ("powerpc/mm/radix: Add mmu context handling callback for radix")
> 
> cheers
> 
> > diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
> > index 79d8c8a..9404b5e 100644
> > --- a/arch/powerpc/mm/mmu_context_book3s64.c
> > +++ b/arch/powerpc/mm/mmu_context_book3s64.c
> > @@ -226,9 +226,15 @@ void destroy_context(struct mm_struct *mm)
> >  	mm->context.cop_lockp = NULL;
> >  #endif /* CONFIG_PPC_ICSWX */
> >  
> > -	if (radix_enabled())
> > -		process_tb[mm->context.id].prtb1 = 0;
> > -	else
> > +	if (radix_enabled()) {
> > +		/*
> > +		 * Radix doesn't have a valid bit in the process table
> > +		 * entries. However we know that at least P9 implementation
> > +		 * will avoid caching an entry with an invalid RTS field,
> > +		 * and 0 is invalid. So this will do.
> > +		 */
> > +		process_tb[mm->context.id].prtb0 = 0;
> > +	} else
> >  		subpage_prot_free(mm);
> >  	destroy_pagetable_page(mm);
> >  	__destroy_context(mm->context.id);

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

* Re: [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry
  2017-07-08 12:45 [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry Benjamin Herrenschmidt
  2017-07-10  3:51 ` Michael Ellerman
@ 2017-07-10  4:26 ` Nicholas Piggin
  2017-07-10  5:15 ` Aneesh Kumar K.V
  2017-07-11 12:48 ` [1/2] " Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Nicholas Piggin @ 2017-07-10  4:26 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Michael Neuling, Aneesh Kumar K.V

On Sat, 08 Jul 2017 07:45:32 -0500
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On radix, the process table entry we want to clear when
> destroying a context is entry 0, not entry 1
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

This looks obviously correct to me.

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

* Re: [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry
  2017-07-08 12:45 [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry Benjamin Herrenschmidt
  2017-07-10  3:51 ` Michael Ellerman
  2017-07-10  4:26 ` Nicholas Piggin
@ 2017-07-10  5:15 ` Aneesh Kumar K.V
  2017-07-11 12:48 ` [1/2] " Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Aneesh Kumar K.V @ 2017-07-10  5:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Michael Neuling

Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> On radix, the process table entry we want to clear when
> destroying a context is entry 0, not entry 1
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

> ---
>  arch/powerpc/mm/mmu_context_book3s64.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
> index 79d8c8a..9404b5e 100644
> --- a/arch/powerpc/mm/mmu_context_book3s64.c
> +++ b/arch/powerpc/mm/mmu_context_book3s64.c
> @@ -226,9 +226,15 @@ void destroy_context(struct mm_struct *mm)
>  	mm->context.cop_lockp = NULL;
>  #endif /* CONFIG_PPC_ICSWX */
>
> -	if (radix_enabled())
> -		process_tb[mm->context.id].prtb1 = 0;
> -	else
> +	if (radix_enabled()) {
> +		/*
> +		 * Radix doesn't have a valid bit in the process table
> +		 * entries. However we know that at least P9 implementation
> +		 * will avoid caching an entry with an invalid RTS field,
> +		 * and 0 is invalid. So this will do.
> +		 */
> +		process_tb[mm->context.id].prtb0 = 0;
> +	} else
>  		subpage_prot_free(mm);
>  	destroy_pagetable_page(mm);
>  	__destroy_context(mm->context.id);

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

* Re: [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry
  2017-07-10  3:59   ` Benjamin Herrenschmidt
@ 2017-07-10 10:36     ` Michael Ellerman
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2017-07-10 10:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Michael Neuling, Aneesh Kumar K.V

Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> On Mon, 2017-07-10 at 13:51 +1000, Michael Ellerman wrote:
>> Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
>> 
>> > On radix, the process table entry we want to clear when
>> > destroying a context is entry 0, not entry 1
>> 
>> .. but has no real world consequence? Or causes the system to instantly
>> catch fire?
>
> It has no *immediate* consequence on P9 , but it can cause other bugs
> to become worse (such as the KVM issue I'm chasing).

OK, I'll flag it for stable then to be safe.

cheers

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

* Re: [1/2] powerpc/mm/radix: Properly clear process table entry
  2017-07-08 12:45 [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry Benjamin Herrenschmidt
                   ` (2 preceding siblings ...)
  2017-07-10  5:15 ` Aneesh Kumar K.V
@ 2017-07-11 12:48 ` Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2017-07-11 12:48 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Michael Neuling, Aneesh Kumar K.V

On Sat, 2017-07-08 at 12:45:32 UTC, Benjamin Herrenschmidt wrote:
> On radix, the process table entry we want to clear when
> destroying a context is entry 0, not entry 1
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/c6bb0b8d426a8cf865ca9c8a532cc3

cheers

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

end of thread, other threads:[~2017-07-11 12:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08 12:45 [PATCH 1/2] powerpc/mm/radix: Properly clear process table entry Benjamin Herrenschmidt
2017-07-10  3:51 ` Michael Ellerman
2017-07-10  3:59   ` Benjamin Herrenschmidt
2017-07-10 10:36     ` Michael Ellerman
2017-07-10  4:26 ` Nicholas Piggin
2017-07-10  5:15 ` Aneesh Kumar K.V
2017-07-11 12:48 ` [1/2] " Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.