Re: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h

kernel test robot
2024-02-17T19:14:27Z

Hi Max,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853
base: next-20240215
patch link: https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com
patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240218/202402180247.nziZ7rAH-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240218/202402180247.nziZ7rAH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402180247.nziZ7rAH-lkp@intel.com/

All warnings (new ones prefixed by >>):

In file included from include/linux/kfifo.h:42,
from include/linux/tty_port.h:5,
from include/linux/tty.h:12,
from lib/bust_spinlocks.c:15:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
cc1: some warnings being treated as errors
--
In file included from include/linux/kfifo.h:42,
from lib/kfifo.c:14:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
lib/kfifo.c: In function 'setup_sgl_buf':
>> lib/kfifo.c:310:14: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
310 | page = virt_to_page(buf);
| ^
lib/kfifo.c:319:23: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
319 | npage = virt_to_page(buf);
| ^
cc1: some warnings being treated as errors
--
In file included from include/linux/dmapool.h:14,
from include/linux/pci.h:1654,
from lib/iomap.c:7:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
In file included from include/linux/pci.h:2688:
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
lib/iomap.c: At top level:
lib/iomap.c:156:5: warning: no previous prototype for 'ioread64_lo_hi' [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
lib/iomap.c:163:5: warning: no previous prototype for 'ioread64_hi_lo' [-Wmissing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
lib/iomap.c:170:5: warning: no previous prototype for 'ioread64be_lo_hi' [-Wmissing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
lib/iomap.c:178:5: warning: no previous prototype for 'ioread64be_hi_lo' [-Wmissing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
lib/iomap.c:264:6: warning: no previous prototype for 'iowrite64_lo_hi' [-Wmissing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
lib/iomap.c:272:6: warning: no previous prototype for 'iowrite64_hi_lo' [-Wmissing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
lib/iomap.c:280:6: warning: no previous prototype for 'iowrite64be_lo_hi' [-Wmissing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
lib/iomap.c:288:6: warning: no previous prototype for 'iowrite64be_hi_lo' [-Wmissing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/virtio.h:7,
from arch/um/drivers/virtio_uml.c:27:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
In file included from include/linux/virtio.h:12:
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
In file included from arch/um/include/asm/thread_info.h:15,
from include/linux/thread_info.h:60,
from include/asm-generic/preempt.h:5,
from ./arch/um/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from include/linux/spinlock.h:56,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from arch/um/drivers/virtio_uml.c:23:
arch/um/drivers/virtio_uml.c: In function 'vhost_user_set_mem_table':
arch/um/drivers/virtio_uml.c:678:54: error: 'end_iomem' undeclared (first use in this function)
678 | rc = vhost_user_init_mem_region(__pa(end_iomem), highmem,
| ^~~~~~~~~
arch/um/include/asm/page.h:105:58: note: in definition of macro '__pa'
105 | #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
| ^~~~
arch/um/drivers/virtio_uml.c:678:54: note: each undeclared identifier is reported only once for each function it appears in
678 | rc = vhost_user_init_mem_region(__pa(end_iomem), highmem,
| ^~~~~~~~~
arch/um/include/asm/page.h:105:58: note: in definition of macro '__pa'
105 | #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
| ^~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/dmapool.h:14,
from include/linux/pci.h:1654,
from arch/um/drivers/virt-pci.c:7:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
In file included from include/linux/pci.h:2688:
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/dma-mapping.h:11,
from include/linux/comedi/comedidev.h:13,
from drivers/comedi/comedi_buf.c:12:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
drivers/comedi/comedi_buf.c: In function 'comedi_buf_map_kref_release':
>> drivers/comedi/comedi_buf.c:41:51: warning: passing argument 1 of 'ClearPageReserved' makes pointer from integer without a cast [-Wint-conversion]
41 | ClearPageReserved(virt_to_page(buf->virt_addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from include/linux/mmzone.h:23,
from include/linux/gfp.h:7,
from include/linux/slab.h:16,
from drivers/comedi/comedi_buf.c:11:
include/linux/page-flags.h:390:59: note: expected 'struct page *' but argument is of type 'int'
390 | static __always_inline void ClearPage##uname(struct page *page) \
| ~~~~~~~~~~~~~^~~~
include/linux/page-flags.h:424:9: note: in expansion of macro 'CLEARPAGEFLAG'
424 | CLEARPAGEFLAG(uname, lname, policy)
| ^~~~~~~~~~~~~
include/linux/page-flags.h:492:1: note: in expansion of macro 'PAGEFLAG'
492 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
| ^~~~~~~~
drivers/comedi/comedi_buf.c: In function 'comedi_buf_map_alloc':
>> drivers/comedi/comedi_buf.c:124:41: warning: passing argument 1 of 'SetPageReserved' makes pointer from integer without a cast [-Wint-conversion]
124 | SetPageReserved(virt_to_page(buf->virt_addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/page-flags.h:383:57: note: expected 'struct page *' but argument is of type 'int'
383 | static __always_inline void SetPage##uname(struct page *page) \
| ~~~~~~~~~~~~~^~~~
include/linux/page-flags.h:423:9: note: in expansion of macro 'SETPAGEFLAG'
423 | SETPAGEFLAG(uname, lname, policy) \
| ^~~~~~~~~~~
include/linux/page-flags.h:492:1: note: in expansion of macro 'PAGEFLAG'
492 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
| ^~~~~~~~
drivers/comedi/comedi_buf.c: In function '__comedi_buf_alloc':
>> drivers/comedi/comedi_buf.c:178:34: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
178 | pages[i] = virt_to_page(buf->virt_addr);
| ^
drivers/comedi/comedi_buf.c:18:41: error: 'PAGE_KERNEL' undeclared (first use in this function)
18 | #define COMEDI_PAGE_PROTECTION PAGE_KERNEL
| ^~~~~~~~~~~
drivers/comedi/comedi_buf.c:183:44: note: in expansion of macro 'COMEDI_PAGE_PROTECTION'
183 | COMEDI_PAGE_PROTECTION);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/comedi/comedi_buf.c:18:41: note: each undeclared identifier is reported only once for each function it appears in
18 | #define COMEDI_PAGE_PROTECTION PAGE_KERNEL
| ^~~~~~~~~~~
drivers/comedi/comedi_buf.c:183:44: note: in expansion of macro 'COMEDI_PAGE_PROTECTION'
183 | COMEDI_PAGE_PROTECTION);
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
..

vim +/sg_set_page +189 include/linux/scatterlist.h

82f66fbef58de4 Jens Axboe 2007-10-22 175
18dabf473e1585 Jens Axboe 2007-10-22 176 /**
18dabf473e1585 Jens Axboe 2007-10-22 177 * sg_set_buf - Set sg entry to point at given data
18dabf473e1585 Jens Axboe 2007-10-22 178 * @sg: SG entry
18dabf473e1585 Jens Axboe 2007-10-22 179 * @buf: Data
18dabf473e1585 Jens Axboe 2007-10-22 180 * @buflen: Data length
18dabf473e1585 Jens Axboe 2007-10-22 181 *
18dabf473e1585 Jens Axboe 2007-10-22 182 **/
82f66fbef58de4 Jens Axboe 2007-10-22 183 static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
d32311fed70d12 Herbert Xu 2005-09-17 184 unsigned int buflen)
d32311fed70d12 Herbert Xu 2005-09-17 185 {
ac4e97abce9b80 Rusty Russell 2013-05-30 186 #ifdef CONFIG_DEBUG_SG
ac4e97abce9b80 Rusty Russell 2013-05-30 187 BUG_ON(!virt_addr_valid(buf));
ac4e97abce9b80 Rusty Russell 2013-05-30 188 #endif
642f149031d704 Jens Axboe 2007-10-24 @189 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
d32311fed70d12 Herbert Xu 2005-09-17 190 }
d32311fed70d12 Herbert Xu 2005-09-17 191

--
0-DAY CI Kernel Test Service