Re: [PATCH] dma-buf: system_heap: do not warn for costly allocation

From: kernel test robot
Date: Wed Feb 10 2021 - 16:15:54 EST


Hi Minchan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.11-rc7 next-20210125]
[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/Minchan-Kim/dma-buf-system_heap-do-not-warn-for-costly-allocation/20210211-003048
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e0756cfc7d7cd08c98a53b6009c091a3f6a50be6
config: i386-randconfig-s002-20210209 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-215-g0fb77bb6-dirty
# https://github.com/0day-ci/linux/commit/28176611ddc50d5d84aa71679f32b0b22dbf4b1c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Minchan-Kim/dma-buf-system_heap-do-not-warn-for-costly-allocation/20210211-003048
git checkout 28176611ddc50d5d84aa71679f32b0b22dbf4b1c
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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


"sparse warnings: (new ones prefixed by >>)"
>> drivers/dma-buf/heaps/system_heap.c:327:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long gfp_flags @@ got restricted gfp_t @@
drivers/dma-buf/heaps/system_heap.c:327:27: sparse: expected unsigned long gfp_flags
drivers/dma-buf/heaps/system_heap.c:327:27: sparse: got restricted gfp_t
>> drivers/dma-buf/heaps/system_heap.c:329:35: sparse: sparse: invalid assignment: |=
>> drivers/dma-buf/heaps/system_heap.c:329:35: sparse: left side has type unsigned long
>> drivers/dma-buf/heaps/system_heap.c:329:35: sparse: right side has type restricted gfp_t
>> drivers/dma-buf/heaps/system_heap.c:331:36: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected restricted gfp_t [usertype] gfp_mask @@ got unsigned long gfp_flags @@
drivers/dma-buf/heaps/system_heap.c:331:36: sparse: expected restricted gfp_t [usertype] gfp_mask
drivers/dma-buf/heaps/system_heap.c:331:36: sparse: got unsigned long gfp_flags

vim +327 drivers/dma-buf/heaps/system_heap.c

313
314 static struct page *alloc_largest_available(unsigned long size,
315 unsigned int max_order)
316 {
317 struct page *page;
318 unsigned long gfp_flags;
319 int i;
320
321 for (i = 0; i < NUM_ORDERS; i++) {
322 if (size < (PAGE_SIZE << orders[i]))
323 continue;
324 if (max_order < orders[i])
325 continue;
326
> 327 gfp_flags = order_flags[i];
328 if (orders[i] > PAGE_ALLOC_COSTLY_ORDER)
> 329 gfp_flags |= __GFP_NOWARN;
330
> 331 page = alloc_pages(gfp_flags, orders[i]);
332 if (!page)
333 continue;
334 return page;
335 }
336 return NULL;
337 }
338

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip