linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: Tianyu Lan <Tianyu.Lan@microsoft.com>,
	llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, Wei Liu <wei.liu@kernel.org>,
	Michael Kelley <mikelley@microsoft.com>
Subject: Re: [hyperv:hyperv-next 1/5] kernel/dma/swiotlb.c:176:11: warning: format specifies type 'unsigned long long' but the argument has type 'phys_addr_t' (aka 'unsigned int')
Date: Mon, 20 Dec 2021 17:50:06 +0000	[thread overview]
Message-ID: <20211220175006.gfmj3kqmxefuhzbm@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <202112202102.zfnhbn2Q-lkp@intel.com>

On Mon, Dec 20, 2021 at 09:10:04PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git hyperv-next
> head:   63cd06c67a2f46009da6e88ca46f9c7231ab8998
> commit: f16dc95481e2ef2c385008f8b7bd382ea6919ee2 [1/5] swiotlb: Add swiotlb bounce buffer remap function for HV IVM
> config: i386-randconfig-a001-20211219 (https://download.01.org/0day-ci/archive/20211220/202112202102.zfnhbn2Q-lkp@intel.com/config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 683cbc12b33e5c8dc8d29bf5ed79fbf45763aadd)
> 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://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/commit/?id=f16dc95481e2ef2c385008f8b7bd382ea6919ee2
>         git remote add hyperv https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
>         git fetch --no-tags hyperv hyperv-next
>         git checkout f16dc95481e2ef2c385008f8b7bd382ea6919ee2
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash kernel/dma/
> 
> 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 >>):
> 
> >> kernel/dma/swiotlb.c:176:11: warning: format specifies type 'unsigned long long' but the argument has type 'phys_addr_t' (aka 'unsigned int') [-Wformat]
>                                   paddr, bytes);
>                                   ^~~~~
>    include/linux/printk.h:493:33: note: expanded from macro 'pr_err'
>            printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                                   ~~~     ^~~~~~~~~~~
>    include/linux/printk.h:450:60: note: expanded from macro 'printk'
>    #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
>                                                        ~~~    ^~~~~~~~~~~
>    include/linux/printk.h:422:19: note: expanded from macro 'printk_index_wrap'
>                    _p_func(_fmt, ##__VA_ARGS__);                           \
>                            ~~~~    ^~~~~~~~~~~
>    1 warning generated.
> 
> 
> vim +176 kernel/dma/swiotlb.c
> 
>    160	
>    161	/*
>    162	 * Remap swioltb memory in the unencrypted physical address space
>    163	 * when swiotlb_unencrypted_base is set. (e.g. for Hyper-V AMD SEV-SNP
>    164	 * Isolation VMs).
>    165	 */
>    166	static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes)
>    167	{
>    168		void *vaddr = NULL;
>    169	
>    170		if (swiotlb_unencrypted_base) {
>    171			phys_addr_t paddr = mem->start + swiotlb_unencrypted_base;
>    172	
>    173			vaddr = memremap(paddr, bytes, MEMREMAP_WB);
>    174			if (!vaddr)
>    175				pr_err("Failed to map the unencrypted memory %llx size %lx.\n",
>  > 176				       paddr, bytes);

According to printk-format.rst, printing phys_addr_t should use %pa. And
paddr should be passed by reference.

I will fold in the following snippet to the offending patch.

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 1b0501fd3e0e..b36c1cdd0c4f 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -172,8 +172,8 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes)

                vaddr = memremap(paddr, bytes, MEMREMAP_WB);
                if (!vaddr)
-                       pr_err("Failed to map the unencrypted memory %llx size %lx.\n",
-                              paddr, bytes);
+                       pr_err("Failed to map the unencrypted memory %pa size %lx.\n",
+                              &paddr, bytes);
        }

        return vaddr;



>    177		}
>    178	
>    179		return vaddr;
>    180	}
>    181	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

      reply	other threads:[~2021-12-20 17:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 13:10 [hyperv:hyperv-next 1/5] kernel/dma/swiotlb.c:176:11: warning: format specifies type 'unsigned long long' but the argument has type 'phys_addr_t' (aka 'unsigned int') kernel test robot
2021-12-20 17:50 ` Wei Liu [this message]

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=20211220175006.gfmj3kqmxefuhzbm@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mikelley@microsoft.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).