Hi Christoph,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on nvdimm/libnvdimm-for-next]
[cannot apply to hnaz-mm/master v5.15 next-20211112]
[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]
url:
https://github.com/0day-ci/linux/commits/Christoph-Hellwig/nvdimm-pmem-st...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
519d81956ee277b4419c723adfb154603c2565ba
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
#
https://github.com/0day-ci/linux/commit/52278e5e6fc46f4d71f00c7e068331769...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Christoph-Hellwig/nvdimm-pmem-stop-using-q_usage_count-as-external-pgmap-refcount/20211019-163725
git checkout 52278e5e6fc46f4d71f00c7e068331769b456d19
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/pci/p2pdma.c: In function 'pci_p2pdma_add_resource':
> drivers/pci/p2pdma.c:222:9: error: incompatible type for argument
6 of 'gen_pool_add_owner'
222 | pgmap->ref);
| ~~~~~^~~~~
| |
| struct percpu_ref
In file included from drivers/pci/p2pdma.c:16:
include/linux/genalloc.h:99:22: note: expected 'void *' but argument is of type
'struct percpu_ref'
99 | size_t, int, void *);
| ^~~~~~
vim +/gen_pool_add_owner +222 drivers/pci/p2pdma.c
52916982af48d9 Logan Gunthorpe 2018-10-04 160
52916982af48d9 Logan Gunthorpe 2018-10-04 161 /**
52916982af48d9 Logan Gunthorpe 2018-10-04 162 * pci_p2pdma_add_resource - add memory
for use as p2p memory
52916982af48d9 Logan Gunthorpe 2018-10-04 163 * @pdev: the device to add the memory
to
52916982af48d9 Logan Gunthorpe 2018-10-04 164 * @bar: PCI BAR to add
52916982af48d9 Logan Gunthorpe 2018-10-04 165 * @size: size of the memory to add, may
be zero to use the whole BAR
52916982af48d9 Logan Gunthorpe 2018-10-04 166 * @offset: offset into the PCI BAR
52916982af48d9 Logan Gunthorpe 2018-10-04 167 *
52916982af48d9 Logan Gunthorpe 2018-10-04 168 * The memory will be given ZONE_DEVICE
struct pages so that it may
52916982af48d9 Logan Gunthorpe 2018-10-04 169 * be used with any DMA request.
52916982af48d9 Logan Gunthorpe 2018-10-04 170 */
52916982af48d9 Logan Gunthorpe 2018-10-04 171 int pci_p2pdma_add_resource(struct
pci_dev *pdev, int bar, size_t size,
52916982af48d9 Logan Gunthorpe 2018-10-04 172 u64 offset)
52916982af48d9 Logan Gunthorpe 2018-10-04 173 {
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 174 struct pci_p2pdma_pagemap *p2p_pgmap;
52916982af48d9 Logan Gunthorpe 2018-10-04 175 struct dev_pagemap *pgmap;
ae21f835a5bda0 Eric Dumazet 2021-07-01 176 struct pci_p2pdma *p2pdma;
52916982af48d9 Logan Gunthorpe 2018-10-04 177 void *addr;
52916982af48d9 Logan Gunthorpe 2018-10-04 178 int error;
52916982af48d9 Logan Gunthorpe 2018-10-04 179
52916982af48d9 Logan Gunthorpe 2018-10-04 180 if (!(pci_resource_flags(pdev, bar)
& IORESOURCE_MEM))
52916982af48d9 Logan Gunthorpe 2018-10-04 181 return -EINVAL;
52916982af48d9 Logan Gunthorpe 2018-10-04 182
52916982af48d9 Logan Gunthorpe 2018-10-04 183 if (offset >= pci_resource_len(pdev,
bar))
52916982af48d9 Logan Gunthorpe 2018-10-04 184 return -EINVAL;
52916982af48d9 Logan Gunthorpe 2018-10-04 185
52916982af48d9 Logan Gunthorpe 2018-10-04 186 if (!size)
52916982af48d9 Logan Gunthorpe 2018-10-04 187 size = pci_resource_len(pdev, bar) -
offset;
52916982af48d9 Logan Gunthorpe 2018-10-04 188
52916982af48d9 Logan Gunthorpe 2018-10-04 189 if (size + offset >
pci_resource_len(pdev, bar))
52916982af48d9 Logan Gunthorpe 2018-10-04 190 return -EINVAL;
52916982af48d9 Logan Gunthorpe 2018-10-04 191
52916982af48d9 Logan Gunthorpe 2018-10-04 192 if (!pdev->p2pdma) {
52916982af48d9 Logan Gunthorpe 2018-10-04 193 error = pci_p2pdma_setup(pdev);
52916982af48d9 Logan Gunthorpe 2018-10-04 194 if (error)
52916982af48d9 Logan Gunthorpe 2018-10-04 195 return error;
52916982af48d9 Logan Gunthorpe 2018-10-04 196 }
52916982af48d9 Logan Gunthorpe 2018-10-04 197
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 198 p2p_pgmap =
devm_kzalloc(&pdev->dev, sizeof(*p2p_pgmap), GFP_KERNEL);
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 199 if (!p2p_pgmap)
52916982af48d9 Logan Gunthorpe 2018-10-04 200 return -ENOMEM;
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 201
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 202 pgmap = &p2p_pgmap->pgmap;
a4574f63edc6f7 Dan Williams 2020-10-13 203 pgmap->range.start =
pci_resource_start(pdev, bar) + offset;
a4574f63edc6f7 Dan Williams 2020-10-13 204 pgmap->range.end =
pgmap->range.start + size - 1;
b7b3c01b191596 Dan Williams 2020-10-13 205 pgmap->nr_range = 1;
52916982af48d9 Logan Gunthorpe 2018-10-04 206 pgmap->type =
MEMORY_DEVICE_PCI_P2PDMA;
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 207
0afea3814358c9 Logan Gunthorpe 2019-08-12 208 p2p_pgmap->provider = pdev;
a6e6fe6549f609 Logan Gunthorpe 2019-08-12 209 p2p_pgmap->bus_offset =
pci_bus_address(pdev, bar) -
977196b8c5b20b Logan Gunthorpe 2018-10-04 210 pci_resource_start(pdev, bar);
52916982af48d9 Logan Gunthorpe 2018-10-04 211
52916982af48d9 Logan Gunthorpe 2018-10-04 212 addr =
devm_memremap_pages(&pdev->dev, pgmap);
52916982af48d9 Logan Gunthorpe 2018-10-04 213 if (IS_ERR(addr)) {
52916982af48d9 Logan Gunthorpe 2018-10-04 214 error = PTR_ERR(addr);
50f44ee7248ad2 Dan Williams 2019-06-13 215 goto pgmap_free;
52916982af48d9 Logan Gunthorpe 2018-10-04 216 }
52916982af48d9 Logan Gunthorpe 2018-10-04 217
ae21f835a5bda0 Eric Dumazet 2021-07-01 218 p2pdma =
rcu_dereference_protected(pdev->p2pdma, 1);
ae21f835a5bda0 Eric Dumazet 2021-07-01 219 error =
gen_pool_add_owner(p2pdma->pool, (unsigned long)addr,
52916982af48d9 Logan Gunthorpe 2018-10-04 220 pci_bus_address(pdev, bar) + offset,
a4574f63edc6f7 Dan Williams 2020-10-13 221 range_len(&pgmap->range),
dev_to_node(&pdev->dev),
d0b3517dbcf3f6 Christoph Hellwig 2019-06-26 @222 pgmap->ref);
52916982af48d9 Logan Gunthorpe 2018-10-04 223 if (error)
e615a191216e3f Dan Williams 2019-06-13 224 goto pages_free;
52916982af48d9 Logan Gunthorpe 2018-10-04 225
a4574f63edc6f7 Dan Williams 2020-10-13 226 pci_info(pdev, "added peer-to-peer
DMA memory %#llx-%#llx\n",
a4574f63edc6f7 Dan Williams 2020-10-13 227 pgmap->range.start,
pgmap->range.end);
52916982af48d9 Logan Gunthorpe 2018-10-04 228
52916982af48d9 Logan Gunthorpe 2018-10-04 229 return 0;
52916982af48d9 Logan Gunthorpe 2018-10-04 230
e615a191216e3f Dan Williams 2019-06-13 231 pages_free:
e615a191216e3f Dan Williams 2019-06-13 232 devm_memunmap_pages(&pdev->dev,
pgmap);
52916982af48d9 Logan Gunthorpe 2018-10-04 233 pgmap_free:
d0b3517dbcf3f6 Christoph Hellwig 2019-06-26 234 devm_kfree(&pdev->dev, pgmap);
52916982af48d9 Logan Gunthorpe 2018-10-04 235 return error;
52916982af48d9 Logan Gunthorpe 2018-10-04 236 }
52916982af48d9 Logan Gunthorpe 2018-10-04 237
EXPORT_SYMBOL_GPL(pci_p2pdma_add_resource);
52916982af48d9 Logan Gunthorpe 2018-10-04 238
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org