lkml.org 
[lkml]   [2020]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] dma-direct: provide the ability to reserve per-numa CMA
Hi Barry,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc2 next-20200625]
[cannot apply to arm64/for-next/core hch-configfs/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Barry-Song/make-dma_alloc_coherent-NUMA-aware-by-per-NUMA-CMA/20200625-154656
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8be3a53e18e0e1a98f288f6c7f5e9da3adbe9c49
config: x86_64-randconfig-s022-20200624 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> kernel/dma/contiguous.c:283:50: sparse: sparse: invalid access below 'dma_contiguous_pernuma_area' (-8 8)

# https://github.com/0day-ci/linux/commit/d6930169a3364418b985c2d19c31ecf1c4c3d4a9
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d6930169a3364418b985c2d19c31ecf1c4c3d4a9
vim +/dma_contiguous_pernuma_area +283 kernel/dma/contiguous.c

de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 253
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 254 /**
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 255 * dma_alloc_contiguous() - allocate contiguous pages
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 256 * @dev: Pointer to device for which the allocation is performed.
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 257 * @size: Requested allocation size.
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 258 * @gfp: Allocation flags.
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 259 *
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 260 * This function allocates contiguous memory buffer for specified device. It
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 261 * tries to use device specific contiguous memory area if available, or it
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 262 * tries to use per-numa cma, if the allocation fails, it will fallback to
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 263 * try default global one.
bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 264 *
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 265 * Note that it bypass one-page size of allocations from the per-numa and
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 266 * global area as the addresses within one page are always contiguous, so
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 267 * there is no need to waste CMA pages for that kind; it also helps reduce
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 268 * fragmentations.
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 269 */
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 270 struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp)
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 271 {
90ae409f9eb3bc kernel/dma/contiguous.c Christoph Hellwig 2019-08-20 272 size_t count = size >> PAGE_SHIFT;
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 273 struct page *page = NULL;
bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 274 struct cma *cma = NULL;
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 275 int nid = dev ? dev_to_node(dev) : NUMA_NO_NODE;
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 276 bool alloc_from_pernuma = false;
bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 277
bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 278 if (dev && dev->cma_area)
bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 279 cma = dev->cma_area;
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 280 else if ((nid != NUMA_NO_NODE) && dma_contiguous_pernuma_area[nid]
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 281 && !(gfp & (GFP_DMA | GFP_DMA32))
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 282 && (count > 1)) {
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 @283 cma = dma_contiguous_pernuma_area[nid];
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 284 alloc_from_pernuma = true;
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 285 } else if (count > 1)
bd2e75633c8012 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 286 cma = dma_contiguous_default_area;
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 287
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 288 /* CMA can be used only in the context which permits sleeping */
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 289 if (cma && gfpflags_allow_blocking(gfp)) {
90ae409f9eb3bc kernel/dma/contiguous.c Christoph Hellwig 2019-08-20 290 size_t align = get_order(size);
c6622a425acd1d kernel/dma/contiguous.c Nicolin Chen 2019-07-26 291 size_t cma_align = min_t(size_t, align, CONFIG_CMA_ALIGNMENT);
c6622a425acd1d kernel/dma/contiguous.c Nicolin Chen 2019-07-26 292
c6622a425acd1d kernel/dma/contiguous.c Nicolin Chen 2019-07-26 293 page = cma_alloc(cma, count, cma_align, gfp & __GFP_NOWARN);
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 294
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 295 /* fall back to default cma if failed in per-numa cma */
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 296 if (!page && alloc_from_pernuma)
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 297 page = cma_alloc(dma_contiguous_default_area, count,
d6930169a33644 kernel/dma/contiguous.c Barry Song 2020-06-25 298 cma_align, gfp & __GFP_NOWARN);
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 299 }
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 300
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 301 return page;
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 302 }
b1d2dc009dece4 kernel/dma/contiguous.c Nicolin Chen 2019-05-23 303

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
\
 
 \ /
  Last update: 2020-06-28 10:59    [W:0.083 / U:5.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site