All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Patrick Daly <pdaly@codeaurora.org>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	Georgi Djakov <georgi.djakov@linaro.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [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'
Date: Wed, 10 Feb 2021 20:31:27 +0800	[thread overview]
Message-ID: <202102102022.ivY5jErX-lkp@intel.com> (raw)

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [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'
Date: Wed, 10 Feb 2021 20:31:27 +0800	[thread overview]
Message-ID: <202102102022.ivY5jErX-lkp@intel.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-02-10 12:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 12:31 kernel test robot [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202102102022.ivY5jErX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=georgi.djakov@linaro.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=pdaly@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.