Re: [PATCH v2] drivers/base/memory.c: cache blocks in radix tree to accelerate lookup

From: kbuild test robot
Date: Mon Nov 25 2019 - 01:37:32 EST


Hi Scott,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on v5.4]
[cannot apply to next-20191122]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Scott-Cheloha/drivers-base-memory-c-cache-blocks-in-radix-tree-to-accelerate-lookup/20191124-104557
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 0e4a459f56c32d3e52ae69a4b447db2f48a65f44
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-36-g9305d48-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> drivers/base/memory.c:874:9: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void **slot @@ got void [noderef] <asvoid **slot @@
>> drivers/base/memory.c:874:9: sparse: expected void **slot
>> drivers/base/memory.c:874:9: sparse: got void [noderef] <asn:4> **
>> drivers/base/memory.c:874:9: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void **slot @@ got void [noderef] <asvoid **slot @@
>> drivers/base/memory.c:874:9: sparse: expected void **slot
>> drivers/base/memory.c:874:9: sparse: got void [noderef] <asn:4> **
>> drivers/base/memory.c:877:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] <asn:4> **slot @@ got n:4> **slot @@
>> drivers/base/memory.c:877:45: sparse: expected void [noderef] <asn:4> **slot
>> drivers/base/memory.c:877:45: sparse: got void **slot
drivers/base/memory.c:874:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] <asn:4> **slot @@ got n:4> **slot @@
drivers/base/memory.c:874:9: sparse: expected void [noderef] <asn:4> **slot
drivers/base/memory.c:874:9: sparse: got void **slot
>> drivers/base/memory.c:874:9: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void **slot @@ got void [noderef] <asvoid **slot @@
>> drivers/base/memory.c:874:9: sparse: expected void **slot
>> drivers/base/memory.c:874:9: sparse: got void [noderef] <asn:4> **

vim +874 drivers/base/memory.c

845
846 /**
847 * walk_memory_blocks - walk through all present memory blocks overlapped
848 * by the range [start, start + size)
849 *
850 * @start: start address of the memory range
851 * @size: size of the memory range
852 * @arg: argument passed to func
853 * @func: callback for each memory section walked
854 *
855 * This function walks through all present memory blocks overlapped by the
856 * range [start, start + size), calling func on each memory block.
857 *
858 * In case func() returns an error, walking is aborted and the error is
859 * returned.
860 */
861 int walk_memory_blocks(unsigned long start, unsigned long size,
862 void *arg, walk_memory_blocks_func_t func)
863 {
864 struct radix_tree_iter iter;
865 const unsigned long start_block_id = phys_to_block_id(start);
866 const unsigned long end_block_id = phys_to_block_id(start + size - 1);
867 struct memory_block *mem;
868 void **slot;
869 int ret = 0;
870
871 if (!size)
872 return 0;
873
> 874 radix_tree_for_each_slot(slot, &memory_blocks, &iter, start_block_id) {
875 if (iter.index > end_block_id)
876 break;
> 877 mem = radix_tree_deref_slot(slot);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation