linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 7236/13217] arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size
@ 2023-02-16 12:31 kernel test robot
  2023-02-16 14:36 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2023-02-16 12:31 UTC (permalink / raw)
  To: Bob Pearson; +Cc: oe-kbuild-all, Linux Memory Management List, Jason Gunthorpe

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   509583475828c4fd86897113f78315c1431edcc3
commit: 592627ccbdff0ec6fff00fc761142a76db750dd4 [7236/13217] RDMA/rxe: Replace rxe_map and rxe_phys_buf by xarray
config: mips-randconfig-r011-20230214 (https://download.01.org/0day-ci/archive/20230216/202302162019.2WhIRkSA-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 12.1.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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=592627ccbdff0ec6fff00fc761142a76db750dd4
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 592627ccbdff0ec6fff00fc761142a76db750dd4
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302162019.2WhIRkSA-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/mips/include/asm/page.h:270,
                    from arch/mips/include/asm/io.h:29,
                    from include/linux/io.h:13,
                    from arch/mips/include/asm/mips-cps.h:11,
                    from arch/mips/include/asm/smp-ops.h:16,
                    from arch/mips/include/asm/smp.h:21,
                    from include/linux/smp.h:113,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:63,
                    from include/linux/libnvdimm.h:13,
                    from drivers/infiniband/sw/rxe/rxe_mr.c:7:
   drivers/infiniband/sw/rxe/rxe_mr.c: In function 'rxe_set_page':
>> arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     255 | #define virt_to_pfn(kaddr)      PFN_DOWN(virt_to_phys((void *)(kaddr)))
         |                                                       ^
   include/asm-generic/memory_model.h:18:46: note: in definition of macro '__pfn_to_page'
      18 | #define __pfn_to_page(pfn)      (mem_map + ((pfn) - ARCH_PFN_OFFSET))
         |                                              ^~~
   arch/mips/include/asm/page.h:255:33: note: in expansion of macro 'PFN_DOWN'
     255 | #define virt_to_pfn(kaddr)      PFN_DOWN(virt_to_phys((void *)(kaddr)))
         |                                 ^~~~~~~~
   arch/mips/include/asm/page.h:256:45: note: in expansion of macro 'virt_to_pfn'
     256 | #define virt_to_page(kaddr)     pfn_to_page(virt_to_pfn(kaddr))
         |                                             ^~~~~~~~~~~
   drivers/infiniband/sw/rxe/rxe_mr.c:216:29: note: in expansion of macro 'virt_to_page'
     216 |         struct page *page = virt_to_page(iova & mr->page_mask);
         |                             ^~~~~~~~~~~~
   drivers/infiniband/sw/rxe/rxe_mr.c: In function 'rxe_mr_copy_dma':
>> arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     255 | #define virt_to_pfn(kaddr)      PFN_DOWN(virt_to_phys((void *)(kaddr)))
         |                                                       ^
   include/asm-generic/memory_model.h:18:46: note: in definition of macro '__pfn_to_page'
      18 | #define __pfn_to_page(pfn)      (mem_map + ((pfn) - ARCH_PFN_OFFSET))
         |                                              ^~~
   arch/mips/include/asm/page.h:255:33: note: in expansion of macro 'PFN_DOWN'
     255 | #define virt_to_pfn(kaddr)      PFN_DOWN(virt_to_phys((void *)(kaddr)))
         |                                 ^~~~~~~~
   arch/mips/include/asm/page.h:256:45: note: in expansion of macro 'virt_to_pfn'
     256 | #define virt_to_page(kaddr)     pfn_to_page(virt_to_pfn(kaddr))
         |                                             ^~~~~~~~~~~
   drivers/infiniband/sw/rxe/rxe_mr.c:291:24: note: in expansion of macro 'virt_to_page'
     291 |                 page = virt_to_page(iova & mr->page_mask);
         |                        ^~~~~~~~~~~~
   drivers/infiniband/sw/rxe/rxe_mr.c: In function 'rxe_mr_do_atomic_op':
>> arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     255 | #define virt_to_pfn(kaddr)      PFN_DOWN(virt_to_phys((void *)(kaddr)))
         |                                                       ^
   include/asm-generic/memory_model.h:18:46: note: in definition of macro '__pfn_to_page'
      18 | #define __pfn_to_page(pfn)      (mem_map + ((pfn) - ARCH_PFN_OFFSET))
         |                                              ^~~
   arch/mips/include/asm/page.h:255:33: note: in expansion of macro 'PFN_DOWN'
     255 | #define virt_to_pfn(kaddr)      PFN_DOWN(virt_to_phys((void *)(kaddr)))
         |                                 ^~~~~~~~
   arch/mips/include/asm/page.h:256:45: note: in expansion of macro 'virt_to_pfn'
     256 | #define virt_to_page(kaddr)     pfn_to_page(virt_to_pfn(kaddr))
         |                                             ^~~~~~~~~~~
   drivers/infiniband/sw/rxe/rxe_mr.c:484:24: note: in expansion of macro 'virt_to_page'
     484 |                 page = virt_to_page(iova & PAGE_MASK);
         |                        ^~~~~~~~~~~~


vim +255 arch/mips/include/asm/page.h

e53639d8f31397 include/asm-mips/page.h      Ralf Baechle     2006-06-12  254  
37d15948eb7253 arch/mips/include/asm/page.h Florian Fainelli 2017-03-09 @255  #define virt_to_pfn(kaddr)   	PFN_DOWN(virt_to_phys((void *)(kaddr)))
37d15948eb7253 arch/mips/include/asm/page.h Florian Fainelli 2017-03-09  256  #define virt_to_page(kaddr)	pfn_to_page(virt_to_pfn(kaddr))
d3ce88431892b7 arch/mips/include/asm/page.h Ralf Baechle     2012-12-28  257  

:::::: The code at line 255 was first introduced by commit
:::::: 37d15948eb72533757ff352cf6f92dc64daa291f MIPS: page.h: Define virt_to_pfn()

:::::: TO: Florian Fainelli <f.fainelli@gmail.com>
:::::: CC: James Hogan <jhogan@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


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

* Re: [linux-next:master 7236/13217] arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size
  2023-02-16 12:31 [linux-next:master 7236/13217] arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size kernel test robot
@ 2023-02-16 14:36 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2023-02-16 14:36 UTC (permalink / raw)
  To: kernel test robot, linux-rdma
  Cc: Bob Pearson, oe-kbuild-all, Linux Memory Management List

On Thu, Feb 16, 2023 at 08:31:00PM +0800, kernel test robot wrote:

>    drivers/infiniband/sw/rxe/rxe_mr.c: In function 'rxe_set_page':
> >> arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>      255 | #define virt_to_pfn(kaddr)
>      PFN_DOWN(virt_to_phys((void *)(kaddr)))

Er.. Something has gone really wrong along here.

1) The type of DMA mapped addresses is dma_addr_t NOT u64, so things
   like this in ib_sg_to_pages() need fixing:

		u64 dma_addr = sg_dma_address(sg) + sg_offset;
		u64 prev_addr = dma_addr;

2) When ib_uses_virt_dma() == true we should have a function:

   struct page *ib_virt_dma_to_page(dma_addr_t dma_addr)

   That is the inverse of ib_dma_map_page()

   That should be called in all these places. virt_to_phys is being
   used because ib_dma_map_page() called page_address(), but arguably
   this is all wrong and the dma_addr_t should by the phys_addr_t of
   the page and the inverse should be phys_to_page()

Jason


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

end of thread, other threads:[~2023-02-16 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 12:31 [linux-next:master 7236/13217] arch/mips/include/asm/page.h:255:55: warning: cast to pointer from integer of different size kernel test robot
2023-02-16 14:36 ` Jason Gunthorpe

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