LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 01/11] powerpc/mm: fix erroneous duplicate slb_addr_limit init
From: Aneesh Kumar K.V @ 2019-04-26  6:32 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <3814377306ac3acdd404e2f23ff05dcf7e6bee26.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> Commit 67fda38f0d68 ("powerpc/mm: Move slb_addr_linit to
> early_init_mmu") moved slb_addr_limit init out of setup_arch().
>
> Commit 701101865f5d ("powerpc/mm: Reduce memory usage for mm_context_t
> for radix") brought it back into setup_arch() by error.
>
> This patch reverts that erroneous regress.
>

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

> Fixes: 701101865f5d ("powerpc/mm: Reduce memory usage for mm_context_t for radix")
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/kernel/setup-common.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 1729bf409562..7af085b38cd1 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -950,12 +950,6 @@ void __init setup_arch(char **cmdline_p)
>  	init_mm.end_data = (unsigned long) _edata;
>  	init_mm.brk = klimit;
>  
> -#ifdef CONFIG_PPC_MM_SLICES
> -#if defined(CONFIG_PPC_8xx)
> -	init_mm.context.slb_addr_limit = DEFAULT_MAP_WINDOW;
> -#endif
> -#endif
> -
>  #ifdef CONFIG_SPAPR_TCE_IOMMU
>  	mm_iommu_init(&init_mm);
>  #endif
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 02/11] powerpc/mm: no slice for nohash/64
From: Aneesh Kumar K.V @ 2019-04-26  6:33 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <97938d4257ac4b7b5690fdaf38c31c4e12f0a73c.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> Only nohash/32 and book3s/64 support mm slices.
>

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

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/include/asm/nohash/64/slice.h | 12 ------------
>  arch/powerpc/include/asm/slice.h           |  4 +---
>  arch/powerpc/platforms/Kconfig.cputype     |  4 ++++
>  3 files changed, 5 insertions(+), 15 deletions(-)
>  delete mode 100644 arch/powerpc/include/asm/nohash/64/slice.h
>
> diff --git a/arch/powerpc/include/asm/nohash/64/slice.h b/arch/powerpc/include/asm/nohash/64/slice.h
> deleted file mode 100644
> index ad0d6e3cc1c5..000000000000
> --- a/arch/powerpc/include/asm/nohash/64/slice.h
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef _ASM_POWERPC_NOHASH_64_SLICE_H
> -#define _ASM_POWERPC_NOHASH_64_SLICE_H
> -
> -#ifdef CONFIG_PPC_64K_PAGES
> -#define get_slice_psize(mm, addr)	MMU_PAGE_64K
> -#else /* CONFIG_PPC_64K_PAGES */
> -#define get_slice_psize(mm, addr)	MMU_PAGE_4K
> -#endif /* !CONFIG_PPC_64K_PAGES */
> -#define slice_set_user_psize(mm, psize)	do { BUG(); } while (0)
> -
> -#endif /* _ASM_POWERPC_NOHASH_64_SLICE_H */
> diff --git a/arch/powerpc/include/asm/slice.h b/arch/powerpc/include/asm/slice.h
> index 44816cbc4198..be8af667098f 100644
> --- a/arch/powerpc/include/asm/slice.h
> +++ b/arch/powerpc/include/asm/slice.h
> @@ -4,9 +4,7 @@
>  
>  #ifdef CONFIG_PPC_BOOK3S_64
>  #include <asm/book3s/64/slice.h>
> -#elif defined(CONFIG_PPC64)
> -#include <asm/nohash/64/slice.h>
> -#elif defined(CONFIG_PPC_MMU_NOHASH)
> +#elif defined(CONFIG_PPC_MMU_NOHASH_32)
>  #include <asm/nohash/32/slice.h>
>  #endif
>  
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index 00b2bb536c74..04915f51f447 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -391,6 +391,10 @@ config PPC_MMU_NOHASH
>  	def_bool y
>  	depends on !PPC_BOOK3S
>  
> +config PPC_MMU_NOHASH_32
> +	def_bool y
> +	depends on PPC_MMU_NOHASH && PPC32
> +
>  config PPC_BOOK3E_MMU
>  	def_bool y
>  	depends on FSL_BOOKE || PPC_BOOK3E
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 03/11] powerpc/mm: hand a context_t over to slice_mask_for_size() instead of mm_struct
From: Aneesh Kumar K.V @ 2019-04-26  6:34 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <633e11daecb440a8233890589a4025ed5003f222.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> slice_mask_for_size() only uses mm->context, so hand directly a
> pointer to the context. This will help moving the function in
> subarch mmu.h in the next patch by avoiding having to include
> the definition of struct mm_struct
>

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

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/mm/slice.c | 34 +++++++++++++++++-----------------
>  1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index 35b278082391..8eb7e8b09c75 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -151,32 +151,32 @@ static void slice_mask_for_free(struct mm_struct *mm, struct slice_mask *ret,
>  }
>  
>  #ifdef CONFIG_PPC_BOOK3S_64
> -static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
> +static struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
>  {
>  #ifdef CONFIG_PPC_64K_PAGES
>  	if (psize == MMU_PAGE_64K)
> -		return mm_ctx_slice_mask_64k(&mm->context);
> +		return mm_ctx_slice_mask_64k(&ctx);
>  #endif
>  	if (psize == MMU_PAGE_4K)
> -		return mm_ctx_slice_mask_4k(&mm->context);
> +		return mm_ctx_slice_mask_4k(&ctx);
>  #ifdef CONFIG_HUGETLB_PAGE
>  	if (psize == MMU_PAGE_16M)
> -		return mm_ctx_slice_mask_16m(&mm->context);
> +		return mm_ctx_slice_mask_16m(&ctx);
>  	if (psize == MMU_PAGE_16G)
> -		return mm_ctx_slice_mask_16g(&mm->context);
> +		return mm_ctx_slice_mask_16g(&ctx);
>  #endif
>  	BUG();
>  }
>  #elif defined(CONFIG_PPC_8xx)
> -static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
> +static struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
>  {
>  	if (psize == mmu_virtual_psize)
> -		return &mm->context.mask_base_psize;
> +		return &ctx->mask_base_psize;
>  #ifdef CONFIG_HUGETLB_PAGE
>  	if (psize == MMU_PAGE_512K)
> -		return &mm->context.mask_512k;
> +		return &ctx->mask_512k;
>  	if (psize == MMU_PAGE_8M)
> -		return &mm->context.mask_8m;
> +		return &ctx->mask_8m;
>  #endif
>  	BUG();
>  }
> @@ -246,7 +246,7 @@ static void slice_convert(struct mm_struct *mm,
>  	slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize);
>  	slice_print_mask(" mask", mask);
>  
> -	psize_mask = slice_mask_for_size(mm, psize);
> +	psize_mask = slice_mask_for_size(&mm->context, psize);
>  
>  	/* We need to use a spinlock here to protect against
>  	 * concurrent 64k -> 4k demotion ...
> @@ -263,7 +263,7 @@ static void slice_convert(struct mm_struct *mm,
>  
>  		/* Update the slice_mask */
>  		old_psize = (lpsizes[index] >> (mask_index * 4)) & 0xf;
> -		old_mask = slice_mask_for_size(mm, old_psize);
> +		old_mask = slice_mask_for_size(&mm->context, old_psize);
>  		old_mask->low_slices &= ~(1u << i);
>  		psize_mask->low_slices |= 1u << i;
>  
> @@ -282,7 +282,7 @@ static void slice_convert(struct mm_struct *mm,
>  
>  		/* Update the slice_mask */
>  		old_psize = (hpsizes[index] >> (mask_index * 4)) & 0xf;
> -		old_mask = slice_mask_for_size(mm, old_psize);
> +		old_mask = slice_mask_for_size(&mm->context, old_psize);
>  		__clear_bit(i, old_mask->high_slices);
>  		__set_bit(i, psize_mask->high_slices);
>  
> @@ -538,7 +538,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  	/* First make up a "good" mask of slices that have the right size
>  	 * already
>  	 */
> -	maskp = slice_mask_for_size(mm, psize);
> +	maskp = slice_mask_for_size(&mm->context, psize);
>  
>  	/*
>  	 * Here "good" means slices that are already the right page size,
> @@ -565,7 +565,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  	 * a pointer to good mask for the next code to use.
>  	 */
>  	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && psize == MMU_PAGE_64K) {
> -		compat_maskp = slice_mask_for_size(mm, MMU_PAGE_4K);
> +		compat_maskp = slice_mask_for_size(&mm->context, MMU_PAGE_4K);
>  		if (fixed)
>  			slice_or_mask(&good_mask, maskp, compat_maskp);
>  		else
> @@ -760,7 +760,7 @@ void slice_init_new_context_exec(struct mm_struct *mm)
>  	/*
>  	 * Slice mask cache starts zeroed, fill the default size cache.
>  	 */
> -	mask = slice_mask_for_size(mm, psize);
> +	mask = slice_mask_for_size(&mm->context, psize);
>  	mask->low_slices = ~0UL;
>  	if (SLICE_NUM_HIGH)
>  		bitmap_fill(mask->high_slices, SLICE_NUM_HIGH);
> @@ -819,14 +819,14 @@ int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
>  
>  	VM_BUG_ON(radix_enabled());
>  
> -	maskp = slice_mask_for_size(mm, psize);
> +	maskp = slice_mask_for_size(&mm->context, psize);
>  #ifdef CONFIG_PPC_64K_PAGES
>  	/* We need to account for 4k slices too */
>  	if (psize == MMU_PAGE_64K) {
>  		const struct slice_mask *compat_maskp;
>  		struct slice_mask available;
>  
> -		compat_maskp = slice_mask_for_size(mm, MMU_PAGE_4K);
> +		compat_maskp = slice_mask_for_size(&mm->context, MMU_PAGE_4K);
>  		slice_or_mask(&available, maskp, compat_maskp);
>  		return !slice_check_range_fits(mm, &available, addr, len);
>  	}
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 04/11] powerpc/mm: move slice_mask_for_size() into mmu.h
From: Aneesh Kumar K.V @ 2019-04-26  6:36 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <f406fa36f3bf7bd8ec5bcf8e3d00f40270050c6a.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> Move slice_mask_for_size() into subarch mmu.h
>
> At the same time, replace BUG() by VM_BUG_ON() as those BUG() are not
> there to catch runtime errors but to catch errors during development
> cycle only.
>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/include/asm/book3s/64/mmu.h     | 17 +++++++++++
>  arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 42 +++++++++++++++++++---------
>  arch/powerpc/mm/slice.c                      | 34 ----------------------
>  3 files changed, 46 insertions(+), 47 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
> index 230a9dec7677..ad00355f874f 100644
> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
> @@ -203,6 +203,23 @@ static inline struct slice_mask *mm_ctx_slice_mask_16g(mm_context_t *ctx)
>  }
>  #endif
>  
> +static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
> +{
> +#ifdef CONFIG_PPC_64K_PAGES
> +	if (psize == MMU_PAGE_64K)
> +		return mm_ctx_slice_mask_64k(&ctx);
> +#endif
> +#ifdef CONFIG_HUGETLB_PAGE
> +	if (psize == MMU_PAGE_16M)
> +		return mm_ctx_slice_mask_16m(&ctx);
> +	if (psize == MMU_PAGE_16G)
> +		return mm_ctx_slice_mask_16g(&ctx);
> +#endif
> +	VM_BUG_ON(psize != MMU_PAGE_4K);
> +
> +	return mm_ctx_slice_mask_4k(&ctx);
> +}
> +
>  #ifdef CONFIG_PPC_SUBPAGE_PROT
>  static inline struct subpage_prot_table *mm_ctx_subpage_prot(mm_context_t *ctx)
>  {
> diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
> index c503e2f05e61..a0f6844a1498 100644
> --- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
> @@ -184,7 +184,23 @@
>  #define LOW_SLICE_ARRAY_SZ	SLICE_ARRAY_SIZE
>  #endif
>  
> +#if defined(CONFIG_PPC_4K_PAGES)
> +#define mmu_virtual_psize	MMU_PAGE_4K
> +#elif defined(CONFIG_PPC_16K_PAGES)
> +#define mmu_virtual_psize	MMU_PAGE_16K
> +#define PTE_FRAG_NR		4
> +#define PTE_FRAG_SIZE_SHIFT	12
> +#define PTE_FRAG_SIZE		(1UL << 12)
> +#else
> +#error "Unsupported PAGE_SIZE"
> +#endif
> +
> +#define mmu_linear_psize	MMU_PAGE_8M
> +
>  #ifndef __ASSEMBLY__
> +
> +#include <linux/mmdebug.h>
> +
>  struct slice_mask {
>  	u64 low_slices;
>  	DECLARE_BITMAP(high_slices, 0);
> @@ -255,6 +271,19 @@ static inline struct slice_mask *mm_ctx_slice_mask_8m(mm_context_t *ctx)
>  	return &ctx->mask_8m;
>  }
>  #endif
> +
> +static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
> +{
> +#ifdef CONFIG_HUGETLB_PAGE
> +	if (psize == MMU_PAGE_512K)
> +		return &ctx->mask_512k;
> +	if (psize == MMU_PAGE_8M)
> +		return &ctx->mask_8m;
> +#endif
> +	VM_BUG_ON(psize != mmu_virtual_psize);
> +
> +	return &ctx->mask_base_psize;
> +}
>  #endif /* CONFIG_PPC_MM_SLICE */
>  
>  #define PHYS_IMMR_BASE (mfspr(SPRN_IMMR) & 0xfff80000)
> @@ -306,17 +335,4 @@ extern s32 patch__itlbmiss_perf, patch__dtlbmiss_perf;
>  
>  #endif /* !__ASSEMBLY__ */
>  
> -#if defined(CONFIG_PPC_4K_PAGES)
> -#define mmu_virtual_psize	MMU_PAGE_4K
> -#elif defined(CONFIG_PPC_16K_PAGES)
> -#define mmu_virtual_psize	MMU_PAGE_16K
> -#define PTE_FRAG_NR		4
> -#define PTE_FRAG_SIZE_SHIFT	12
> -#define PTE_FRAG_SIZE		(1UL << 12)
> -#else
> -#error "Unsupported PAGE_SIZE"
> -#endif
> -
> -#define mmu_linear_psize	MMU_PAGE_8M
> -
>  #endif /* _ASM_POWERPC_MMU_8XX_H_ */
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index 8eb7e8b09c75..31de91b65a64 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -150,40 +150,6 @@ static void slice_mask_for_free(struct mm_struct *mm, struct slice_mask *ret,
>  			__set_bit(i, ret->high_slices);
>  }
>  
> -#ifdef CONFIG_PPC_BOOK3S_64
> -static struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
> -{
> -#ifdef CONFIG_PPC_64K_PAGES
> -	if (psize == MMU_PAGE_64K)
> -		return mm_ctx_slice_mask_64k(&ctx);
> -#endif
> -	if (psize == MMU_PAGE_4K)
> -		return mm_ctx_slice_mask_4k(&ctx);
> -#ifdef CONFIG_HUGETLB_PAGE
> -	if (psize == MMU_PAGE_16M)
> -		return mm_ctx_slice_mask_16m(&ctx);
> -	if (psize == MMU_PAGE_16G)
> -		return mm_ctx_slice_mask_16g(&ctx);
> -#endif
> -	BUG();
> -}
> -#elif defined(CONFIG_PPC_8xx)
> -static struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
> -{
> -	if (psize == mmu_virtual_psize)
> -		return &ctx->mask_base_psize;
> -#ifdef CONFIG_HUGETLB_PAGE
> -	if (psize == MMU_PAGE_512K)
> -		return &ctx->mask_512k;
> -	if (psize == MMU_PAGE_8M)
> -		return &ctx->mask_8m;
> -#endif
> -	BUG();
> -}
> -#else
> -#error "Must define the slice masks for page sizes supported by the platform"
> -#endif
> -
>  static bool slice_check_range_fits(struct mm_struct *mm,
>  			   const struct slice_mask *available,
>  			   unsigned long start, unsigned long len)
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 07/11] powerpc/mm: remove a couple of #ifdef CONFIG_PPC_64K_PAGES in mm/slice.c
From: Aneesh Kumar K.V @ 2019-04-26  6:40 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <cf8573caf0896a7a1a7fee72280ca09f7096923b.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> This patch replaces a couple of #ifdef CONFIG_PPC_64K_PAGES
> by IS_ENABLED(CONFIG_PPC_64K_PAGES) to improve code maintainability.
>

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

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/mm/slice.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index 840c4118a185..ace97d953040 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -606,14 +606,13 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  	newaddr = slice_find_area(mm, len, &potential_mask,
>  				  psize, topdown, high_limit);
>  
> -#ifdef CONFIG_PPC_64K_PAGES
> -	if (newaddr == -ENOMEM && psize == MMU_PAGE_64K) {
> +	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && newaddr == -ENOMEM &&
> +	    psize == MMU_PAGE_64K) {
>  		/* retry the search with 4k-page slices included */
>  		slice_or_mask(&potential_mask, &potential_mask, compat_maskp);
>  		newaddr = slice_find_area(mm, len, &potential_mask,
>  					  psize, topdown, high_limit);
>  	}
> -#endif
>  
>  	if (newaddr == -ENOMEM)
>  		return -ENOMEM;
> @@ -784,9 +783,9 @@ int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
>  	VM_BUG_ON(radix_enabled());
>  
>  	maskp = slice_mask_for_size(&mm->context, psize);
> -#ifdef CONFIG_PPC_64K_PAGES
> +
>  	/* We need to account for 4k slices too */
> -	if (psize == MMU_PAGE_64K) {
> +	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && psize == MMU_PAGE_64K) {
>  		const struct slice_mask *compat_maskp;
>  		struct slice_mask available;
>  
> @@ -794,7 +793,6 @@ int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
>  		slice_or_mask(&available, maskp, compat_maskp);
>  		return !slice_check_range_fits(mm, &available, addr, len);
>  	}
> -#endif
>  
>  	return !slice_check_range_fits(mm, maskp, addr, len);
>  }
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 09/11] powerpc/mm: define get_slice_psize() all the time
From: Aneesh Kumar K.V @ 2019-04-26  6:42 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <306daa20cb5b7c361b28831a190e45b16245779d.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> get_slice_psize() can be defined regardless of CONFIG_PPC_MM_SLICES
> to avoid ifdefs
>

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

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/include/asm/slice.h | 5 +++++
>  arch/powerpc/mm/hugetlbpage.c    | 4 +---
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/slice.h b/arch/powerpc/include/asm/slice.h
> index be8af667098f..c6f466f4c241 100644
> --- a/arch/powerpc/include/asm/slice.h
> +++ b/arch/powerpc/include/asm/slice.h
> @@ -36,6 +36,11 @@ void slice_setup_new_exec(void);
>  
>  static inline void slice_init_new_context_exec(struct mm_struct *mm) {}
>  
> +static inline unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
> +{
> +	return 0;
> +}
> +
>  #endif /* CONFIG_PPC_MM_SLICES */
>  
>  #endif /* __ASSEMBLY__ */
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index 9e732bb2c84a..5f67e7a4d1cc 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -578,14 +578,12 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
>  
>  unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
>  {
> -#ifdef CONFIG_PPC_MM_SLICES
>  	/* With radix we don't use slice, so derive it from vma*/
> -	if (!radix_enabled()) {
> +	if (IS_ENABLED(CONFIG_PPC_MM_SLICES) && !radix_enabled()) {
>  		unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
>  
>  		return 1UL << mmu_psize_to_shift(psize);
>  	}
> -#endif
>  	return vma_kernel_pagesize(vma);
>  }
>  
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 10/11] powerpc/mm: define subarch SLB_ADDR_LIMIT_DEFAULT
From: Aneesh Kumar K.V @ 2019-04-26  6:43 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <c21aee3bc21b17c7a3491ef07e563ba235aeb101.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> This patch defines a subarch specific SLB_ADDR_LIMIT_DEFAULT
> to remove the #ifdefs around the setup of mm->context.slb_addr_limit
>
> It also generalises the use of mm_ctx_set_slb_addr_limit() helper.
>

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

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/include/asm/book3s/64/slice.h | 2 ++
>  arch/powerpc/include/asm/nohash/32/slice.h | 2 ++
>  arch/powerpc/mm/hash_utils_64.c            | 2 +-
>  arch/powerpc/mm/slice.c                    | 6 +-----
>  arch/powerpc/mm/tlb_nohash.c               | 4 +---
>  5 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/slice.h b/arch/powerpc/include/asm/book3s/64/slice.h
> index 062e11136e9c..f0d3194ba41b 100644
> --- a/arch/powerpc/include/asm/book3s/64/slice.h
> +++ b/arch/powerpc/include/asm/book3s/64/slice.h
> @@ -11,4 +11,6 @@
>  #define SLICE_NUM_HIGH		(H_PGTABLE_RANGE >> SLICE_HIGH_SHIFT)
>  #define GET_HIGH_SLICE_INDEX(addr)	((addr) >> SLICE_HIGH_SHIFT)
>  
> +#define SLB_ADDR_LIMIT_DEFAULT	DEFAULT_MAP_WINDOW_USER64
> +
>  #endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */
> diff --git a/arch/powerpc/include/asm/nohash/32/slice.h b/arch/powerpc/include/asm/nohash/32/slice.h
> index 777d62e40ac0..39eb0154ae2d 100644
> --- a/arch/powerpc/include/asm/nohash/32/slice.h
> +++ b/arch/powerpc/include/asm/nohash/32/slice.h
> @@ -13,6 +13,8 @@
>  #define SLICE_NUM_HIGH		0ul
>  #define GET_HIGH_SLICE_INDEX(addr)	(addr & 0)
>  
> +#define SLB_ADDR_LIMIT_DEFAULT	DEFAULT_MAP_WINDOW
> +
>  #endif /* CONFIG_PPC_MM_SLICES */
>  
>  #endif /* _ASM_POWERPC_NOHASH_32_SLICE_H */
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index f727197de713..884246e3bf0b 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -1050,7 +1050,7 @@ void __init hash__early_init_mmu(void)
>  	htab_initialize();
>  
>  	init_mm.context.hash_context = &init_hash_mm_context;
> -	init_mm.context.hash_context->slb_addr_limit = DEFAULT_MAP_WINDOW_USER64;
> +	mm_ctx_set_slb_addr_limit(&init_mm.context, SLB_ADDR_LIMIT_DEFAULT);
>  
>  	pr_info("Initializing hash mmu with SLB\n");
>  	/* Initialize SLB management */
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index ace97d953040..97fbf7b54422 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -704,11 +704,7 @@ void slice_init_new_context_exec(struct mm_struct *mm)
>  	 * case of fork it is just inherited from the mm being
>  	 * duplicated.
>  	 */
> -#ifdef CONFIG_PPC64
> -	mm_ctx_set_slb_addr_limit(&mm->context, DEFAULT_MAP_WINDOW_USER64);
> -#else
> -	mm->context.slb_addr_limit = DEFAULT_MAP_WINDOW;
> -#endif
> +	mm_ctx_set_slb_addr_limit(&mm->context, SLB_ADDR_LIMIT_DEFAULT);
>  	mm_ctx_set_user_psize(&mm->context, psize);
>  
>  	/*
> diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
> index 088e0a6b5ade..ba4bff11191f 100644
> --- a/arch/powerpc/mm/tlb_nohash.c
> +++ b/arch/powerpc/mm/tlb_nohash.c
> @@ -802,9 +802,7 @@ void __init early_init_mmu(void)
>  #endif
>  
>  #ifdef CONFIG_PPC_MM_SLICES
> -#if defined(CONFIG_PPC_8xx)
> -	init_mm.context.slb_addr_limit = DEFAULT_MAP_WINDOW;
> -#endif
> +	mm_ctx_set_slb_addr_limit(&init_mm.context, SLB_ADDR_LIMIT_DEFAULT);
>  #endif
>  }
>  #endif /* CONFIG_PPC64 */
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 11/11] powerpc/mm: drop slice DEBUG
From: Aneesh Kumar K.V @ 2019-04-26  6:44 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <f263887b4ca31f4bb0fe77823e301c28ba27c796.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> slice is now an improved functionnality. Drop the DEBUG stuff.
>

I would like to keep that. I helped a lot when moving address ranges and
it should not have any runtime impact.


> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/mm/slice.c | 62 ++++---------------------------------------------
>  1 file changed, 4 insertions(+), 58 deletions(-)
>
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index 97fbf7b54422..a9d803738b65 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -41,28 +41,6 @@
>  
>  static DEFINE_SPINLOCK(slice_convert_lock);
>  
> -#ifdef DEBUG
> -int _slice_debug = 1;
> -
> -static void slice_print_mask(const char *label, const struct slice_mask *mask)
> -{
> -	if (!_slice_debug)
> -		return;
> -	pr_devel("%s low_slice: %*pbl\n", label,
> -			(int)SLICE_NUM_LOW, &mask->low_slices);
> -	pr_devel("%s high_slice: %*pbl\n", label,
> -			(int)SLICE_NUM_HIGH, mask->high_slices);
> -}
> -
> -#define slice_dbg(fmt...) do { if (_slice_debug) pr_devel(fmt); } while (0)
> -
> -#else
> -
> -static void slice_print_mask(const char *label, const struct slice_mask *mask) {}
> -#define slice_dbg(fmt...)
> -
> -#endif
> -
>  static inline bool slice_addr_is_low(unsigned long addr)
>  {
>  	u64 tmp = (u64)addr;
> @@ -207,9 +185,6 @@ static void slice_convert(struct mm_struct *mm,
>  	unsigned long i, flags;
>  	int old_psize;
>  
> -	slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize);
> -	slice_print_mask(" mask", mask);
> -
>  	psize_mask = slice_mask_for_size(&mm->context, psize);
>  
>  	/* We need to use a spinlock here to protect against
> @@ -255,10 +230,6 @@ static void slice_convert(struct mm_struct *mm,
>  				(((unsigned long)psize) << (mask_index * 4));
>  	}
>  
> -	slice_dbg(" lsps=%lx, hsps=%lx\n",
> -		  (unsigned long)mm_ctx_low_slices(&mm->context),
> -		  (unsigned long)mm_ctx_high_slices(&mm->context));
> -
>  	spin_unlock_irqrestore(&slice_convert_lock, flags);
>  
>  	copro_flush_all_slbs(mm);
> @@ -485,14 +456,9 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  	BUG_ON(mm_ctx_slb_addr_limit(&mm->context) == 0);
>  	VM_BUG_ON(radix_enabled());
>  
> -	slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize);
> -	slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d\n",
> -		  addr, len, flags, topdown);
> -
>  	/* If hint, make sure it matches our alignment restrictions */
>  	if (!fixed && addr) {
>  		addr = _ALIGN_UP(addr, page_size);
> -		slice_dbg(" aligned addr=%lx\n", addr);
>  		/* Ignore hint if it's too large or overlaps a VMA */
>  		if (addr > high_limit - len || addr < mmap_min_addr ||
>  		    !slice_area_is_free(mm, addr, len))
> @@ -538,17 +504,12 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  		slice_copy_mask(&good_mask, maskp);
>  	}
>  
> -	slice_print_mask(" good_mask", &good_mask);
> -	if (compat_maskp)
> -		slice_print_mask(" compat_mask", compat_maskp);
> -
>  	/* First check hint if it's valid or if we have MAP_FIXED */
>  	if (addr != 0 || fixed) {
>  		/* Check if we fit in the good mask. If we do, we just return,
>  		 * nothing else to do
>  		 */
>  		if (slice_check_range_fits(mm, &good_mask, addr, len)) {
> -			slice_dbg(" fits good !\n");
>  			newaddr = addr;
>  			goto return_addr;
>  		}
> @@ -558,13 +519,10 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  		 */
>  		newaddr = slice_find_area(mm, len, &good_mask,
>  					  psize, topdown, high_limit);
> -		if (newaddr != -ENOMEM) {
> -			/* Found within the good mask, we don't have to setup,
> -			 * we thus return directly
> -			 */
> -			slice_dbg(" found area at 0x%lx\n", newaddr);
> +
> +		/* Found within good mask, don't have to setup, thus return directly */
> +		if (newaddr != -ENOMEM)
>  			goto return_addr;
> -		}
>  	}
>  	/*
>  	 * We don't fit in the good mask, check what other slices are
> @@ -572,11 +530,9 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  	 */
>  	slice_mask_for_free(mm, &potential_mask, high_limit);
>  	slice_or_mask(&potential_mask, &potential_mask, &good_mask);
> -	slice_print_mask(" potential", &potential_mask);
>  
>  	if (addr != 0 || fixed) {
>  		if (slice_check_range_fits(mm, &potential_mask, addr, len)) {
> -			slice_dbg(" fits potential !\n");
>  			newaddr = addr;
>  			goto convert;
>  		}
> @@ -586,18 +542,14 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  	if (fixed)
>  		return -EBUSY;
>  
> -	slice_dbg(" search...\n");
> -
>  	/* If we had a hint that didn't work out, see if we can fit
>  	 * anywhere in the good area.
>  	 */
>  	if (addr) {
>  		newaddr = slice_find_area(mm, len, &good_mask,
>  					  psize, topdown, high_limit);
> -		if (newaddr != -ENOMEM) {
> -			slice_dbg(" found area at 0x%lx\n", newaddr);
> +		if (newaddr != -ENOMEM)
>  			goto return_addr;
> -		}
>  	}
>  
>  	/* Now let's see if we can find something in the existing slices
> @@ -618,8 +570,6 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>  		return -ENOMEM;
>  
>  	slice_range_to_mask(newaddr, len, &potential_mask);
> -	slice_dbg(" found potential area at 0x%lx\n", newaddr);
> -	slice_print_mask(" mask", &potential_mask);
>  
>   convert:
>  	/*
> @@ -697,8 +647,6 @@ void slice_init_new_context_exec(struct mm_struct *mm)
>  	struct slice_mask *mask;
>  	unsigned int psize = mmu_virtual_psize;
>  
> -	slice_dbg("slice_init_new_context_exec(mm=%p)\n", mm);
> -
>  	/*
>  	 * In the case of exec, use the default limit. In the
>  	 * case of fork it is just inherited from the mm being
> @@ -730,8 +678,6 @@ void slice_setup_new_exec(void)
>  {
>  	struct mm_struct *mm = current->mm;
>  
> -	slice_dbg("slice_setup_new_exec(mm=%p)\n", mm);
> -
>  	if (!is_32bit_task())
>  		return;
>  
> -- 
> 2.13.3


^ permalink raw reply

* Re: [PATCH v2 11/11] powerpc/mm: drop slice DEBUG
From: Christophe Leroy @ 2019-04-26  6:49 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <87lfzx9sfc.fsf@linux.ibm.com>



Le 26/04/2019 à 08:44, Aneesh Kumar K.V a écrit :
> Christophe Leroy <christophe.leroy@c-s.fr> writes:
> 
>> slice is now an improved functionnality. Drop the DEBUG stuff.
>>
> 
> I would like to keep that. I helped a lot when moving address ranges and
> it should not have any runtime impact.

Ok for me.

Christophe

> 
> 
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> ---
>>   arch/powerpc/mm/slice.c | 62 ++++---------------------------------------------
>>   1 file changed, 4 insertions(+), 58 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
>> index 97fbf7b54422..a9d803738b65 100644
>> --- a/arch/powerpc/mm/slice.c
>> +++ b/arch/powerpc/mm/slice.c
>> @@ -41,28 +41,6 @@
>>   
>>   static DEFINE_SPINLOCK(slice_convert_lock);
>>   
>> -#ifdef DEBUG
>> -int _slice_debug = 1;
>> -
>> -static void slice_print_mask(const char *label, const struct slice_mask *mask)
>> -{
>> -	if (!_slice_debug)
>> -		return;
>> -	pr_devel("%s low_slice: %*pbl\n", label,
>> -			(int)SLICE_NUM_LOW, &mask->low_slices);
>> -	pr_devel("%s high_slice: %*pbl\n", label,
>> -			(int)SLICE_NUM_HIGH, mask->high_slices);
>> -}
>> -
>> -#define slice_dbg(fmt...) do { if (_slice_debug) pr_devel(fmt); } while (0)
>> -
>> -#else
>> -
>> -static void slice_print_mask(const char *label, const struct slice_mask *mask) {}
>> -#define slice_dbg(fmt...)
>> -
>> -#endif
>> -
>>   static inline bool slice_addr_is_low(unsigned long addr)
>>   {
>>   	u64 tmp = (u64)addr;
>> @@ -207,9 +185,6 @@ static void slice_convert(struct mm_struct *mm,
>>   	unsigned long i, flags;
>>   	int old_psize;
>>   
>> -	slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize);
>> -	slice_print_mask(" mask", mask);
>> -
>>   	psize_mask = slice_mask_for_size(&mm->context, psize);
>>   
>>   	/* We need to use a spinlock here to protect against
>> @@ -255,10 +230,6 @@ static void slice_convert(struct mm_struct *mm,
>>   				(((unsigned long)psize) << (mask_index * 4));
>>   	}
>>   
>> -	slice_dbg(" lsps=%lx, hsps=%lx\n",
>> -		  (unsigned long)mm_ctx_low_slices(&mm->context),
>> -		  (unsigned long)mm_ctx_high_slices(&mm->context));
>> -
>>   	spin_unlock_irqrestore(&slice_convert_lock, flags);
>>   
>>   	copro_flush_all_slbs(mm);
>> @@ -485,14 +456,9 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>>   	BUG_ON(mm_ctx_slb_addr_limit(&mm->context) == 0);
>>   	VM_BUG_ON(radix_enabled());
>>   
>> -	slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize);
>> -	slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d\n",
>> -		  addr, len, flags, topdown);
>> -
>>   	/* If hint, make sure it matches our alignment restrictions */
>>   	if (!fixed && addr) {
>>   		addr = _ALIGN_UP(addr, page_size);
>> -		slice_dbg(" aligned addr=%lx\n", addr);
>>   		/* Ignore hint if it's too large or overlaps a VMA */
>>   		if (addr > high_limit - len || addr < mmap_min_addr ||
>>   		    !slice_area_is_free(mm, addr, len))
>> @@ -538,17 +504,12 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>>   		slice_copy_mask(&good_mask, maskp);
>>   	}
>>   
>> -	slice_print_mask(" good_mask", &good_mask);
>> -	if (compat_maskp)
>> -		slice_print_mask(" compat_mask", compat_maskp);
>> -
>>   	/* First check hint if it's valid or if we have MAP_FIXED */
>>   	if (addr != 0 || fixed) {
>>   		/* Check if we fit in the good mask. If we do, we just return,
>>   		 * nothing else to do
>>   		 */
>>   		if (slice_check_range_fits(mm, &good_mask, addr, len)) {
>> -			slice_dbg(" fits good !\n");
>>   			newaddr = addr;
>>   			goto return_addr;
>>   		}
>> @@ -558,13 +519,10 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>>   		 */
>>   		newaddr = slice_find_area(mm, len, &good_mask,
>>   					  psize, topdown, high_limit);
>> -		if (newaddr != -ENOMEM) {
>> -			/* Found within the good mask, we don't have to setup,
>> -			 * we thus return directly
>> -			 */
>> -			slice_dbg(" found area at 0x%lx\n", newaddr);
>> +
>> +		/* Found within good mask, don't have to setup, thus return directly */
>> +		if (newaddr != -ENOMEM)
>>   			goto return_addr;
>> -		}
>>   	}
>>   	/*
>>   	 * We don't fit in the good mask, check what other slices are
>> @@ -572,11 +530,9 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>>   	 */
>>   	slice_mask_for_free(mm, &potential_mask, high_limit);
>>   	slice_or_mask(&potential_mask, &potential_mask, &good_mask);
>> -	slice_print_mask(" potential", &potential_mask);
>>   
>>   	if (addr != 0 || fixed) {
>>   		if (slice_check_range_fits(mm, &potential_mask, addr, len)) {
>> -			slice_dbg(" fits potential !\n");
>>   			newaddr = addr;
>>   			goto convert;
>>   		}
>> @@ -586,18 +542,14 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>>   	if (fixed)
>>   		return -EBUSY;
>>   
>> -	slice_dbg(" search...\n");
>> -
>>   	/* If we had a hint that didn't work out, see if we can fit
>>   	 * anywhere in the good area.
>>   	 */
>>   	if (addr) {
>>   		newaddr = slice_find_area(mm, len, &good_mask,
>>   					  psize, topdown, high_limit);
>> -		if (newaddr != -ENOMEM) {
>> -			slice_dbg(" found area at 0x%lx\n", newaddr);
>> +		if (newaddr != -ENOMEM)
>>   			goto return_addr;
>> -		}
>>   	}
>>   
>>   	/* Now let's see if we can find something in the existing slices
>> @@ -618,8 +570,6 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
>>   		return -ENOMEM;
>>   
>>   	slice_range_to_mask(newaddr, len, &potential_mask);
>> -	slice_dbg(" found potential area at 0x%lx\n", newaddr);
>> -	slice_print_mask(" mask", &potential_mask);
>>   
>>    convert:
>>   	/*
>> @@ -697,8 +647,6 @@ void slice_init_new_context_exec(struct mm_struct *mm)
>>   	struct slice_mask *mask;
>>   	unsigned int psize = mmu_virtual_psize;
>>   
>> -	slice_dbg("slice_init_new_context_exec(mm=%p)\n", mm);
>> -
>>   	/*
>>   	 * In the case of exec, use the default limit. In the
>>   	 * case of fork it is just inherited from the mm being
>> @@ -730,8 +678,6 @@ void slice_setup_new_exec(void)
>>   {
>>   	struct mm_struct *mm = current->mm;
>>   
>> -	slice_dbg("slice_setup_new_exec(mm=%p)\n", mm);
>> -
>>   	if (!is_32bit_task())
>>   		return;
>>   
>> -- 
>> 2.13.3

^ permalink raw reply

* Re: [PATCH v2 05/11] powerpc/mm: get rid of mm_ctx_slice_mask_xxx()
From: Aneesh Kumar K.V @ 2019-04-26  6:37 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <cc95821273df454eb146871bf6e5eeabef7c4ac9.1556202029.git.christophe.leroy@c-s.fr>

Christophe Leroy <christophe.leroy@c-s.fr> writes:

> Now that slice_mask_for_size() is in mmu.h, the mm_ctx_slice_mask_xxx()
> are not needed anymore, so drop them. Note that the 8xx ones where
> not used anyway.
>

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

> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/include/asm/book3s/64/mmu.h     | 32 ++++------------------------
>  arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 17 ---------------
>  2 files changed, 4 insertions(+), 45 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
> index ad00355f874f..e3d7f1404e20 100644
> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
> @@ -179,45 +179,21 @@ static inline void mm_ctx_set_slb_addr_limit(mm_context_t *ctx, unsigned long li
>  	ctx->hash_context->slb_addr_limit = limit;
>  }
>  
> -#ifdef CONFIG_PPC_64K_PAGES
> -static inline struct slice_mask *mm_ctx_slice_mask_64k(mm_context_t *ctx)
> -{
> -	return &ctx->hash_context->mask_64k;
> -}
> -#endif
> -
> -static inline struct slice_mask *mm_ctx_slice_mask_4k(mm_context_t *ctx)
> -{
> -	return &ctx->hash_context->mask_4k;
> -}
> -
> -#ifdef CONFIG_HUGETLB_PAGE
> -static inline struct slice_mask *mm_ctx_slice_mask_16m(mm_context_t *ctx)
> -{
> -	return &ctx->hash_context->mask_16m;
> -}
> -
> -static inline struct slice_mask *mm_ctx_slice_mask_16g(mm_context_t *ctx)
> -{
> -	return &ctx->hash_context->mask_16g;
> -}
> -#endif
> -
>  static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
>  {
>  #ifdef CONFIG_PPC_64K_PAGES
>  	if (psize == MMU_PAGE_64K)
> -		return mm_ctx_slice_mask_64k(&ctx);
> +		return &ctx->hash_context->mask_64k;
>  #endif
>  #ifdef CONFIG_HUGETLB_PAGE
>  	if (psize == MMU_PAGE_16M)
> -		return mm_ctx_slice_mask_16m(&ctx);
> +		return &ctx->hash_context->mask_16m;
>  	if (psize == MMU_PAGE_16G)
> -		return mm_ctx_slice_mask_16g(&ctx);
> +		return &ctx->hash_context->mask_16g;
>  #endif
>  	VM_BUG_ON(psize != MMU_PAGE_4K);
>  
> -	return mm_ctx_slice_mask_4k(&ctx);
> +	return &ctx->hash_context->mask_4k;
>  }
>  
>  #ifdef CONFIG_PPC_SUBPAGE_PROT
> diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
> index a0f6844a1498..beded4df1f50 100644
> --- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
> +++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
> @@ -255,23 +255,6 @@ static inline void mm_ctx_set_slb_addr_limit(mm_context_t *ctx, unsigned long li
>  	ctx->slb_addr_limit = limit;
>  }
>  
> -static inline struct slice_mask *mm_ctx_slice_mask_base(mm_context_t *ctx)
> -{
> -	return &ctx->mask_base_psize;
> -}
> -
> -#ifdef CONFIG_HUGETLB_PAGE
> -static inline struct slice_mask *mm_ctx_slice_mask_512k(mm_context_t *ctx)
> -{
> -	return &ctx->mask_512k;
> -}
> -
> -static inline struct slice_mask *mm_ctx_slice_mask_8m(mm_context_t *ctx)
> -{
> -	return &ctx->mask_8m;
> -}
> -#endif
> -
>  static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
>  {
>  #ifdef CONFIG_HUGETLB_PAGE
> -- 
> 2.13.3


^ permalink raw reply

* Re: BUG: crash in __tlb_remove_page_size with STRICT_KERNEL_RWX on BOOK3S_32
From: Christophe Leroy @ 2019-04-26  7:27 UTC (permalink / raw)
  To: Serge Belyshev; +Cc: linuxppc-dev
In-Reply-To: <87pnp9mknl.fsf@depni.sinp.msu.ru>



Le 26/04/2019 à 06:54, Serge Belyshev a écrit :
> Hi! Commit 63b2bc61956 aka "powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX"
> caused my old powerbook to crash under I/O.  After "dd if=/dev/hda of=/null"
> the crash happens in seconds.  Reverting the commit helps, as well as
> disabling STRICT_KERNEL_RWX.  Unfortunately, I was unable to capture the oops
> via the usb serial console, as it stuck right after the first "BUG: Unable to
> handle kernel data access at 0xe0c29000" message. Oops screenshot:
> http://aargh.no-ip.org/oops.jpg
> 

Hi Serge,

Could you please compile your kernel with CONFIG_PPC_PTDUMP, and provide 
the content of:

/sys/kernel/debug/kernel_page_tables
/sys/kernel/debug/powerpc/block_address_translation
/sys/kernel/debug/powerpc/segment_registers

Please also provide the begining of 'dmesg' that shows the memory layout.

Thanks
Christophe

^ permalink raw reply

* Re: [PATCH kernel RFC 0/2] powerpc/ioda2: An attempt to allow DMA masks between 32 and 59
From: Alexey Kardashevskiy @ 2019-04-26  7:39 UTC (permalink / raw)
  To: Russell Currey, linuxppc-dev
  Cc: Alistair Popple, Oliver O'Halloran, David Gibson
In-Reply-To: <93b691b5c538d013717f9a9326bbf77e97b58a28.camel@russell.cc>



On 23/04/2019 10:58, Russell Currey wrote:
> On Fri, 2019-04-12 at 16:44 +1000, Alexey Kardashevskiy wrote:
>> This is an attempt to allow DMA mask 40 or similar which are not
>> large
>> enough to use either a PHB3 bypass mode or a sketchy bypass.
>>
>> This is based on sha1
>> 582549e3fbe1 Linus Torvalds Merge tag 'for-linus' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma 
>>
>> Please comment. Thanks.
> 
> Seems to uniformly fail on POWER8 and sometimes on P9 too.
> 
> On P8:
> 
> [    2.423206] Failed to allocate a TCE memory, level shift=26
> [    2.423351] pci 0001:03     : [PE# fd] Failed to create 32-bit TCE
> table, err -12
> 
> On P9:
> 
> [    0.303055] pci 0003:01     : [PE# 1fd] Setting up 32-bit TCE table
> at 0..80000000
> [    0.303119] Failed to allocate a TCE memory, level shift=30
> [    0.303147] pci 0003:01     : [PE# 1fd] Failed to create 32-bit TCE
> table, err -12
> 
> Is it selecting the wrong TCE size?

Nah, it is too big level size, i.e. it is bigger than max allowed order.

Try:

#define POWERNV_IOMMU_DEFAULT_LEVELS 3



>> Alexey Kardashevskiy (2):
>   powerpc/powernv/ioda: Allocate TCE table
>> levels on demand for default
>     DMA window
>   powerpc/powernv/ioda2:
>> Create bigger default window with 64k IOMMU
>     pages
> 
>  arch/powerpc/include/asm/iommu.h              |  8 ++-
>  arch/powerpc/platforms/powernv/pci.h          |  2 +-
>  arch/powerpc/kernel/iommu.c                   | 58 +++++++++++++--
> ----
>  arch/powerpc/platforms/powernv/pci-ioda-tce.c | 19 +++---
>  arch/powerpc/platforms/powernv/pci-ioda.c     | 14 ++++-
>  5 files changed, 66 insertions(+), 35 deletions(-)
> 
> 

-- 
Alexey

^ permalink raw reply

* Re: [PATCH] vfio-pci/nvlink2: Fix potential VMA leak
From: Alexey Kardashevskiy @ 2019-04-26  7:50 UTC (permalink / raw)
  To: Greg Kurz, linux-kernel; +Cc: Alex Williamson, linuxppc-dev
In-Reply-To: <155568823785.601037.2151744205292679252.stgit@bahia.lan>



On 20/04/2019 01:37, Greg Kurz wrote:
> If vfio_pci_register_dev_region() fails then we should rollback
> previous changes, ie. unmap the ATSD registers.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  drivers/vfio/pci/vfio_pci_nvlink2.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> index 32f695ffe128..50fe3c4f7feb 100644
> --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> @@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
>  	return 0;
>  
>  free_exit:
> +	if (data->base)
> +		memunmap(data->base);
>  	kfree(data);
>  
>  	return ret;
> 

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>


-- 
Alexey

^ permalink raw reply

* Re: [PATCH v2] mm: Fix modifying of page protection by insert_pfn_pmd()
From: Jan Kara @ 2019-04-26  8:36 UTC (permalink / raw)
  To: Dan Williams
  Cc: Jan Kara, linux-nvdimm, Aneesh Kumar K.V, Matthew Wilcox,
	Linux MM, Chandan Rajendra, stable, Andrew Morton, linuxppc-dev
In-Reply-To: <CAPcyv4iYMP4NWxa08zTdRxtc4UcbFFOCwbMZijB0bc2WcawggQ@mail.gmail.com>

On Thu 25-04-19 17:33:04, Dan Williams wrote:
> On Thu, Apr 25, 2019 at 12:32 AM Jan Kara <jack@suse.cz> wrote:
> >
> > On Wed 24-04-19 11:13:48, Dan Williams wrote:
> > > On Wed, Apr 24, 2019 at 10:38 AM Matthew Wilcox <willy@infradead.org> wrote:
> > > >
> > > > On Wed, Apr 24, 2019 at 10:13:15AM -0700, Dan Williams wrote:
> > > > > I think unaligned addresses have always been passed to
> > > > > vmf_insert_pfn_pmd(), but nothing cared until this patch. I *think*
> > > > > the only change needed is the following, thoughts?
> > > > >
> > > > > diff --git a/fs/dax.c b/fs/dax.c
> > > > > index ca0671d55aa6..82aee9a87efa 100644
> > > > > --- a/fs/dax.c
> > > > > +++ b/fs/dax.c
> > > > > @@ -1560,7 +1560,7 @@ static vm_fault_t dax_iomap_pmd_fault(struct
> > > > > vm_fault *vmf, pfn_t *pfnp,
> > > > >                 }
> > > > >
> > > > >                 trace_dax_pmd_insert_mapping(inode, vmf, PMD_SIZE, pfn, entry);
> > > > > -               result = vmf_insert_pfn_pmd(vma, vmf->address, vmf->pmd, pfn,
> > > > > +               result = vmf_insert_pfn_pmd(vma, pmd_addr, vmf->pmd, pfn,
> > > > >                                             write);
> > > >
> > > > We also call vmf_insert_pfn_pmd() in dax_insert_pfn_mkwrite() -- does
> > > > that need to change too?
> > >
> > > It wasn't clear to me that it was a problem. I think that one already
> > > happens to be pmd-aligned.
> >
> > Why would it need to be? The address is taken from vmf->address and that's
> > set up in __handle_mm_fault() like .address = address & PAGE_MASK. So I
> > don't see anything forcing PMD alignment of the virtual address...
> 
> True. So now I'm wondering if the masking should be done internal to
> the routine. Given it's prefixed vmf_ it seems to imply the api is
> prepared to take raw 'struct vm_fault' parameters. I think I'll go
> that route unless someone sees a reason to require the caller to
> handle this responsibility.

Yeah, that sounds good to me. Thanks for fixing this.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply

* Re: [PATCH v1 2/7] s390x/mm: Implement arch_remove_memory()
From: David Hildenbrand @ 2019-04-26  9:11 UTC (permalink / raw)
  To: linux-mm
  Cc: Oscar Salvador, linux-s390, Michal Hocko, linux-ia64,
	Vasily Gorbik, linux-sh, Heiko Carstens, linux-kernel,
	Mike Rapoport, Martin Schwidefsky, akpm, linuxppc-dev,
	Dan Williams
In-Reply-To: <20190424102511.29318-3-david@redhat.com>

On 24.04.19 12:25, David Hildenbrand wrote:
> Will come in handy when wanting to handle errors after
> arch_add_memory().
> 
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Oscar Salvador <osalvador@suse.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/mm/init.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
> index 31b1071315d7..2636d62df04e 100644
> --- a/arch/s390/mm/init.c
> +++ b/arch/s390/mm/init.c
> @@ -237,12 +237,13 @@ int arch_add_memory(int nid, u64 start, u64 size,
>  void arch_remove_memory(int nid, u64 start, u64 size,
>  			struct vmem_altmap *altmap)
>  {
> -	/*
> -	 * There is no hardware or firmware interface which could trigger a
> -	 * hot memory remove on s390. So there is nothing that needs to be
> -	 * implemented.
> -	 */
> -	BUG();
> +	unsigned long start_pfn = start >> PAGE_SHIFT;
> +	unsigned long nr_pages = size >> PAGE_SHIFT;
> +	struct zone *zone;
> +
> +	vmem_remove_mapping(start, size);
> +	zone = page_zone(pfn_to_page(start_pfn));
> +	__remove_pages(zone, start_pfn, nr_pages, altmap);

I guess the correct way is to remove the mapping after __remove_pages.
But as the pages should not be touched by anybody, it shouldn't really
matter. Will change when I resend.

>  }
>  #endif
>  #endif /* CONFIG_MEMORY_HOTPLUG */
> 


-- 

Thanks,

David / dhildenb

^ permalink raw reply

* Re: [PATCH V3] ASoC: fsl_esai: Add pm runtime function
From: Mark Brown @ 2019-04-26  9:57 UTC (permalink / raw)
  To: S.j. Wang
  Cc: alsa-devel@alsa-project.org, timur@kernel.org,
	Xiubo.Lee@gmail.com, festevam@gmail.com,
	linux-kernel@vger.kernel.org, nicoleotsuka@gmail.com,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <0320f04ac785a6046a6f9baec591d36a4a6189ec.1555899304.git.shengjiu.wang@nxp.com>

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

On Mon, Apr 22, 2019 at 02:31:55AM +0000, S.j. Wang wrote:
> Add pm runtime support and move clock handling there.
> Close the clocks at suspend to reduce the power consumption.
> 
> fsl_esai_suspend is replaced by pm_runtime_force_suspend.
> fsl_esai_resume is replaced by pm_runtime_force_resume.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: [PATCH 2/3 v2] ASoC: fsl_sai: Add support for runtime pm
From: Mark Brown @ 2019-04-26 10:00 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: alsa-devel@alsa-project.org, timur@kernel.org,
	Xiubo.Lee@gmail.com, linuxppc-dev@lists.ozlabs.org, S.j. Wang,
	tiwai@suse.com, lgirdwood@gmail.com, perex@perex.cz,
	nicoleotsuka@gmail.com, dl-linux-imx, festevam@gmail.com,
	linux-kernel@vger.kernel.org
In-Reply-To: <20190421193853.10188-3-daniel.baluta@nxp.com>

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

On Sun, Apr 21, 2019 at 07:39:09PM +0000, Daniel Baluta wrote:
> Basically the same actions as for system PM, so make use
> of pm_runtime_force_suspend/pm_runtime_force_resume.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Applied "ASoC: fsl_sai: Add missing return 0 in remove()" to the asoc tree
From: Mark Brown @ 2019-04-26 10:03 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: Stephen Rothwell, alsa-devel, timur, Xiubo.Lee, daniel.baluta,
	linuxppc-dev, lgirdwood, linux-kernel, Mark Brown, tiwai, perex,
	festevam
In-Reply-To: <1556248850-3748-1-git-send-email-nicoleotsuka@gmail.com>

The patch

   ASoC: fsl_sai: Add missing return 0 in remove()

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From b46ea8f4d23807e41be86bf214618e4fd4682b9b Mon Sep 17 00:00:00 2001
From: Nicolin Chen <nicoleotsuka@gmail.com>
Date: Thu, 25 Apr 2019 20:20:50 -0700
Subject: [PATCH] ASoC: fsl_sai: Add missing return 0 in remove()

Build warning being reported:
    sound/soc/fsl/fsl_sai.c: In function 'fsl_sai_remove':
    sound/soc/fsl/fsl_sai.c:921:1: warning: no return statement in
    function returning non-void [-Wreturn-type]

So this patch just adds a "return 0" to fix it.

Fixes: 812ad463e089 ("ASoC: fsl_sai: Add support for runtime pm")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/fsl/fsl_sai.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 26c27dc0781f..8593269156bd 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -918,6 +918,8 @@ static int fsl_sai_probe(struct platform_device *pdev)
 static int fsl_sai_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
+
+	return 0;
 }
 
 static const struct of_device_id fsl_sai_ids[] = {
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH V3] ASoC: fsl_esai: Add pm runtime function
From: S.j. Wang @ 2019-04-26 10:51 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel@alsa-project.org, timur@kernel.org,
	Xiubo.Lee@gmail.com, festevam@gmail.com,
	linux-kernel@vger.kernel.org, nicoleotsuka@gmail.com,
	linuxppc-dev@lists.ozlabs.org

Hi Mark

> 
> On Mon, Apr 22, 2019 at 02:31:55AM +0000, S.j. Wang wrote:
> > Add pm runtime support and move clock handling there.
> > Close the clocks at suspend to reduce the power consumption.
> >
> > fsl_esai_suspend is replaced by pm_runtime_force_suspend.
> > fsl_esai_resume is replaced by pm_runtime_force_resume.
> 
> This doesn't apply against current code, please check and resend.

Which branch are you using?  I tried for-next and for-linus, both
Are successful applied.

Best regards
Wang shengjiu

^ permalink raw reply

* Re: powerpc hugepage leak caused by 576ed913 "block: use bio_add_page in bio_iov_iter_get_pages"
From: Ming Lei @ 2019-04-26 10:51 UTC (permalink / raw)
  To: David Gibson
  Cc: Jens Axboe, Linux Kernel Mailing List, Nick Piggin,
	Michael Ellerman, Paul Mackerras, linuxppc-dev, Christoph Hellwig
In-Reply-To: <20190426035643.GB7378@umbus.fritz.box>

On Fri, Apr 26, 2019 at 12:41 PM David Gibson
<david@gibson.dropbear.id.au> wrote:
>
> On Fri, Apr 26, 2019 at 11:05:17AM +1000, David Gibson wrote:
> > On Thu, Apr 25, 2019 at 08:19:58AM +0200, Christoph Hellwig wrote:
> > > Just curious:  What exact trees do you see this with?  This area
> > > changed a lot with the multipage bvec support, and subsequent fixes.
> >
> > So, I tried it with 576ed913 itself and with 576ed913^ to verify that
> > it didn't happen there.  The problem also occurred with Linus' tree as
> > of when I started bisecting, which appears to have been 444fe991.
> > Actually, come to that, here's the whole bisect log in case it's
> > helpful:
> >
> > # git bisect log
> > git bisect start
> > # good: [bebc6082da0a9f5d47a1ea2edc099bf671058bd4] Linux 4.14
> > git bisect good bebc6082da0a9f5d47a1ea2edc099bf671058bd4
> > # bad: [444fe991353987c1c9bc5ab1f903d01f1b4ad415] Merge tag 'riscv-for-linus-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux
> > git bisect bad 444fe991353987c1c9bc5ab1f903d01f1b4ad415
> > # good: [399c4129eba6145924ab90363352b7bdcd554751] Merge tag 'pxa-for-4.19-dma_slave_map' of https://github.com/rjarzmik/linux
> > git bisect good 399c4129eba6145924ab90363352b7bdcd554751
> > # bad: [73b6f96cbc0162787bcbdac5f538167084c8d605] Merge branch 'drm-fixes-4.20' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
> > git bisect bad 73b6f96cbc0162787bcbdac5f538167084c8d605
> > # good: [85a585918fb4122ad26b6febaec5c3c90bf2535c] Merge tag 'loadpin-security-next' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into next-loadpin
> > git bisect good 85a585918fb4122ad26b6febaec5c3c90bf2535c
> > # bad: [3acbd2de6bc3af215c6ed7732dfc097d1e238503] Merge tag 'sound-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
> > git bisect bad 3acbd2de6bc3af215c6ed7732dfc097d1e238503
> > # good: [8f18da47211554f1ef674fef627c05f23b75a8e0] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next
> > git bisect good 8f18da47211554f1ef674fef627c05f23b75a8e0
> > # bad: [0d1b82cd8ac2e8856ae9045c97782ac1c359929c] Merge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> > git bisect bad 0d1b82cd8ac2e8856ae9045c97782ac1c359929c
> > # bad: [1650ac53066577a5e83fe3e9d992c9311597ff8c] Merge tag 'mmc-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
> > git bisect bad 1650ac53066577a5e83fe3e9d992c9311597ff8c
> > # bad: [6ab9e09238fdfd742fe23b81e2d385a1cab49d9b] Merge tag 'for-4.20/block-20181021' of git://git.kernel.dk/linux-block
> > git bisect bad 6ab9e09238fdfd742fe23b81e2d385a1cab49d9b
> > # good: [528985117126f11beea339cf39120ee99da04cd2] Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
> > git bisect good 528985117126f11beea339cf39120ee99da04cd2
> > # bad: [2cf99bbd106f89fc72f778e8ad9d5538f1ef939b] lightnvm: pblk: add helpers for chunk addresses
> > git bisect bad 2cf99bbd106f89fc72f778e8ad9d5538f1ef939b
> > # bad: [33b14f67a4e1eabd219fd6543da8f15ed86b641c] nvme: register ns_id attributes as default sysfs groups
> > git bisect bad 33b14f67a4e1eabd219fd6543da8f15ed86b641c
> > # bad: [27ca1d4ed04ea29dc77b47190a3cc82697023e76] block: move req_gap_back_merge to blk.h
> > git bisect bad 27ca1d4ed04ea29dc77b47190a3cc82697023e76
> > # bad: [07b05bcc3213ac9f8c28c9d835b4bf3d5798cc60] blkcg: convert blkg_lookup_create to find closest blkg
> > git bisect bad 07b05bcc3213ac9f8c28c9d835b4bf3d5798cc60
> > # good: [cbeb869a3d1110450186b738199963c5e68c2a71] block, bfq: correctly charge and reset entity service in all cases
> > git bisect good cbeb869a3d1110450186b738199963c5e68c2a71
> > # bad: [576ed9135489c723fb39b97c4e2c73428d06dd78] block: use bio_add_page in bio_iov_iter_get_pages
> > git bisect bad 576ed9135489c723fb39b97c4e2c73428d06dd78
> > # good: [c8765de0adfcaaf4ffb2d951e07444f00ffa9453] blok, bfq: do not plug I/O if all queues are weight-raised
> > git bisect good c8765de0adfcaaf4ffb2d951e07444f00ffa9453
> > # first bad commit: [576ed9135489c723fb39b97c4e2c73428d06dd78] block: use bio_add_page in bio_iov_iter_get_pages
> >
> > The problem also occurred with the RHEL8 downstream kernel tree.
> > That's based on 4.18, but has 576ed913 backported.
> >
> > > So I'd be really curious if it can be reproduced with Jens' latest
> > > block for-5.2 tree (which should be in latest linux-next).
> >
> > I'll see if I can try that when I next get access to the machine.
>
> Ok, I've now had a chance to test the next-20190423 tree.
>
> I can still reproduce the problem: in fact it is substantially worse,
> and somewhat more consistent.
>
> Previously I usually lost 2-3 hugepages per run, though I'd
> occasionally seen other values between 0 and 8.  With the next tree, I
> lost 46 hugepages on most runs, though I also saw 45 and 48
> occasionally.

Please try to apply the following three patches, and I guess you may
see same behavior as linus tree(v5.1-rc, or v4.18). And the last one has
been applied to for-5.2/block which should be the latest next.

https://lore.kernel.org/linux-block/20190426104521.30602-2-ming.lei@redhat.com/T/#u
https://lore.kernel.org/linux-block/20190426104521.30602-3-ming.lei@redhat.com/T/#u

https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?h=for-5.2/block&id=0257c0ed5ea3de3e32cb322852c4c40bc09d1b97

Thanks,
Ming Lei

^ permalink raw reply

* [PATCH][v3] powerpc/lib: remove memcpy_flushcache redundant return
From: Li RongQing @ 2019-04-26 11:36 UTC (permalink / raw)
  To: christophe.leroy, linuxppc-dev

Align it with other architectures and none of the callers has
been interested its return

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
v2->v3: remove  extern from declaration
v1->v2: change memcpy_flushcache declaration in arch/powerpc/include/asm/string.h

 arch/powerpc/include/asm/string.h | 2 +-
 arch/powerpc/lib/pmem.c           | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h
index 1647de15a31e..50392b5086ec 100644
--- a/arch/powerpc/include/asm/string.h
+++ b/arch/powerpc/include/asm/string.h
@@ -25,7 +25,7 @@ extern void * memcpy(void *,const void *,__kernel_size_t);
 extern void * memmove(void *,const void *,__kernel_size_t);
 extern int memcmp(const void *,const void *,__kernel_size_t);
 extern void * memchr(const void *,int,__kernel_size_t);
-extern void * memcpy_flushcache(void *,const void *,__kernel_size_t);
+void memcpy_flushcache(void *dest, const void *src, size_t size);
 
 #ifdef CONFIG_PPC64
 #define __HAVE_ARCH_MEMSET32
diff --git a/arch/powerpc/lib/pmem.c b/arch/powerpc/lib/pmem.c
index 53c018762e1c..a7a1b3fc6720 100644
--- a/arch/powerpc/lib/pmem.c
+++ b/arch/powerpc/lib/pmem.c
@@ -48,14 +48,12 @@ long __copy_from_user_flushcache(void *dest, const void __user *src,
 	return copied;
 }
 
-void *memcpy_flushcache(void *dest, const void *src, size_t size)
+void memcpy_flushcache(void *dest, const void *src, size_t size)
 {
 	unsigned long start = (unsigned long) dest;
 
 	memcpy(dest, src, size);
 	flush_inval_dcache_range(start, start + size);
-
-	return dest;
 }
 EXPORT_SYMBOL(memcpy_flushcache);
 
-- 
2.16.2


^ permalink raw reply related

* Re: [PATCH 2/3 v2] ASoC: fsl_sai: Add support for runtime pm
From: Daniel Baluta @ 2019-04-26 12:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org,
	timur@kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com,
	S.j. Wang, tiwai@suse.com, lgirdwood@gmail.com, perex@perex.cz,
	nicoleotsuka@gmail.com, dl-linux-imx, Daniel Baluta,
	linux-kernel@vger.kernel.org
In-Reply-To: <20190426100025.GD14916@sirena.org.uk>

On Fri, Apr 26, 2019 at 1:01 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Sun, Apr 21, 2019 at 07:39:09PM +0000, Daniel Baluta wrote:
> > Basically the same actions as for system PM, so make use
> > of pm_runtime_force_suspend/pm_runtime_force_resume.
>
> This doesn't apply against current code, please check and resend.

Hi Mark,

This patch is already applied:

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?h=for-next&id=812ad463e0894d78e93ab8017e0edbe69038c55c

The only patch left in the series that needs to be applied is this:

https://www.spinics.net/lists/alsa-devel/msg89733.html

I will reply also to that email, to be easier for you to find it.

^ permalink raw reply

* Re: [PATCH v3 3/3] ASoC: fsl_sai: Move clock operation to PM runtime
From: Daniel Baluta @ 2019-04-26 12:11 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: alsa-devel@alsa-project.org, timur@kernel.org,
	Xiubo.Lee@gmail.com, linuxppc-dev@lists.ozlabs.org, S.j. Wang,
	tiwai@suse.com, lgirdwood@gmail.com, perex@perex.cz,
	broonie@kernel.org, dl-linux-imx, festevam@gmail.com,
	linux-kernel@vger.kernel.org
In-Reply-To: <20190422190213.30726-4-daniel.baluta@nxp.com>

Hi Mark,

This is the only patch in the series that wasn't applied.

On Mon, Apr 22, 2019 at 10:03 PM Daniel Baluta <daniel.baluta@nxp.com> wrote:
>
> From: Shengjiu Wang <shengjiu.wang@nxp.com>
>
> Turn off/on clocks when device enters suspend/resume. This
> can help saving power.
>
> As a further optimization, we turn off/on mclk only when SAI
> is in master mode because otherwise mclk is externally provided.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> ---
>  sound/soc/fsl/fsl_sai.c | 54 +++++++++++++++++++++++++++++++++--------
>  1 file changed, 44 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index 8623b7f882b9..7fd1a81ec1aa 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -596,15 +596,8 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
>  {
>         struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
>         bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
> -       struct device *dev = &sai->pdev->dev;
>         int ret;
>
> -       ret = clk_prepare_enable(sai->bus_clk);
> -       if (ret) {
> -               dev_err(dev, "failed to enable bus clock: %d\n", ret);
> -               return ret;
> -       }
> -
>         regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx), FSL_SAI_CR3_TRCE,
>                            FSL_SAI_CR3_TRCE);
>
> @@ -621,8 +614,6 @@ static void fsl_sai_shutdown(struct snd_pcm_substream *substream,
>         bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
>
>         regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx), FSL_SAI_CR3_TRCE, 0);
> -
> -       clk_disable_unprepare(sai->bus_clk);
>  }
>
>  static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = {
> @@ -932,6 +923,14 @@ static int fsl_sai_runtime_suspend(struct device *dev)
>  {
>         struct fsl_sai *sai = dev_get_drvdata(dev);
>
> +       if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_CAPTURE))
> +               clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[0]]);
> +
> +       if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_PLAYBACK))
> +               clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[1]]);
> +
> +       clk_disable_unprepare(sai->bus_clk);
> +
>         regcache_cache_only(sai->regmap, true);
>         regcache_mark_dirty(sai->regmap);
>
> @@ -941,6 +940,25 @@ static int fsl_sai_runtime_suspend(struct device *dev)
>  static int fsl_sai_runtime_resume(struct device *dev)
>  {
>         struct fsl_sai *sai = dev_get_drvdata(dev);
> +       int ret;
> +
> +       ret = clk_prepare_enable(sai->bus_clk);
> +       if (ret) {
> +               dev_err(dev, "failed to enable bus clock: %d\n", ret);
> +               return ret;
> +       }
> +
> +       if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_PLAYBACK)) {
> +               ret = clk_prepare_enable(sai->mclk_clk[sai->mclk_id[1]]);
> +               if (ret)
> +                       goto disable_bus_clk;
> +       }
> +
> +       if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_CAPTURE)) {
> +               ret = clk_prepare_enable(sai->mclk_clk[sai->mclk_id[0]]);
> +               if (ret)
> +                       goto disable_tx_clk;
> +       }
>
>         regcache_cache_only(sai->regmap, false);
>         regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
> @@ -948,7 +966,23 @@ static int fsl_sai_runtime_resume(struct device *dev)
>         usleep_range(1000, 2000);
>         regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
>         regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
> -       return regcache_sync(sai->regmap);
> +
> +       ret = regcache_sync(sai->regmap);
> +       if (ret)
> +               goto disable_rx_clk;
> +
> +       return 0;
> +
> +disable_rx_clk:
> +       if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_CAPTURE))
> +               clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[0]]);
> +disable_tx_clk:
> +       if (sai->mclk_streams & BIT(SNDRV_PCM_STREAM_PLAYBACK))
> +               clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[1]]);
> +disable_bus_clk:
> +       clk_disable_unprepare(sai->bus_clk);
> +
> +       return ret;
>  }
>  #endif /* CONFIG_PM */
>
> --
> 2.17.1
>

^ permalink raw reply

* [PATCH 2/3] powerpc/powernv: remove pnv_pci_{enable,disable}_tunnel
From: Christoph Hellwig @ 2019-04-26 12:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <20190426124917.23789-1-hch@lst.de>

These have been unused ever since they've been added to the kernel.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/powerpc/include/asm/pnv-pci.h        |  2 -
 arch/powerpc/platforms/powernv/pci-ioda.c |  4 +-
 arch/powerpc/platforms/powernv/pci.c      | 48 -----------------------
 arch/powerpc/platforms/powernv/pci.h      |  1 -
 4 files changed, 3 insertions(+), 52 deletions(-)

diff --git a/arch/powerpc/include/asm/pnv-pci.h b/arch/powerpc/include/asm/pnv-pci.h
index 9fcb0bc462c6..a8bd0aeeee03 100644
--- a/arch/powerpc/include/asm/pnv-pci.h
+++ b/arch/powerpc/include/asm/pnv-pci.h
@@ -27,8 +27,6 @@ extern int pnv_pci_get_power_state(uint64_t id, uint8_t *state);
 extern int pnv_pci_set_power_state(uint64_t id, uint8_t state,
 				   struct opal_msg *msg);
 
-extern int pnv_pci_enable_tunnel(struct pci_dev *dev, uint64_t *asnind);
-extern int pnv_pci_disable_tunnel(struct pci_dev *dev);
 extern int pnv_pci_set_tunnel_bar(struct pci_dev *dev, uint64_t addr,
 				  int enable);
 extern int pnv_pci_get_as_notify_info(struct task_struct *task, u32 *lpid,
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 3ead4c237ed0..ed73ba8e44a6 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -54,6 +54,8 @@
 static const char * const pnv_phb_names[] = { "IODA1", "IODA2", "NPU_NVLINK",
 					      "NPU_OCAPI" };
 
+static void pnv_pci_ioda2_set_bypass(struct pnv_ioda_pe *pe, bool enable);
+
 void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
 			    const char *fmt, ...)
 {
@@ -2359,7 +2361,7 @@ static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group,
 	return 0;
 }
 
-void pnv_pci_ioda2_set_bypass(struct pnv_ioda_pe *pe, bool enable)
+static void pnv_pci_ioda2_set_bypass(struct pnv_ioda_pe *pe, bool enable)
 {
 	uint16_t window_id = (pe->pe_number << 1 ) + 1;
 	int64_t rc;
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 8d28f2932c3b..2bac62a7123d 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -868,54 +868,6 @@ struct device_node *pnv_pci_get_phb_node(struct pci_dev *dev)
 }
 EXPORT_SYMBOL(pnv_pci_get_phb_node);
 
-int pnv_pci_enable_tunnel(struct pci_dev *dev, u64 *asnind)
-{
-	struct device_node *np;
-	const __be32 *prop;
-	struct pnv_ioda_pe *pe;
-	uint16_t window_id;
-	int rc;
-
-	if (!radix_enabled())
-		return -ENXIO;
-
-	if (!(np = pnv_pci_get_phb_node(dev)))
-		return -ENXIO;
-
-	prop = of_get_property(np, "ibm,phb-indications", NULL);
-	of_node_put(np);
-
-	if (!prop || !prop[1])
-		return -ENXIO;
-
-	*asnind = (u64)be32_to_cpu(prop[1]);
-	pe = pnv_ioda_get_pe(dev);
-	if (!pe)
-		return -ENODEV;
-
-	/* Increase real window size to accept as_notify messages. */
-	window_id = (pe->pe_number << 1 ) + 1;
-	rc = opal_pci_map_pe_dma_window_real(pe->phb->opal_id, pe->pe_number,
-					     window_id, pe->tce_bypass_base,
-					     (uint64_t)1 << 48);
-	return opal_error_code(rc);
-}
-EXPORT_SYMBOL_GPL(pnv_pci_enable_tunnel);
-
-int pnv_pci_disable_tunnel(struct pci_dev *dev)
-{
-	struct pnv_ioda_pe *pe;
-
-	pe = pnv_ioda_get_pe(dev);
-	if (!pe)
-		return -ENODEV;
-
-	/* Restore default real window size. */
-	pnv_pci_ioda2_set_bypass(pe, true);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(pnv_pci_disable_tunnel);
-
 int pnv_pci_set_tunnel_bar(struct pci_dev *dev, u64 addr, int enable)
 {
 	__be64 val;
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index fbec1c76d7a7..f0a6ff56e349 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -194,7 +194,6 @@ extern int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
 extern void pnv_teardown_msi_irqs(struct pci_dev *pdev);
 extern struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev);
 extern void pnv_set_msi_irq_chip(struct pnv_phb *phb, unsigned int virq);
-extern void pnv_pci_ioda2_set_bypass(struct pnv_ioda_pe *pe, bool enable);
 extern unsigned long pnv_pci_ioda2_get_table_size(__u32 page_shift,
 		__u64 window_size, __u32 levels);
 extern int pnv_eeh_post_init(void);
-- 
2.20.1


^ permalink raw reply related

* remove dead powernv code
From: Christoph Hellwig @ 2019-04-26 12:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman; +Cc: linuxppc-dev

Hi all,

the powerpc powernv port has a fairly large chunk of code that never
had any upstream user.  We generally strive to not keep dead code
around, and this was affirmed at least years Maintainer summit.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox