diff mbox series

[1/8] powerpc/mm: Make slice specific to book3s/64

Message ID 14e2c0b0d4fff49c1cb30166f54ce8e445e17b16.1637570556.git.christophe.leroy@csgroup.eu (mailing list archive)
State New
Headers show
Series Convert powerpc to default topdown mmap layout | expand

Commit Message

Christophe Leroy Nov. 22, 2021, 8:48 a.m. UTC
Since commit 555904d07eef ("powerpc/8xx: MM_SLICE is not needed
anymore") only book3s/64 selects CONFIG_PPC_MM_SLICES.

Move slice.c into mm/book3s64/

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/mm/Makefile               | 1 -
 arch/powerpc/mm/book3s64/Makefile      | 1 +
 arch/powerpc/mm/{ => book3s64}/slice.c | 0
 arch/powerpc/mm/nohash/mmu_context.c   | 2 --
 arch/powerpc/mm/nohash/tlb.c           | 4 ----
 5 files changed, 1 insertion(+), 7 deletions(-)
 rename arch/powerpc/mm/{ => book3s64}/slice.c (100%)

Comments

kernel test robot Nov. 22, 2021, 2:48 p.m. UTC | #1
Hi Christophe,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on hnaz-mm/master linus/master v5.16-rc2 next-20211118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc64-randconfig-s031-20211122 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
        git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   arch/powerpc/mm/book3s64/slice.c: In function 'slice_get_unmapped_area':
>> arch/powerpc/mm/book3s64/slice.c:639:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
     639 | }
         | ^


vim +639 arch/powerpc/mm/book3s64/slice.c

3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  428  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  429  unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  430  				      unsigned long flags, unsigned int psize,
34d07177b802e9 arch/powerpc/mm/slice.c Michel Lespinasse      2013-04-29  431  				      int topdown)
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  432  {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  433  	struct slice_mask good_mask;
f3207c124e7aa8 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-22  434  	struct slice_mask potential_mask;
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  435  	const struct slice_mask *maskp;
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  436  	const struct slice_mask *compat_maskp = NULL;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  437  	int fixed = (flags & MAP_FIXED);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  438  	int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  439  	unsigned long page_size = 1UL << pshift;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  440  	struct mm_struct *mm = current->mm;
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  441  	unsigned long newaddr;
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  442  	unsigned long high_limit;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  443  
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  444  	high_limit = DEFAULT_MAP_WINDOW;
35602f82d0c765 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  445  	if (addr >= high_limit || (fixed && (addr + len > high_limit)))
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  446  		high_limit = TASK_SIZE;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  447  
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  448  	if (len > high_limit)
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  449  		return -ENOMEM;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  450  	if (len & (page_size - 1))
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  451  		return -EINVAL;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  452  	if (fixed) {
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  453  		if (addr & (page_size - 1))
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  454  			return -EINVAL;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  455  		if (addr > high_limit - len)
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  456  			return -ENOMEM;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  457  	}
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  458  
60458fba469a69 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-04-17  459  	if (high_limit > mm_ctx_slb_addr_limit(&mm->context)) {
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  460  		/*
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  461  		 * Increasing the slb_addr_limit does not require
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  462  		 * slice mask cache to be recalculated because it should
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  463  		 * be already initialised beyond the old address limit.
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  464  		 */
60458fba469a69 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-04-17  465  		mm_ctx_set_slb_addr_limit(&mm->context, high_limit);
54be0b9c7c9888 arch/powerpc/mm/slice.c Michael Ellerman       2018-10-02  466  
54be0b9c7c9888 arch/powerpc/mm/slice.c Michael Ellerman       2018-10-02  467  		on_each_cpu(slice_flush_segments, mm, 1);
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  468  	}
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  469  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  470  	/* Sanity checks */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  471  	BUG_ON(mm->task_size == 0);
60458fba469a69 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-04-17  472  	BUG_ON(mm_ctx_slb_addr_limit(&mm->context) == 0);
764041e0f43cc7 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2016-04-29  473  	VM_BUG_ON(radix_enabled());
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  474  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  475  	slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize);
34d07177b802e9 arch/powerpc/mm/slice.c Michel Lespinasse      2013-04-29  476  	slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d\n",
34d07177b802e9 arch/powerpc/mm/slice.c Michel Lespinasse      2013-04-29  477  		  addr, len, flags, topdown);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  478  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  479  	/* If hint, make sure it matches our alignment restrictions */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  480  	if (!fixed && addr) {
b711531641038f arch/powerpc/mm/slice.c Christophe Leroy       2020-04-20  481  		addr = ALIGN(addr, page_size);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  482  		slice_dbg(" aligned addr=%lx\n", addr);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  483  		/* Ignore hint if it's too large or overlaps a VMA */
3b4d07d2674f6b arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-02-26  484  		if (addr > high_limit - len || addr < mmap_min_addr ||
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  485  		    !slice_area_is_free(mm, addr, len))
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  486  			addr = 0;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  487  	}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  488  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  489  	/* First make up a "good" mask of slices that have the right size
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  490  	 * already
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  491  	 */
6f60cc98df2be7 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  492  	maskp = slice_mask_for_size(&mm->context, psize);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  493  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  494  	/*
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  495  	 * Here "good" means slices that are already the right page size,
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  496  	 * "compat" means slices that have a compatible page size (i.e.
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  497  	 * 4k in a 64k pagesize kernel), and "free" means slices without
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  498  	 * any VMAs.
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  499  	 *
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  500  	 * If MAP_FIXED:
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  501  	 *	check if fits in good | compat => OK
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  502  	 *	check if fits in good | compat | free => convert free
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  503  	 *	else bad
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  504  	 * If have hint:
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  505  	 *	check if hint fits in good => OK
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  506  	 *	check if hint fits in good | free => convert free
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  507  	 * Otherwise:
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  508  	 *	search in good, found => OK
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  509  	 *	search in good | free, found => convert free
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  510  	 *	search in good | compat | free, found => convert free.
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  511  	 */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  512  
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  513  	/*
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  514  	 * If we support combo pages, we can allow 64k pages in 4k slices
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  515  	 * The mask copies could be avoided in most cases here if we had
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  516  	 * a pointer to good mask for the next code to use.
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  517  	 */
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  518  	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && psize == MMU_PAGE_64K) {
6f60cc98df2be7 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  519  		compat_maskp = slice_mask_for_size(&mm->context, MMU_PAGE_4K);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  520  		if (fixed)
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  521  			slice_or_mask(&good_mask, maskp, compat_maskp);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  522  		else
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  523  			slice_copy_mask(&good_mask, maskp);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  524  	} else {
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  525  		slice_copy_mask(&good_mask, maskp);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  526  	}
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  527  
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  528  	slice_print_mask(" good_mask", &good_mask);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  529  	if (compat_maskp)
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  530  		slice_print_mask(" compat_mask", compat_maskp);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  531  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  532  	/* First check hint if it's valid or if we have MAP_FIXED */
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  533  	if (addr != 0 || fixed) {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  534  		/* Check if we fit in the good mask. If we do, we just return,
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  535  		 * nothing else to do
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  536  		 */
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  537  		if (slice_check_range_fits(mm, &good_mask, addr, len)) {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  538  			slice_dbg(" fits good !\n");
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  539  			newaddr = addr;
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  540  			goto return_addr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  541  		}
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  542  	} else {
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  543  		/* Now let's see if we can find something in the existing
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  544  		 * slices for that size
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  545  		 */
830fd2d45aa116 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  546  		newaddr = slice_find_area(mm, len, &good_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  547  					  psize, topdown, high_limit);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  548  		if (newaddr != -ENOMEM) {
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  549  			/* Found within the good mask, we don't have to setup,
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  550  			 * we thus return directly
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  551  			 */
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  552  			slice_dbg(" found area at 0x%lx\n", newaddr);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  553  			goto return_addr;
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  554  		}
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  555  	}
7a06c66835f75f arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-11-10  556  	/*
7a06c66835f75f arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-11-10  557  	 * We don't fit in the good mask, check what other slices are
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  558  	 * empty and thus can be converted
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  559  	 */
7a06c66835f75f arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-11-10  560  	slice_mask_for_free(mm, &potential_mask, high_limit);
b8c93549142077 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  561  	slice_or_mask(&potential_mask, &potential_mask, &good_mask);
830fd2d45aa116 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  562  	slice_print_mask(" potential", &potential_mask);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  563  
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  564  	if (addr != 0 || fixed) {
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  565  		if (slice_check_range_fits(mm, &potential_mask, addr, len)) {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  566  			slice_dbg(" fits potential !\n");
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  567  			newaddr = addr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  568  			goto convert;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  569  		}
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  570  	}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  571  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  572  	/* If we have MAP_FIXED and failed the above steps, then error out */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  573  	if (fixed)
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  574  		return -EBUSY;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  575  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  576  	slice_dbg(" search...\n");
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  577  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  578  	/* If we had a hint that didn't work out, see if we can fit
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  579  	 * anywhere in the good area.
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  580  	 */
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  581  	if (addr) {
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  582  		newaddr = slice_find_area(mm, len, &good_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  583  					  psize, topdown, high_limit);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  584  		if (newaddr != -ENOMEM) {
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  585  			slice_dbg(" found area at 0x%lx\n", newaddr);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  586  			goto return_addr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  587  		}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  588  	}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  589  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  590  	/* Now let's see if we can find something in the existing slices
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  591  	 * for that size plus free slices
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  592  	 */
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  593  	newaddr = slice_find_area(mm, len, &potential_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  594  				  psize, topdown, high_limit);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  595  
203a1fa6286671 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  596  	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && newaddr == -ENOMEM &&
203a1fa6286671 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  597  	    psize == MMU_PAGE_64K) {
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  598  		/* retry the search with 4k-page slices included */
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  599  		slice_or_mask(&potential_mask, &potential_mask, compat_maskp);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  600  		newaddr = slice_find_area(mm, len, &potential_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  601  					  psize, topdown, high_limit);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  602  	}
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  603  
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  604  	if (newaddr == -ENOMEM)
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  605  		return -ENOMEM;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  606  
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  607  	slice_range_to_mask(newaddr, len, &potential_mask);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  608  	slice_dbg(" found potential area at 0x%lx\n", newaddr);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  609  	slice_print_mask(" mask", &potential_mask);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  610  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  611   convert:
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  612  	/*
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  613  	 * Try to allocate the context before we do slice convert
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  614  	 * so that we handle the context allocation failure gracefully.
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  615  	 */
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  616  	if (need_extra_context(mm, newaddr)) {
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  617  		if (alloc_extended_context(mm, newaddr) < 0)
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  618  			return -ENOMEM;
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  619  	}
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  620  
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  621  	slice_andnot_mask(&potential_mask, &potential_mask, &good_mask);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  622  	if (compat_maskp && !fixed)
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  623  		slice_andnot_mask(&potential_mask, &potential_mask, compat_maskp);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  624  	if (potential_mask.low_slices ||
db3a528db41caa arch/powerpc/mm/slice.c Christophe Leroy       2018-02-22  625  		(SLICE_NUM_HIGH &&
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  626  		 !bitmap_empty(potential_mask.high_slices, SLICE_NUM_HIGH))) {
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  627  		slice_convert(mm, &potential_mask, psize);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  628  		if (psize > MMU_PAGE_BASE)
54be0b9c7c9888 arch/powerpc/mm/slice.c Michael Ellerman       2018-10-02  629  			on_each_cpu(slice_flush_segments, mm, 1);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  630  	}
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  631  	return newaddr;
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  632  
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  633  return_addr:
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  634  	if (need_extra_context(mm, newaddr)) {
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  635  		if (alloc_extended_context(mm, newaddr) < 0)
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  636  			return -ENOMEM;
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  637  	}
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  638  	return newaddr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08 @639  }
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  640  EXPORT_SYMBOL_GPL(slice_get_unmapped_area);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  641  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Nov. 22, 2021, 9:10 p.m. UTC | #2
Hi Christophe,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on hnaz-mm/master linus/master v5.16-rc2 next-20211118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc64-randconfig-r021-20211122 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
        git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/powerpc/mm/book3s64/slice.c: In function 'slice_get_unmapped_area':
>> arch/powerpc/mm/book3s64/slice.c:639:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
     639 | }
         | ^
   cc1: all warnings being treated as errors


vim +639 arch/powerpc/mm/book3s64/slice.c

3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  428  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  429  unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  430  				      unsigned long flags, unsigned int psize,
34d07177b802e9 arch/powerpc/mm/slice.c Michel Lespinasse      2013-04-29  431  				      int topdown)
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  432  {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  433  	struct slice_mask good_mask;
f3207c124e7aa8 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-22  434  	struct slice_mask potential_mask;
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  435  	const struct slice_mask *maskp;
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  436  	const struct slice_mask *compat_maskp = NULL;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  437  	int fixed = (flags & MAP_FIXED);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  438  	int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  439  	unsigned long page_size = 1UL << pshift;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  440  	struct mm_struct *mm = current->mm;
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  441  	unsigned long newaddr;
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  442  	unsigned long high_limit;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  443  
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  444  	high_limit = DEFAULT_MAP_WINDOW;
35602f82d0c765 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  445  	if (addr >= high_limit || (fixed && (addr + len > high_limit)))
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  446  		high_limit = TASK_SIZE;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  447  
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  448  	if (len > high_limit)
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  449  		return -ENOMEM;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  450  	if (len & (page_size - 1))
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  451  		return -EINVAL;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  452  	if (fixed) {
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  453  		if (addr & (page_size - 1))
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  454  			return -EINVAL;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  455  		if (addr > high_limit - len)
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  456  			return -ENOMEM;
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  457  	}
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  458  
60458fba469a69 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-04-17  459  	if (high_limit > mm_ctx_slb_addr_limit(&mm->context)) {
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  460  		/*
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  461  		 * Increasing the slb_addr_limit does not require
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  462  		 * slice mask cache to be recalculated because it should
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  463  		 * be already initialised beyond the old address limit.
5709f7cfd83052 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  464  		 */
60458fba469a69 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-04-17  465  		mm_ctx_set_slb_addr_limit(&mm->context, high_limit);
54be0b9c7c9888 arch/powerpc/mm/slice.c Michael Ellerman       2018-10-02  466  
54be0b9c7c9888 arch/powerpc/mm/slice.c Michael Ellerman       2018-10-02  467  		on_each_cpu(slice_flush_segments, mm, 1);
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  468  	}
6a72dc038b6152 arch/powerpc/mm/slice.c Nicholas Piggin        2017-11-10  469  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  470  	/* Sanity checks */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  471  	BUG_ON(mm->task_size == 0);
60458fba469a69 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-04-17  472  	BUG_ON(mm_ctx_slb_addr_limit(&mm->context) == 0);
764041e0f43cc7 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2016-04-29  473  	VM_BUG_ON(radix_enabled());
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  474  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  475  	slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize);
34d07177b802e9 arch/powerpc/mm/slice.c Michel Lespinasse      2013-04-29  476  	slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d\n",
34d07177b802e9 arch/powerpc/mm/slice.c Michel Lespinasse      2013-04-29  477  		  addr, len, flags, topdown);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  478  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  479  	/* If hint, make sure it matches our alignment restrictions */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  480  	if (!fixed && addr) {
b711531641038f arch/powerpc/mm/slice.c Christophe Leroy       2020-04-20  481  		addr = ALIGN(addr, page_size);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  482  		slice_dbg(" aligned addr=%lx\n", addr);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  483  		/* Ignore hint if it's too large or overlaps a VMA */
3b4d07d2674f6b arch/powerpc/mm/slice.c Aneesh Kumar K.V       2019-02-26  484  		if (addr > high_limit - len || addr < mmap_min_addr ||
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  485  		    !slice_area_is_free(mm, addr, len))
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  486  			addr = 0;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  487  	}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  488  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  489  	/* First make up a "good" mask of slices that have the right size
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  490  	 * already
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  491  	 */
6f60cc98df2be7 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  492  	maskp = slice_mask_for_size(&mm->context, psize);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  493  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  494  	/*
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  495  	 * Here "good" means slices that are already the right page size,
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  496  	 * "compat" means slices that have a compatible page size (i.e.
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  497  	 * 4k in a 64k pagesize kernel), and "free" means slices without
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  498  	 * any VMAs.
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  499  	 *
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  500  	 * If MAP_FIXED:
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  501  	 *	check if fits in good | compat => OK
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  502  	 *	check if fits in good | compat | free => convert free
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  503  	 *	else bad
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  504  	 * If have hint:
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  505  	 *	check if hint fits in good => OK
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  506  	 *	check if hint fits in good | free => convert free
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  507  	 * Otherwise:
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  508  	 *	search in good, found => OK
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  509  	 *	search in good | free, found => convert free
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  510  	 *	search in good | compat | free, found => convert free.
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  511  	 */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  512  
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  513  	/*
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  514  	 * If we support combo pages, we can allow 64k pages in 4k slices
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  515  	 * The mask copies could be avoided in most cases here if we had
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  516  	 * a pointer to good mask for the next code to use.
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  517  	 */
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  518  	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && psize == MMU_PAGE_64K) {
6f60cc98df2be7 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  519  		compat_maskp = slice_mask_for_size(&mm->context, MMU_PAGE_4K);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  520  		if (fixed)
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  521  			slice_or_mask(&good_mask, maskp, compat_maskp);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  522  		else
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  523  			slice_copy_mask(&good_mask, maskp);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  524  	} else {
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  525  		slice_copy_mask(&good_mask, maskp);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  526  	}
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  527  
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  528  	slice_print_mask(" good_mask", &good_mask);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  529  	if (compat_maskp)
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  530  		slice_print_mask(" compat_mask", compat_maskp);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  531  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  532  	/* First check hint if it's valid or if we have MAP_FIXED */
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  533  	if (addr != 0 || fixed) {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  534  		/* Check if we fit in the good mask. If we do, we just return,
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  535  		 * nothing else to do
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  536  		 */
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  537  		if (slice_check_range_fits(mm, &good_mask, addr, len)) {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  538  			slice_dbg(" fits good !\n");
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  539  			newaddr = addr;
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  540  			goto return_addr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  541  		}
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  542  	} else {
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  543  		/* Now let's see if we can find something in the existing
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  544  		 * slices for that size
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  545  		 */
830fd2d45aa116 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  546  		newaddr = slice_find_area(mm, len, &good_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  547  					  psize, topdown, high_limit);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  548  		if (newaddr != -ENOMEM) {
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  549  			/* Found within the good mask, we don't have to setup,
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  550  			 * we thus return directly
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  551  			 */
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  552  			slice_dbg(" found area at 0x%lx\n", newaddr);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  553  			goto return_addr;
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  554  		}
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  555  	}
7a06c66835f75f arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-11-10  556  	/*
7a06c66835f75f arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-11-10  557  	 * We don't fit in the good mask, check what other slices are
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  558  	 * empty and thus can be converted
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  559  	 */
7a06c66835f75f arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-11-10  560  	slice_mask_for_free(mm, &potential_mask, high_limit);
b8c93549142077 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  561  	slice_or_mask(&potential_mask, &potential_mask, &good_mask);
830fd2d45aa116 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  562  	slice_print_mask(" potential", &potential_mask);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  563  
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  564  	if (addr != 0 || fixed) {
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  565  		if (slice_check_range_fits(mm, &potential_mask, addr, len)) {
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  566  			slice_dbg(" fits potential !\n");
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  567  			newaddr = addr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  568  			goto convert;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  569  		}
ae3066bd1cbe58 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  570  	}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  571  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  572  	/* If we have MAP_FIXED and failed the above steps, then error out */
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  573  	if (fixed)
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  574  		return -EBUSY;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  575  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  576  	slice_dbg(" search...\n");
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  577  
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  578  	/* If we had a hint that didn't work out, see if we can fit
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  579  	 * anywhere in the good area.
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  580  	 */
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  581  	if (addr) {
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  582  		newaddr = slice_find_area(mm, len, &good_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  583  					  psize, topdown, high_limit);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  584  		if (newaddr != -ENOMEM) {
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  585  			slice_dbg(" found area at 0x%lx\n", newaddr);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  586  			goto return_addr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  587  		}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  588  	}
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  589  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  590  	/* Now let's see if we can find something in the existing slices
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  591  	 * for that size plus free slices
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  592  	 */
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  593  	newaddr = slice_find_area(mm, len, &potential_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  594  				  psize, topdown, high_limit);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  595  
203a1fa6286671 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  596  	if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && newaddr == -ENOMEM &&
203a1fa6286671 arch/powerpc/mm/slice.c Christophe Leroy       2019-04-25  597  	    psize == MMU_PAGE_64K) {
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  598  		/* retry the search with 4k-page slices included */
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  599  		slice_or_mask(&potential_mask, &potential_mask, compat_maskp);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  600  		newaddr = slice_find_area(mm, len, &potential_mask,
f4ea6dcb08ea2c arch/powerpc/mm/slice.c Aneesh Kumar K.V       2017-03-30  601  					  psize, topdown, high_limit);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  602  	}
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  603  
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  604  	if (newaddr == -ENOMEM)
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  605  		return -ENOMEM;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  606  
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  607  	slice_range_to_mask(newaddr, len, &potential_mask);
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  608  	slice_dbg(" found potential area at 0x%lx\n", newaddr);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  609  	slice_print_mask(" mask", &potential_mask);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  610  
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  611   convert:
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  612  	/*
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  613  	 * Try to allocate the context before we do slice convert
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  614  	 * so that we handle the context allocation failure gracefully.
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  615  	 */
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  616  	if (need_extra_context(mm, newaddr)) {
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  617  		if (alloc_extended_context(mm, newaddr) < 0)
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  618  			return -ENOMEM;
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  619  	}
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  620  
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  621  	slice_andnot_mask(&potential_mask, &potential_mask, &good_mask);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  622  	if (compat_maskp && !fixed)
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  623  		slice_andnot_mask(&potential_mask, &potential_mask, compat_maskp);
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  624  	if (potential_mask.low_slices ||
db3a528db41caa arch/powerpc/mm/slice.c Christophe Leroy       2018-02-22  625  		(SLICE_NUM_HIGH &&
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  626  		 !bitmap_empty(potential_mask.high_slices, SLICE_NUM_HIGH))) {
d262bd5a739982 arch/powerpc/mm/slice.c Nicholas Piggin        2018-03-07  627  		slice_convert(mm, &potential_mask, psize);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  628  		if (psize > MMU_PAGE_BASE)
54be0b9c7c9888 arch/powerpc/mm/slice.c Michael Ellerman       2018-10-02  629  			on_each_cpu(slice_flush_segments, mm, 1);
3a8247cc2c8569 arch/powerpc/mm/slice.c Paul Mackerras         2008-06-18  630  	}
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  631  	return newaddr;
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  632  
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  633  return_addr:
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  634  	if (need_extra_context(mm, newaddr)) {
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  635  		if (alloc_extended_context(mm, newaddr) < 0)
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  636  			return -ENOMEM;
f384796c40dc55 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  637  	}
0dea04b288c066 arch/powerpc/mm/slice.c Aneesh Kumar K.V       2018-03-26  638  	return newaddr;
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08 @639  }
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  640  EXPORT_SYMBOL_GPL(slice_get_unmapped_area);
d0f13e3c20b6fb arch/powerpc/mm/slice.c Benjamin Herrenschmidt 2007-05-08  641  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Christophe Leroy Nov. 24, 2021, 12:10 p.m. UTC | #3
Le 22/11/2021 à 15:48, kernel test robot a écrit :
> Hi Christophe,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on powerpc/next]
> [also build test WARNING on hnaz-mm/master linus/master v5.16-rc2 next-20211118]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
> config: powerpc64-randconfig-s031-20211122 (attached as .config)
> compiler: powerpc64-linux-gcc (GCC) 11.2.0
> reproduce:
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # apt-get install sparse
>          # sparse version: v0.6.4-dirty
>          # https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
>          git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>     arch/powerpc/mm/book3s64/slice.c: In function 'slice_get_unmapped_area':
>>> arch/powerpc/mm/book3s64/slice.c:639:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>       639 | }
>           | ^


The problem was already existing when slice.c was in arch/powerpc/mm/

This patch doesn't introduce the problem.

Christophe
Christophe Leroy Nov. 24, 2021, 12:10 p.m. UTC | #4
Le 22/11/2021 à 22:10, kernel test robot a écrit :
> Hi Christophe,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on powerpc/next]
> [also build test ERROR on hnaz-mm/master linus/master v5.16-rc2 next-20211118]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
> config: powerpc64-randconfig-r021-20211122 (attached as .config)
> compiler: powerpc64-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>          git remote add linux-review https://github.com/0day-ci/linux
>          git fetch --no-tags linux-review Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115
>          git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>     arch/powerpc/mm/book3s64/slice.c: In function 'slice_get_unmapped_area':
>>> arch/powerpc/mm/book3s64/slice.c:639:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>       639 | }
>           | ^
>     cc1: all warnings being treated as errors
> 
> 

The problem was already existing when slice.c was in arch/powerpc/mm/

This patch doesn't introduce the problem.

Christophe
Christophe Leroy Nov. 24, 2021, 1:49 p.m. UTC | #5
Le 24/11/2021 à 13:10, Christophe Leroy a écrit :
> 
> 
> Le 22/11/2021 à 15:48, kernel test robot a écrit :
>> Hi Christophe,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on powerpc/next]
>> [also build test WARNING on hnaz-mm/master linus/master v5.16-rc2 
>> next-20211118]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch]
>>
>> url:    
>> https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115 
>>
>> base:   
>> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
>> config: powerpc64-randconfig-s031-20211122 (attached as .config)
>> compiler: powerpc64-linux-gcc (GCC) 11.2.0
>> reproduce:
>>          wget 
>> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross 
>> -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # apt-get install sparse
>>          # sparse version: v0.6.4-dirty
>>          # 
>> https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a 
>>
>>          git remote add linux-review https://github.com/0day-ci/linux
>>          git fetch --no-tags linux-review 
>> Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115 
>>
>>          git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>>          # save the attached .config to linux build tree
>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 
>> make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>>     arch/powerpc/mm/book3s64/slice.c: In function 
>> 'slice_get_unmapped_area':
>>>> arch/powerpc/mm/book3s64/slice.c:639:1: warning: the frame size of 
>>>> 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>       639 | }
>>           | ^
> 
> 
> The problem was already existing when slice.c was in arch/powerpc/mm/
> 
> This patch doesn't introduce the problem.
> 

In fact the problem is really added by yourself mister 'kernel test robot'.

CONFIG_FRAME_WARN is supposed to be 2048 on 64 bit architectures.

It the robot starts to reduce that value, it is on its own ....


config FRAME_WARN
	int "Warn for stack frames larger than"
	range 0 8192
	default 2048 if GCC_PLUGIN_LATENT_ENTROPY
	default 1536 if (!64BIT && (PARISC || XTENSA))
	default 1024 if (!64BIT && !PARISC)
	default 2048 if 64BIT
	help
	  Tell gcc to warn at build time for stack frames larger than this.
	  Setting this too low will cause a lot of warnings.
	  Setting it to 0 disables the warning.
Chen, Rong A Nov. 26, 2021, 5:15 a.m. UTC | #6
On 11/24/2021 9:49 PM, Christophe Leroy wrote:
> 
> 
> Le 24/11/2021 à 13:10, Christophe Leroy a écrit :
>>
>>
>> Le 22/11/2021 à 15:48, kernel test robot a écrit :
>>> Hi Christophe,
>>>
>>> I love your patch! Perhaps something to improve:
>>>
>>> [auto build test WARNING on powerpc/next]
>>> [also build test WARNING on hnaz-mm/master linus/master v5.16-rc2 
>>> next-20211118]
>>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>>> And when submitting patch, we suggest to use '--base' as documented in
>>> https://git-scm.com/docs/git-format-patch]
>>>
>>> url: 
>>> https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115 
>>>
>>> base: 
>>> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
>>> config: powerpc64-randconfig-s031-20211122 (attached as .config)
>>> compiler: powerpc64-linux-gcc (GCC) 11.2.0
>>> reproduce:
>>>          wget 
>>> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross 
>>> -O ~/bin/make.cross
>>>          chmod +x ~/bin/make.cross
>>>          # apt-get install sparse
>>>          # sparse version: v0.6.4-dirty
>>>          # 
>>> https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a 
>>>
>>>          git remote add linux-review https://github.com/0day-ci/linux
>>>          git fetch --no-tags linux-review 
>>> Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115 
>>>
>>>          git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>>>          # save the attached .config to linux build tree
>>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 
>>> make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' 
>>> ARCH=powerpc64
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <lkp@intel.com>
>>>
>>> All warnings (new ones prefixed by >>):
>>>
>>>     arch/powerpc/mm/book3s64/slice.c: In function 
>>> 'slice_get_unmapped_area':
>>>>> arch/powerpc/mm/book3s64/slice.c:639:1: warning: the frame size of 
>>>>> 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>>       639 | }
>>>           | ^
>>
>>
>> The problem was already existing when slice.c was in arch/powerpc/mm/
>>
>> This patch doesn't introduce the problem.
>>
> 
> In fact the problem is really added by yourself mister 'kernel test robot'.
> 
> CONFIG_FRAME_WARN is supposed to be 2048 on 64 bit architectures.
> 
> It the robot starts to reduce that value, it is on its own ....

Hi Christophe,

Thanks for the information, we'll set the default value for FRAME_WARN 
in randconfig tests.

Best Regards,
Rong Chen

> 
> 
> config FRAME_WARN
>      int "Warn for stack frames larger than"
>      range 0 8192
>      default 2048 if GCC_PLUGIN_LATENT_ENTROPY
>      default 1536 if (!64BIT && (PARISC || XTENSA))
>      default 1024 if (!64BIT && !PARISC)
>      default 2048 if 64BIT
>      help
>        Tell gcc to warn at build time for stack frames larger than this.
>        Setting this too low will cause a lot of warnings.
>        Setting it to 0 disables the warning.
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
diff mbox series

Patch

diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index df8172da2301..d4c20484dad9 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -14,7 +14,6 @@  obj-$(CONFIG_PPC_MMU_NOHASH)	+= nohash/
 obj-$(CONFIG_PPC_BOOK3S_32)	+= book3s32/
 obj-$(CONFIG_PPC_BOOK3S_64)	+= book3s64/
 obj-$(CONFIG_NUMA) += numa.o
-obj-$(CONFIG_PPC_MM_SLICES)	+= slice.o
 obj-$(CONFIG_HUGETLB_PAGE)	+= hugetlbpage.o
 obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
 obj-$(CONFIG_PPC_COPRO_BASE)	+= copro_fault.o
diff --git a/arch/powerpc/mm/book3s64/Makefile b/arch/powerpc/mm/book3s64/Makefile
index 1b56d3af47d4..30951668c684 100644
--- a/arch/powerpc/mm/book3s64/Makefile
+++ b/arch/powerpc/mm/book3s64/Makefile
@@ -18,6 +18,7 @@  obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += hash_hugepage.o
 obj-$(CONFIG_PPC_SUBPAGE_PROT)	+= subpage_prot.o
 obj-$(CONFIG_SPAPR_TCE_IOMMU)	+= iommu_api.o
 obj-$(CONFIG_PPC_PKEY)	+= pkeys.o
+obj-$(CONFIG_PPC_MM_SLICES)	+= slice.o
 
 # Instrumenting the SLB fault path can lead to duplicate SLB entries
 KCOV_INSTRUMENT_slb.o := n
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/book3s64/slice.c
similarity index 100%
rename from arch/powerpc/mm/slice.c
rename to arch/powerpc/mm/book3s64/slice.c
diff --git a/arch/powerpc/mm/nohash/mmu_context.c b/arch/powerpc/mm/nohash/mmu_context.c
index 44b2b5e7cabe..b8dfe66bdf18 100644
--- a/arch/powerpc/mm/nohash/mmu_context.c
+++ b/arch/powerpc/mm/nohash/mmu_context.c
@@ -320,8 +320,6 @@  int init_new_context(struct task_struct *t, struct mm_struct *mm)
 	 * have id == 0) and don't alter context slice inherited via fork (which
 	 * will have id != 0).
 	 */
-	if (mm->context.id == 0)
-		slice_init_new_context_exec(mm);
 	mm->context.id = MMU_NO_CONTEXT;
 	mm->context.active = 0;
 	pte_frag_set(&mm->context, NULL);
diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
index 89353d4f5604..4822dfd6c246 100644
--- a/arch/powerpc/mm/nohash/tlb.c
+++ b/arch/powerpc/mm/nohash/tlb.c
@@ -782,9 +782,5 @@  void __init early_init_mmu(void)
 #ifdef CONFIG_PPC_47x
 	early_init_mmu_47x();
 #endif
-
-#ifdef CONFIG_PPC_MM_SLICES
-	mm_ctx_set_slb_addr_limit(&init_mm.context, SLB_ADDR_LIMIT_DEFAULT);
-#endif
 }
 #endif /* CONFIG_PPC64 */