All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: Add missing global TLBI if cxl is active
@ 2017-03-29 17:19 Frederic Barrat
  2017-04-04  9:23 ` Aneesh Kumar K.V
  2017-04-06 13:23 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Frederic Barrat @ 2017-03-29 17:19 UTC (permalink / raw)
  To: aneesh.kumar, bsingharora, linuxppc-dev

Commit 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl") converted local
TLBIs to global if the cxl driver is active. It is necessary because
the CAPP snoops invalidations to forward them to the PSL on the cxl
adapter.
However one path was apparently forgotten. native_flush_hash_range()
still sends local TLBIs, as found out the hard way recently.

This patch fixes it by following the same logic as previously: if the
cxl driver is active, the local TLBIs are 'upgraded' to global.

Fixes: 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl")
Cc: stable@vger.kernel.org
Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
---
 arch/powerpc/mm/hash_native_64.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index cc33260..65bb8f3 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -638,6 +638,10 @@ static void native_flush_hash_range(unsigned long number, int local)
 	unsigned long psize = batch->psize;
 	int ssize = batch->ssize;
 	int i;
+	unsigned int use_local;
+
+	use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) &&
+		mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use();
 
 	local_irq_save(flags);
 
@@ -667,8 +671,7 @@ static void native_flush_hash_range(unsigned long number, int local)
 		} pte_iterate_hashed_end();
 	}
 
-	if (mmu_has_feature(MMU_FTR_TLBIEL) &&
-	    mmu_psize_defs[psize].tlbiel && local) {
+	if (use_local) {
 		asm volatile("ptesync":::"memory");
 		for (i = 0; i < number; i++) {
 			vpn = batch->vpn[i];
-- 
2.9.3

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

* Re: [PATCH] powerpc/mm: Add missing global TLBI if cxl is active
  2017-03-29 17:19 [PATCH] powerpc/mm: Add missing global TLBI if cxl is active Frederic Barrat
@ 2017-04-04  9:23 ` Aneesh Kumar K.V
  2017-04-06 13:23 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2017-04-04  9:23 UTC (permalink / raw)
  To: Frederic Barrat, bsingharora, linuxppc-dev

Frederic Barrat <fbarrat@linux.vnet.ibm.com> writes:

> Commit 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl") converted local
> TLBIs to global if the cxl driver is active. It is necessary because
> the CAPP snoops invalidations to forward them to the PSL on the cxl
> adapter.
> However one path was apparently forgotten. native_flush_hash_range()
> still sends local TLBIs, as found out the hard way recently.
>
> This patch fixes it by following the same logic as previously: if the
> cxl driver is active, the local TLBIs are 'upgraded' to global.
>
> Fixes: 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl")
> Cc: stable@vger.kernel.org
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>

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

> ---
>  arch/powerpc/mm/hash_native_64.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
> index cc33260..65bb8f3 100644
> --- a/arch/powerpc/mm/hash_native_64.c
> +++ b/arch/powerpc/mm/hash_native_64.c
> @@ -638,6 +638,10 @@ static void native_flush_hash_range(unsigned long number, int local)
>  	unsigned long psize = batch->psize;
>  	int ssize = batch->ssize;
>  	int i;
> +	unsigned int use_local;
> +
> +	use_local = local && mmu_has_feature(MMU_FTR_TLBIEL) &&
> +		mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use();
>
>  	local_irq_save(flags);
>
> @@ -667,8 +671,7 @@ static void native_flush_hash_range(unsigned long number, int local)
>  		} pte_iterate_hashed_end();
>  	}
>
> -	if (mmu_has_feature(MMU_FTR_TLBIEL) &&
> -	    mmu_psize_defs[psize].tlbiel && local) {
> +	if (use_local) {
>  		asm volatile("ptesync":::"memory");
>  		for (i = 0; i < number; i++) {
>  			vpn = batch->vpn[i];
> -- 
> 2.9.3

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

* Re: powerpc/mm: Add missing global TLBI if cxl is active
  2017-03-29 17:19 [PATCH] powerpc/mm: Add missing global TLBI if cxl is active Frederic Barrat
  2017-04-04  9:23 ` Aneesh Kumar K.V
@ 2017-04-06 13:23 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-04-06 13:23 UTC (permalink / raw)
  To: Frederic Barrat, aneesh.kumar, bsingharora, linuxppc-dev

On Wed, 2017-03-29 at 17:19:42 UTC, Frederic Barrat wrote:
> Commit 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl") converted local
> TLBIs to global if the cxl driver is active. It is necessary because
> the CAPP snoops invalidations to forward them to the PSL on the cxl
> adapter.
> However one path was apparently forgotten. native_flush_hash_range()
> still sends local TLBIs, as found out the hard way recently.
> 
> This patch fixes it by following the same logic as previously: if the
> cxl driver is active, the local TLBIs are 'upgraded' to global.
> 
> Fixes: 4c6d9acce1f4 ("powerpc/mm: Add hooks for cxl")
> Cc: stable@vger.kernel.org
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/88b1bf7268f56887ca88eb09c6fb0f

cheers

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

end of thread, other threads:[~2017-04-06 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29 17:19 [PATCH] powerpc/mm: Add missing global TLBI if cxl is active Frederic Barrat
2017-04-04  9:23 ` Aneesh Kumar K.V
2017-04-06 13:23 ` 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.