All of lore.kernel.org
 help / color / mirror / Atom feed
* [nsaenz-linux-rpi:v3d-enable-v2 9566/9840] mm/cma.c:504:31: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long'
@ 2021-02-10 12:31 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-02-10 12:31 UTC (permalink / raw)
  To: Patrick Daly
  Cc: kbuild-all, clang-built-linux, Georgi Djakov, Andrew Morton,
	Linux Memory Management List

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git v3d-enable-v2
head:   7b81f59eac536dd4cbe3eab95904e255f5b291e5
commit: cc4ec2eab7474381e57d4bbcf3c04595a729859b [9566/9840] mm: cma: print region name on failure
config: mips-randconfig-r036-20210209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git/commit/?id=cc4ec2eab7474381e57d4bbcf3c04595a729859b
        git remote add nsaenz-linux-rpi https://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git
        git fetch --no-tags nsaenz-linux-rpi v3d-enable-v2
        git checkout cc4ec2eab7474381e57d4bbcf3c04595a729859b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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

>> mm/cma.c:504:31: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' [-Wformat]
                          __func__, cma->name, cma->count, ret);
                                               ^~~~~~~~~~
   include/linux/printk.h:343:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   1 warning generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SSB_EMBEDDED
   Depends on SSB && SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE
   Selected by
   - BCM47XX_SSB && BCM47XX


vim +504 mm/cma.c

   415	
   416	/**
   417	 * cma_alloc() - allocate pages from contiguous area
   418	 * @cma:   Contiguous memory region for which the allocation is performed.
   419	 * @count: Requested number of pages.
   420	 * @align: Requested alignment of pages (in PAGE_SIZE order).
   421	 * @no_warn: Avoid printing message about failed allocation
   422	 *
   423	 * This function allocates part of contiguous memory on specific
   424	 * contiguous memory area.
   425	 */
   426	struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
   427			       bool no_warn)
   428	{
   429		unsigned long mask, offset;
   430		unsigned long pfn = -1;
   431		unsigned long start = 0;
   432		unsigned long bitmap_maxno, bitmap_no, bitmap_count;
   433		size_t i;
   434		struct page *page = NULL;
   435		int ret = -ENOMEM;
   436	
   437		if (!cma || !cma->count || !cma->bitmap)
   438			return NULL;
   439	
   440		pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma,
   441			 count, align);
   442	
   443		if (!count)
   444			return NULL;
   445	
   446		mask = cma_bitmap_aligned_mask(cma, align);
   447		offset = cma_bitmap_aligned_offset(cma, align);
   448		bitmap_maxno = cma_bitmap_maxno(cma);
   449		bitmap_count = cma_bitmap_pages_to_bits(cma, count);
   450	
   451		if (bitmap_count > bitmap_maxno)
   452			return NULL;
   453	
   454		for (;;) {
   455			mutex_lock(&cma->lock);
   456			bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap,
   457					bitmap_maxno, start, bitmap_count, mask,
   458					offset);
   459			if (bitmap_no >= bitmap_maxno) {
   460				mutex_unlock(&cma->lock);
   461				break;
   462			}
   463			bitmap_set(cma->bitmap, bitmap_no, bitmap_count);
   464			/*
   465			 * It's safe to drop the lock here. We've marked this region for
   466			 * our exclusive use. If the migration fails we will take the
   467			 * lock again and unmark it.
   468			 */
   469			mutex_unlock(&cma->lock);
   470	
   471			pfn = cma->base_pfn + (bitmap_no << cma->order_per_bit);
   472			ret = alloc_contig_range(pfn, pfn + count, MIGRATE_CMA,
   473					     GFP_KERNEL | (no_warn ? __GFP_NOWARN : 0));
   474	
   475			if (ret == 0) {
   476				page = pfn_to_page(pfn);
   477				break;
   478			}
   479	
   480			cma_clear_bitmap(cma, pfn, count);
   481			if (ret != -EBUSY)
   482				break;
   483	
   484			pr_debug("%s(): memory range at %p is busy, retrying\n",
   485				 __func__, pfn_to_page(pfn));
   486			/* try again with a bit different memory target */
   487			start = bitmap_no + mask + 1;
   488		}
   489	
   490		trace_cma_alloc(pfn, page, count, align);
   491	
   492		/*
   493		 * CMA can allocate multiple page blocks, which results in different
   494		 * blocks being marked with different tags. Reset the tags to ignore
   495		 * those page blocks.
   496		 */
   497		if (page) {
   498			for (i = 0; i < count; i++)
   499				page_kasan_tag_reset(page + i);
   500		}
   501	
   502		if (ret && !no_warn) {
   503			pr_err("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n",
 > 504			       __func__, cma->name, cma->count, ret);
   505			cma_debug_show_areas(cma);
   506		}
   507	
   508		pr_debug("%s(): returned %p\n", __func__, page);
   509		return page;
   510	}
   511	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36299 bytes --]

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

* [nsaenz-linux-rpi:v3d-enable-v2 9566/9840] mm/cma.c:504:31: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long'
@ 2021-02-10 12:31 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-02-10 12:31 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git v3d-enable-v2
head:   7b81f59eac536dd4cbe3eab95904e255f5b291e5
commit: cc4ec2eab7474381e57d4bbcf3c04595a729859b [9566/9840] mm: cma: print region name on failure
config: mips-randconfig-r036-20210209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git/commit/?id=cc4ec2eab7474381e57d4bbcf3c04595a729859b
        git remote add nsaenz-linux-rpi https://git.kernel.org/pub/scm/linux/kernel/git/nsaenz/linux-rpi.git
        git fetch --no-tags nsaenz-linux-rpi v3d-enable-v2
        git checkout cc4ec2eab7474381e57d4bbcf3c04595a729859b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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

>> mm/cma.c:504:31: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' [-Wformat]
                          __func__, cma->name, cma->count, ret);
                                               ^~~~~~~~~~
   include/linux/printk.h:343:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   1 warning generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SSB_EMBEDDED
   Depends on SSB && SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE
   Selected by
   - BCM47XX_SSB && BCM47XX


vim +504 mm/cma.c

   415	
   416	/**
   417	 * cma_alloc() - allocate pages from contiguous area
   418	 * @cma:   Contiguous memory region for which the allocation is performed.
   419	 * @count: Requested number of pages.
   420	 * @align: Requested alignment of pages (in PAGE_SIZE order).
   421	 * @no_warn: Avoid printing message about failed allocation
   422	 *
   423	 * This function allocates part of contiguous memory on specific
   424	 * contiguous memory area.
   425	 */
   426	struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
   427			       bool no_warn)
   428	{
   429		unsigned long mask, offset;
   430		unsigned long pfn = -1;
   431		unsigned long start = 0;
   432		unsigned long bitmap_maxno, bitmap_no, bitmap_count;
   433		size_t i;
   434		struct page *page = NULL;
   435		int ret = -ENOMEM;
   436	
   437		if (!cma || !cma->count || !cma->bitmap)
   438			return NULL;
   439	
   440		pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma,
   441			 count, align);
   442	
   443		if (!count)
   444			return NULL;
   445	
   446		mask = cma_bitmap_aligned_mask(cma, align);
   447		offset = cma_bitmap_aligned_offset(cma, align);
   448		bitmap_maxno = cma_bitmap_maxno(cma);
   449		bitmap_count = cma_bitmap_pages_to_bits(cma, count);
   450	
   451		if (bitmap_count > bitmap_maxno)
   452			return NULL;
   453	
   454		for (;;) {
   455			mutex_lock(&cma->lock);
   456			bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap,
   457					bitmap_maxno, start, bitmap_count, mask,
   458					offset);
   459			if (bitmap_no >= bitmap_maxno) {
   460				mutex_unlock(&cma->lock);
   461				break;
   462			}
   463			bitmap_set(cma->bitmap, bitmap_no, bitmap_count);
   464			/*
   465			 * It's safe to drop the lock here. We've marked this region for
   466			 * our exclusive use. If the migration fails we will take the
   467			 * lock again and unmark it.
   468			 */
   469			mutex_unlock(&cma->lock);
   470	
   471			pfn = cma->base_pfn + (bitmap_no << cma->order_per_bit);
   472			ret = alloc_contig_range(pfn, pfn + count, MIGRATE_CMA,
   473					     GFP_KERNEL | (no_warn ? __GFP_NOWARN : 0));
   474	
   475			if (ret == 0) {
   476				page = pfn_to_page(pfn);
   477				break;
   478			}
   479	
   480			cma_clear_bitmap(cma, pfn, count);
   481			if (ret != -EBUSY)
   482				break;
   483	
   484			pr_debug("%s(): memory range at %p is busy, retrying\n",
   485				 __func__, pfn_to_page(pfn));
   486			/* try again with a bit different memory target */
   487			start = bitmap_no + mask + 1;
   488		}
   489	
   490		trace_cma_alloc(pfn, page, count, align);
   491	
   492		/*
   493		 * CMA can allocate multiple page blocks, which results in different
   494		 * blocks being marked with different tags. Reset the tags to ignore
   495		 * those page blocks.
   496		 */
   497		if (page) {
   498			for (i = 0; i < count; i++)
   499				page_kasan_tag_reset(page + i);
   500		}
   501	
   502		if (ret && !no_warn) {
   503			pr_err("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n",
 > 504			       __func__, cma->name, cma->count, ret);
   505			cma_debug_show_areas(cma);
   506		}
   507	
   508		pr_debug("%s(): returned %p\n", __func__, page);
   509		return page;
   510	}
   511	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36299 bytes --]

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

end of thread, other threads:[~2021-02-10 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 12:31 [nsaenz-linux-rpi:v3d-enable-v2 9566/9840] mm/cma.c:504:31: warning: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' kernel test robot
2021-02-10 12:31 ` kernel test robot

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