Message ID | 20241019023716.4516-6-richard.weiyang@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | refine storing NULL | expand |
Hi Wei, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-nonmm-unstable] [also build test WARNING on akpm-mm/mm-everything linus/master v6.12-rc4 next-20241022] [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/Wei-Yang/maple_tree-print-empty-for-an-empty-tree-on-mt_dump/20241019-103832 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable patch link: https://lore.kernel.org/r/20241019023716.4516-6-richard.weiyang%40gmail.com patch subject: [PATCH v4 5/5] maple_tree: add a test checking storing null config: x86_64-randconfig-123-20241022 (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-lkp@intel.com/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-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/202410230105.UApdwd9S-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ lib/test_maple_tree.c:1456:9: sparse: expected void const *entry lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root >> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ lib/test_maple_tree.c:1456:9: sparse: expected void const *entry lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ lib/test_maple_tree.c:1468:9: sparse: expected void const *entry lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ lib/test_maple_tree.c:1468:9: sparse: expected void const *entry lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root vim +1456 lib/test_maple_tree.c 1389 1390 static noinline void __init check_store_null(struct maple_tree *mt) 1391 { 1392 MA_STATE(mas, mt, 0, ULONG_MAX); 1393 1394 /* 1395 * Store NULL at range [0, ULONG_MAX] to an empty tree should result 1396 * in an empty tree 1397 */ 1398 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); 1399 mas_lock(&mas); 1400 mas_store_gfp(&mas, NULL, GFP_KERNEL); 1401 MT_BUG_ON(mt, !mtree_empty(mt)); 1402 mas_unlock(&mas); 1403 mtree_destroy(mt); 1404 1405 /* 1406 * Store NULL at any range to an empty tree should result in an empty 1407 * tree 1408 */ 1409 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); 1410 mas_lock(&mas); 1411 mas_set_range(&mas, 3, 10); 1412 mas_store_gfp(&mas, NULL, GFP_KERNEL); 1413 MT_BUG_ON(mt, !mtree_empty(mt)); 1414 mas_unlock(&mas); 1415 mtree_destroy(mt); 1416 1417 /* 1418 * Store NULL at range [0, ULONG_MAX] to a single entry tree should 1419 * result in an empty tree 1420 */ 1421 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); 1422 mas_lock(&mas); 1423 mas_set(&mas, 0); 1424 mas_store_gfp(&mas, &mas, GFP_KERNEL); 1425 mas_set_range(&mas, 0, ULONG_MAX); 1426 mas_store_gfp(&mas, NULL, GFP_KERNEL); 1427 MT_BUG_ON(mt, !mtree_empty(mt)); 1428 mas_unlock(&mas); 1429 mtree_destroy(mt); 1430 1431 /* 1432 * Store NULL at range [0, n] to a single entry tree should 1433 * result in an empty tree 1434 */ 1435 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); 1436 mas_lock(&mas); 1437 mas_set(&mas, 0); 1438 mas_store_gfp(&mas, &mas, GFP_KERNEL); 1439 mas_set_range(&mas, 0, 5); 1440 mas_store_gfp(&mas, NULL, GFP_KERNEL); 1441 MT_BUG_ON(mt, !mtree_empty(mt)); 1442 mas_unlock(&mas); 1443 mtree_destroy(mt); 1444 1445 /* 1446 * Store NULL at range [m, n] where m > 0 to a single entry tree 1447 * should still be a single entry tree 1448 */ 1449 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); 1450 mas_lock(&mas); 1451 mas_set(&mas, 0); 1452 mas_store_gfp(&mas, &mas, GFP_KERNEL); 1453 mas_set_range(&mas, 2, 5); 1454 mas_store_gfp(&mas, NULL, GFP_KERNEL); 1455 MT_BUG_ON(mt, mtree_empty(mt)); > 1456 MT_BUG_ON(mt, xa_is_node(mt->ma_root)); 1457 mas_unlock(&mas); 1458 mtree_destroy(mt); 1459 1460 /* 1461 * Store NULL at range [0, ULONG_MAX] to a tree with node should 1462 * result in an empty tree 1463 */ 1464 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); 1465 mas_lock(&mas); 1466 mas_set_range(&mas, 1, 3); 1467 mas_store_gfp(&mas, &mas, GFP_KERNEL); 1468 MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); 1469 mas_set_range(&mas, 0, ULONG_MAX); 1470 mas_store_gfp(&mas, NULL, GFP_KERNEL); 1471 MT_BUG_ON(mt, !mtree_empty(mt)); 1472 mas_unlock(&mas); 1473 mtree_destroy(mt); 1474 } 1475
On Wed, Oct 23, 2024 at 01:37:50AM +0800, kernel test robot wrote: >Hi Wei, > >kernel test robot noticed the following build warnings: > >[auto build test WARNING on akpm-mm/mm-nonmm-unstable] >[also build test WARNING on akpm-mm/mm-everything linus/master v6.12-rc4 next-20241022] >[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/Wei-Yang/maple_tree-print-empty-for-an-empty-tree-on-mt_dump/20241019-103832 >base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable >patch link: https://lore.kernel.org/r/20241019023716.4516-6-richard.weiyang%40gmail.com >patch subject: [PATCH v4 5/5] maple_tree: add a test checking storing null >config: x86_64-randconfig-123-20241022 (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-lkp@intel.com/config) >compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) >reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-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/202410230105.UApdwd9S-lkp@intel.com/ > >sparse warnings: (new ones prefixed by >>) >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root > >vim +1456 lib/test_maple_tree.c > > 1389 > 1390 static noinline void __init check_store_null(struct maple_tree *mt) > 1391 { > 1392 MA_STATE(mas, mt, 0, ULONG_MAX); > 1393 > 1394 /* > 1395 * Store NULL at range [0, ULONG_MAX] to an empty tree should result > 1396 * in an empty tree > 1397 */ > 1398 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > 1399 mas_lock(&mas); > 1400 mas_store_gfp(&mas, NULL, GFP_KERNEL); > 1401 MT_BUG_ON(mt, !mtree_empty(mt)); > 1402 mas_unlock(&mas); > 1403 mtree_destroy(mt); > 1404 > 1405 /* > 1406 * Store NULL at any range to an empty tree should result in an empty > 1407 * tree > 1408 */ > 1409 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > 1410 mas_lock(&mas); > 1411 mas_set_range(&mas, 3, 10); > 1412 mas_store_gfp(&mas, NULL, GFP_KERNEL); > 1413 MT_BUG_ON(mt, !mtree_empty(mt)); > 1414 mas_unlock(&mas); > 1415 mtree_destroy(mt); > 1416 > 1417 /* > 1418 * Store NULL at range [0, ULONG_MAX] to a single entry tree should > 1419 * result in an empty tree > 1420 */ > 1421 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > 1422 mas_lock(&mas); > 1423 mas_set(&mas, 0); > 1424 mas_store_gfp(&mas, &mas, GFP_KERNEL); > 1425 mas_set_range(&mas, 0, ULONG_MAX); > 1426 mas_store_gfp(&mas, NULL, GFP_KERNEL); > 1427 MT_BUG_ON(mt, !mtree_empty(mt)); > 1428 mas_unlock(&mas); > 1429 mtree_destroy(mt); > 1430 > 1431 /* > 1432 * Store NULL at range [0, n] to a single entry tree should > 1433 * result in an empty tree > 1434 */ > 1435 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > 1436 mas_lock(&mas); > 1437 mas_set(&mas, 0); > 1438 mas_store_gfp(&mas, &mas, GFP_KERNEL); > 1439 mas_set_range(&mas, 0, 5); > 1440 mas_store_gfp(&mas, NULL, GFP_KERNEL); > 1441 MT_BUG_ON(mt, !mtree_empty(mt)); > 1442 mas_unlock(&mas); > 1443 mtree_destroy(mt); > 1444 > 1445 /* > 1446 * Store NULL at range [m, n] where m > 0 to a single entry tree > 1447 * should still be a single entry tree > 1448 */ > 1449 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > 1450 mas_lock(&mas); > 1451 mas_set(&mas, 0); > 1452 mas_store_gfp(&mas, &mas, GFP_KERNEL); > 1453 mas_set_range(&mas, 2, 5); > 1454 mas_store_gfp(&mas, NULL, GFP_KERNEL); > 1455 MT_BUG_ON(mt, mtree_empty(mt)); >> 1456 MT_BUG_ON(mt, xa_is_node(mt->ma_root)); Thanks. Will fix it to xa_is_node(mas_root(&mas)) in next version. > 1457 mas_unlock(&mas); > 1458 mtree_destroy(mt); > 1459 > 1460 /* > 1461 * Store NULL at range [0, ULONG_MAX] to a tree with node should > 1462 * result in an empty tree > 1463 */ > 1464 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > 1465 mas_lock(&mas); > 1466 mas_set_range(&mas, 1, 3); > 1467 mas_store_gfp(&mas, &mas, GFP_KERNEL); > 1468 MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); > 1469 mas_set_range(&mas, 0, ULONG_MAX); > 1470 mas_store_gfp(&mas, NULL, GFP_KERNEL); > 1471 MT_BUG_ON(mt, !mtree_empty(mt)); > 1472 mas_unlock(&mas); > 1473 mtree_destroy(mt); > 1474 } > 1475 > >-- >0-DAY CI Kernel Test Service >https://github.com/intel/lkp-tests/wiki
* Wei Yang <richard.weiyang@gmail.com> [241018 22:37]: > Add a test to assert that, when storing null to am empty tree or a > single entry tree it will not result into: > > * a root node with range [0, ULONG_MAX] set to NULL > * a root node with consecutive slot set to NULL > > Signed-off-by: Wei Yang <richard.weiyang@gmail.com> > CC: Liam R. Howlett <Liam.Howlett@Oracle.com> > CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> > CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> This patch doesn't apply to the tag you specified or I'm using the wrong git id. I tried git id e993457df. > > --- > v3: move test into lib/test_maple_tree.c > --- > lib/test_maple_tree.c | 90 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 90 insertions(+) > > diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c > index 31561e0e1a0d..2ef72f6c6d1b 100644 > --- a/lib/test_maple_tree.c > +++ b/lib/test_maple_tree.c > @@ -1387,6 +1387,92 @@ static noinline void __init check_prev_entry(struct maple_tree *mt) > mas_unlock(&mas); > } > > +static noinline void __init check_store_null(struct maple_tree *mt) > +{ > + MA_STATE(mas, mt, 0, ULONG_MAX); > + > + /* > + * Store NULL at range [0, ULONG_MAX] to an empty tree should result > + * in an empty tree > + */ > + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > + mas_lock(&mas); > + mas_store_gfp(&mas, NULL, GFP_KERNEL); > + MT_BUG_ON(mt, !mtree_empty(mt)); > + mas_unlock(&mas); > + mtree_destroy(mt); > + > + /* > + * Store NULL at any range to an empty tree should result in an empty > + * tree > + */ > + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > + mas_lock(&mas); > + mas_set_range(&mas, 3, 10); > + mas_store_gfp(&mas, NULL, GFP_KERNEL); > + MT_BUG_ON(mt, !mtree_empty(mt)); > + mas_unlock(&mas); > + mtree_destroy(mt); > + > + /* > + * Store NULL at range [0, ULONG_MAX] to a single entry tree should > + * result in an empty tree > + */ > + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > + mas_lock(&mas); > + mas_set(&mas, 0); > + mas_store_gfp(&mas, &mas, GFP_KERNEL); > + mas_set_range(&mas, 0, ULONG_MAX); > + mas_store_gfp(&mas, NULL, GFP_KERNEL); > + MT_BUG_ON(mt, !mtree_empty(mt)); > + mas_unlock(&mas); > + mtree_destroy(mt); > + > + /* > + * Store NULL at range [0, n] to a single entry tree should > + * result in an empty tree > + */ > + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > + mas_lock(&mas); > + mas_set(&mas, 0); > + mas_store_gfp(&mas, &mas, GFP_KERNEL); > + mas_set_range(&mas, 0, 5); > + mas_store_gfp(&mas, NULL, GFP_KERNEL); > + MT_BUG_ON(mt, !mtree_empty(mt)); > + mas_unlock(&mas); > + mtree_destroy(mt); > + > + /* > + * Store NULL at range [m, n] where m > 0 to a single entry tree > + * should still be a single entry tree > + */ > + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > + mas_lock(&mas); > + mas_set(&mas, 0); > + mas_store_gfp(&mas, &mas, GFP_KERNEL); > + mas_set_range(&mas, 2, 5); > + mas_store_gfp(&mas, NULL, GFP_KERNEL); > + MT_BUG_ON(mt, mtree_empty(mt)); > + MT_BUG_ON(mt, xa_is_node(mt->ma_root)); > + mas_unlock(&mas); > + mtree_destroy(mt); > + > + /* > + * Store NULL at range [0, ULONG_MAX] to a tree with node should > + * result in an empty tree > + */ > + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > + mas_lock(&mas); > + mas_set_range(&mas, 1, 3); > + mas_store_gfp(&mas, &mas, GFP_KERNEL); > + MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); > + mas_set_range(&mas, 0, ULONG_MAX); > + mas_store_gfp(&mas, NULL, GFP_KERNEL); > + MT_BUG_ON(mt, !mtree_empty(mt)); > + mas_unlock(&mas); > + mtree_destroy(mt); > +} > + > static noinline void __init check_root_expand(struct maple_tree *mt) > { > MA_STATE(mas, mt, 0, 0); > @@ -3710,6 +3796,10 @@ static int __init maple_tree_seed(void) > goto skip; > #endif > > + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); > + check_store_null(&tree); > + mtree_destroy(&tree); > + > mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); > check_root_expand(&tree); > mtree_destroy(&tree); > -- > 2.34.1 >
* Liam R. Howlett <Liam.Howlett@oracle.com> [241029 11:17]: > * Wei Yang <richard.weiyang@gmail.com> [241018 22:37]: > > Add a test to assert that, when storing null to am empty tree or a > > single entry tree it will not result into: > > > > * a root node with range [0, ULONG_MAX] set to NULL > > * a root node with consecutive slot set to NULL > > > > Signed-off-by: Wei Yang <richard.weiyang@gmail.com> > > CC: Liam R. Howlett <Liam.Howlett@Oracle.com> > > CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> > > CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> > > This patch doesn't apply to the tag you specified or I'm using the wrong > git id. I tried git id e993457df. It seems okay and looks good. Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
* Wei Yang <richard.weiyang@gmail.com> [241022 19:32]: > On Wed, Oct 23, 2024 at 01:37:50AM +0800, kernel test robot wrote: > >Hi Wei, > > > >kernel test robot noticed the following build warnings: > > > >[auto build test WARNING on akpm-mm/mm-nonmm-unstable] > >[also build test WARNING on akpm-mm/mm-everything linus/master v6.12-rc4 next-20241022] > >[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/Wei-Yang/maple_tree-print-empty-for-an-empty-tree-on-mt_dump/20241019-103832 > >base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable > >patch link: https://lore.kernel.org/r/20241019023716.4516-6-richard.weiyang%40gmail.com > >patch subject: [PATCH v4 5/5] maple_tree: add a test checking storing null > >config: x86_64-randconfig-123-20241022 (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-lkp@intel.com/config) > >compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) > >reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-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/202410230105.UApdwd9S-lkp@intel.com/ > > > >sparse warnings: (new ones prefixed by >>) > >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry > > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root > >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry > > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root > > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry > > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root > > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry > > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root > > > >vim +1456 lib/test_maple_tree.c > > > > 1389 > > 1390 static noinline void __init check_store_null(struct maple_tree *mt) > > 1391 { > > 1392 MA_STATE(mas, mt, 0, ULONG_MAX); > > 1393 > > 1394 /* > > 1395 * Store NULL at range [0, ULONG_MAX] to an empty tree should result > > 1396 * in an empty tree > > 1397 */ > > 1398 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > > 1399 mas_lock(&mas); > > 1400 mas_store_gfp(&mas, NULL, GFP_KERNEL); > > 1401 MT_BUG_ON(mt, !mtree_empty(mt)); > > 1402 mas_unlock(&mas); > > 1403 mtree_destroy(mt); > > 1404 > > 1405 /* > > 1406 * Store NULL at any range to an empty tree should result in an empty > > 1407 * tree > > 1408 */ > > 1409 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > > 1410 mas_lock(&mas); > > 1411 mas_set_range(&mas, 3, 10); > > 1412 mas_store_gfp(&mas, NULL, GFP_KERNEL); > > 1413 MT_BUG_ON(mt, !mtree_empty(mt)); > > 1414 mas_unlock(&mas); > > 1415 mtree_destroy(mt); > > 1416 > > 1417 /* > > 1418 * Store NULL at range [0, ULONG_MAX] to a single entry tree should > > 1419 * result in an empty tree > > 1420 */ > > 1421 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > > 1422 mas_lock(&mas); > > 1423 mas_set(&mas, 0); > > 1424 mas_store_gfp(&mas, &mas, GFP_KERNEL); > > 1425 mas_set_range(&mas, 0, ULONG_MAX); > > 1426 mas_store_gfp(&mas, NULL, GFP_KERNEL); > > 1427 MT_BUG_ON(mt, !mtree_empty(mt)); > > 1428 mas_unlock(&mas); > > 1429 mtree_destroy(mt); > > 1430 > > 1431 /* > > 1432 * Store NULL at range [0, n] to a single entry tree should > > 1433 * result in an empty tree > > 1434 */ > > 1435 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > > 1436 mas_lock(&mas); > > 1437 mas_set(&mas, 0); > > 1438 mas_store_gfp(&mas, &mas, GFP_KERNEL); > > 1439 mas_set_range(&mas, 0, 5); > > 1440 mas_store_gfp(&mas, NULL, GFP_KERNEL); > > 1441 MT_BUG_ON(mt, !mtree_empty(mt)); > > 1442 mas_unlock(&mas); > > 1443 mtree_destroy(mt); > > 1444 > > 1445 /* > > 1446 * Store NULL at range [m, n] where m > 0 to a single entry tree > > 1447 * should still be a single entry tree > > 1448 */ > > 1449 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > > 1450 mas_lock(&mas); > > 1451 mas_set(&mas, 0); > > 1452 mas_store_gfp(&mas, &mas, GFP_KERNEL); > > 1453 mas_set_range(&mas, 2, 5); > > 1454 mas_store_gfp(&mas, NULL, GFP_KERNEL); > > 1455 MT_BUG_ON(mt, mtree_empty(mt)); > >> 1456 MT_BUG_ON(mt, xa_is_node(mt->ma_root)); > > Thanks. > > Will fix it to xa_is_node(mas_root(&mas)) in next version. By the looks of the bot output, there are quite a lot of existing cases of this in the test code. > > > > 1457 mas_unlock(&mas); > > 1458 mtree_destroy(mt); > > 1459 > > 1460 /* > > 1461 * Store NULL at range [0, ULONG_MAX] to a tree with node should > > 1462 * result in an empty tree > > 1463 */ > > 1464 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > > 1465 mas_lock(&mas); > > 1466 mas_set_range(&mas, 1, 3); > > 1467 mas_store_gfp(&mas, &mas, GFP_KERNEL); > > 1468 MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); > > 1469 mas_set_range(&mas, 0, ULONG_MAX); > > 1470 mas_store_gfp(&mas, NULL, GFP_KERNEL); > > 1471 MT_BUG_ON(mt, !mtree_empty(mt)); > > 1472 mas_unlock(&mas); > > 1473 mtree_destroy(mt); > > 1474 } > > 1475 > > > >-- > >0-DAY CI Kernel Test Service > >https://github.com/intel/lkp-tests/wiki > > -- > Wei Yang > Help you, Help me
On Tue, Oct 29, 2024 at 11:29:39AM -0400, Liam R. Howlett wrote: >* Wei Yang <richard.weiyang@gmail.com> [241022 19:32]: >> On Wed, Oct 23, 2024 at 01:37:50AM +0800, kernel test robot wrote: >> >Hi Wei, >> > >> >kernel test robot noticed the following build warnings: >> > >> >[auto build test WARNING on akpm-mm/mm-nonmm-unstable] >> >[also build test WARNING on akpm-mm/mm-everything linus/master v6.12-rc4 next-20241022] >> >[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/Wei-Yang/maple_tree-print-empty-for-an-empty-tree-on-mt_dump/20241019-103832 >> >base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable >> >patch link: https://lore.kernel.org/r/20241019023716.4516-6-richard.weiyang%40gmail.com >> >patch subject: [PATCH v4 5/5] maple_tree: add a test checking storing null >> >config: x86_64-randconfig-123-20241022 (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-lkp@intel.com/config) >> >compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) >> >reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-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/202410230105.UApdwd9S-lkp@intel.com/ >> > >> >sparse warnings: (new ones prefixed by >>) >> >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry >> > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root >> >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry >> > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root >> > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry >> > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root >> > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry >> > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root >> > >> >vim +1456 lib/test_maple_tree.c >> > >> > 1389 >> > 1390 static noinline void __init check_store_null(struct maple_tree *mt) >> > 1391 { >> > 1392 MA_STATE(mas, mt, 0, ULONG_MAX); >> > 1393 >> > 1394 /* >> > 1395 * Store NULL at range [0, ULONG_MAX] to an empty tree should result >> > 1396 * in an empty tree >> > 1397 */ >> > 1398 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> > 1399 mas_lock(&mas); >> > 1400 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> > 1401 MT_BUG_ON(mt, !mtree_empty(mt)); >> > 1402 mas_unlock(&mas); >> > 1403 mtree_destroy(mt); >> > 1404 >> > 1405 /* >> > 1406 * Store NULL at any range to an empty tree should result in an empty >> > 1407 * tree >> > 1408 */ >> > 1409 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> > 1410 mas_lock(&mas); >> > 1411 mas_set_range(&mas, 3, 10); >> > 1412 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> > 1413 MT_BUG_ON(mt, !mtree_empty(mt)); >> > 1414 mas_unlock(&mas); >> > 1415 mtree_destroy(mt); >> > 1416 >> > 1417 /* >> > 1418 * Store NULL at range [0, ULONG_MAX] to a single entry tree should >> > 1419 * result in an empty tree >> > 1420 */ >> > 1421 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> > 1422 mas_lock(&mas); >> > 1423 mas_set(&mas, 0); >> > 1424 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> > 1425 mas_set_range(&mas, 0, ULONG_MAX); >> > 1426 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> > 1427 MT_BUG_ON(mt, !mtree_empty(mt)); >> > 1428 mas_unlock(&mas); >> > 1429 mtree_destroy(mt); >> > 1430 >> > 1431 /* >> > 1432 * Store NULL at range [0, n] to a single entry tree should >> > 1433 * result in an empty tree >> > 1434 */ >> > 1435 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> > 1436 mas_lock(&mas); >> > 1437 mas_set(&mas, 0); >> > 1438 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> > 1439 mas_set_range(&mas, 0, 5); >> > 1440 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> > 1441 MT_BUG_ON(mt, !mtree_empty(mt)); >> > 1442 mas_unlock(&mas); >> > 1443 mtree_destroy(mt); >> > 1444 >> > 1445 /* >> > 1446 * Store NULL at range [m, n] where m > 0 to a single entry tree >> > 1447 * should still be a single entry tree >> > 1448 */ >> > 1449 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> > 1450 mas_lock(&mas); >> > 1451 mas_set(&mas, 0); >> > 1452 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> > 1453 mas_set_range(&mas, 2, 5); >> > 1454 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> > 1455 MT_BUG_ON(mt, mtree_empty(mt)); >> >> 1456 MT_BUG_ON(mt, xa_is_node(mt->ma_root)); >> >> Thanks. >> >> Will fix it to xa_is_node(mas_root(&mas)) in next version. > >By the looks of the bot output, there are quite a lot of existing cases >of this in the test code. > Hi, Liam Thanks for your review. I may not follow you. I saw you add you RB. Do you prefer me to spin a new round with this adjusted or the current version is fine? >> >> >> > 1457 mas_unlock(&mas); >> > 1458 mtree_destroy(mt); >> > 1459 >> > 1460 /* >> > 1461 * Store NULL at range [0, ULONG_MAX] to a tree with node should >> > 1462 * result in an empty tree >> > 1463 */ >> > 1464 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> > 1465 mas_lock(&mas); >> > 1466 mas_set_range(&mas, 1, 3); >> > 1467 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> > 1468 MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); >> > 1469 mas_set_range(&mas, 0, ULONG_MAX); >> > 1470 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> > 1471 MT_BUG_ON(mt, !mtree_empty(mt)); >> > 1472 mas_unlock(&mas); >> > 1473 mtree_destroy(mt); >> > 1474 } >> > 1475 >> > >> >-- >> >0-DAY CI Kernel Test Service >> >https://github.com/intel/lkp-tests/wiki >> >> -- >> Wei Yang >> Help you, Help me
* Wei Yang <richard.weiyang@gmail.com> [241031 04:02]: > On Tue, Oct 29, 2024 at 11:29:39AM -0400, Liam R. Howlett wrote: > >* Wei Yang <richard.weiyang@gmail.com> [241022 19:32]: > >> On Wed, Oct 23, 2024 at 01:37:50AM +0800, kernel test robot wrote: > >> >Hi Wei, > >> > > >> >kernel test robot noticed the following build warnings: > >> > > >> >[auto build test WARNING on akpm-mm/mm-nonmm-unstable] > >> >[also build test WARNING on akpm-mm/mm-everything linus/master v6.12-rc4 next-20241022] > >> >[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/Wei-Yang/maple_tree-print-empty-for-an-empty-tree-on-mt_dump/20241019-103832 > >> >base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable > >> >patch link: https://lore.kernel.org/r/20241019023716.4516-6-richard.weiyang%40gmail.com > >> >patch subject: [PATCH v4 5/5] maple_tree: add a test checking storing null > >> >config: x86_64-randconfig-123-20241022 (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-lkp@intel.com/config) > >> >compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) > >> >reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-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/202410230105.UApdwd9S-lkp@intel.com/ > >> > > >> >sparse warnings: (new ones prefixed by >>) > >> >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > >> > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry > >> > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root > >> >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > >> > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry > >> > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root > >> > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > >> > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry > >> > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root > >> > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ > >> > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry > >> > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root > >> > > >> >vim +1456 lib/test_maple_tree.c > >> > > >> > 1389 > >> > 1390 static noinline void __init check_store_null(struct maple_tree *mt) > >> > 1391 { > >> > 1392 MA_STATE(mas, mt, 0, ULONG_MAX); > >> > 1393 > >> > 1394 /* > >> > 1395 * Store NULL at range [0, ULONG_MAX] to an empty tree should result > >> > 1396 * in an empty tree > >> > 1397 */ > >> > 1398 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > >> > 1399 mas_lock(&mas); > >> > 1400 mas_store_gfp(&mas, NULL, GFP_KERNEL); > >> > 1401 MT_BUG_ON(mt, !mtree_empty(mt)); > >> > 1402 mas_unlock(&mas); > >> > 1403 mtree_destroy(mt); > >> > 1404 > >> > 1405 /* > >> > 1406 * Store NULL at any range to an empty tree should result in an empty > >> > 1407 * tree > >> > 1408 */ > >> > 1409 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > >> > 1410 mas_lock(&mas); > >> > 1411 mas_set_range(&mas, 3, 10); > >> > 1412 mas_store_gfp(&mas, NULL, GFP_KERNEL); > >> > 1413 MT_BUG_ON(mt, !mtree_empty(mt)); > >> > 1414 mas_unlock(&mas); > >> > 1415 mtree_destroy(mt); > >> > 1416 > >> > 1417 /* > >> > 1418 * Store NULL at range [0, ULONG_MAX] to a single entry tree should > >> > 1419 * result in an empty tree > >> > 1420 */ > >> > 1421 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > >> > 1422 mas_lock(&mas); > >> > 1423 mas_set(&mas, 0); > >> > 1424 mas_store_gfp(&mas, &mas, GFP_KERNEL); > >> > 1425 mas_set_range(&mas, 0, ULONG_MAX); > >> > 1426 mas_store_gfp(&mas, NULL, GFP_KERNEL); > >> > 1427 MT_BUG_ON(mt, !mtree_empty(mt)); > >> > 1428 mas_unlock(&mas); > >> > 1429 mtree_destroy(mt); > >> > 1430 > >> > 1431 /* > >> > 1432 * Store NULL at range [0, n] to a single entry tree should > >> > 1433 * result in an empty tree > >> > 1434 */ > >> > 1435 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > >> > 1436 mas_lock(&mas); > >> > 1437 mas_set(&mas, 0); > >> > 1438 mas_store_gfp(&mas, &mas, GFP_KERNEL); > >> > 1439 mas_set_range(&mas, 0, 5); > >> > 1440 mas_store_gfp(&mas, NULL, GFP_KERNEL); > >> > 1441 MT_BUG_ON(mt, !mtree_empty(mt)); > >> > 1442 mas_unlock(&mas); > >> > 1443 mtree_destroy(mt); > >> > 1444 > >> > 1445 /* > >> > 1446 * Store NULL at range [m, n] where m > 0 to a single entry tree > >> > 1447 * should still be a single entry tree > >> > 1448 */ > >> > 1449 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > >> > 1450 mas_lock(&mas); > >> > 1451 mas_set(&mas, 0); > >> > 1452 mas_store_gfp(&mas, &mas, GFP_KERNEL); > >> > 1453 mas_set_range(&mas, 2, 5); > >> > 1454 mas_store_gfp(&mas, NULL, GFP_KERNEL); > >> > 1455 MT_BUG_ON(mt, mtree_empty(mt)); > >> >> 1456 MT_BUG_ON(mt, xa_is_node(mt->ma_root)); > >> > >> Thanks. > >> > >> Will fix it to xa_is_node(mas_root(&mas)) in next version. > > > >By the looks of the bot output, there are quite a lot of existing cases > >of this in the test code. > > > > Hi, Liam > > Thanks for your review. I may not follow you. > > I saw you add you RB. Do you prefer me to spin a new round with this adjusted > or the current version is fine? Please fix what you added. The rest will need to eventually be fixed, but someone can do that later. > > >> > >> > >> > 1457 mas_unlock(&mas); > >> > 1458 mtree_destroy(mt); > >> > 1459 > >> > 1460 /* > >> > 1461 * Store NULL at range [0, ULONG_MAX] to a tree with node should > >> > 1462 * result in an empty tree > >> > 1463 */ > >> > 1464 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); > >> > 1465 mas_lock(&mas); > >> > 1466 mas_set_range(&mas, 1, 3); > >> > 1467 mas_store_gfp(&mas, &mas, GFP_KERNEL); > >> > 1468 MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); > >> > 1469 mas_set_range(&mas, 0, ULONG_MAX); > >> > 1470 mas_store_gfp(&mas, NULL, GFP_KERNEL); > >> > 1471 MT_BUG_ON(mt, !mtree_empty(mt)); > >> > 1472 mas_unlock(&mas); > >> > 1473 mtree_destroy(mt); > >> > 1474 } > >> > 1475 > >> > > >> >-- > >> >0-DAY CI Kernel Test Service > >> >https://github.com/intel/lkp-tests/wiki > >> > >> -- > >> Wei Yang > >> Help you, Help me > > -- > Wei Yang > Help you, Help me
On Thu, Oct 31, 2024 at 07:17:28AM -0400, Liam R. Howlett wrote: >* Wei Yang <richard.weiyang@gmail.com> [241031 04:02]: >> On Tue, Oct 29, 2024 at 11:29:39AM -0400, Liam R. Howlett wrote: >> >* Wei Yang <richard.weiyang@gmail.com> [241022 19:32]: >> >> On Wed, Oct 23, 2024 at 01:37:50AM +0800, kernel test robot wrote: >> >> >Hi Wei, >> >> > >> >> >kernel test robot noticed the following build warnings: >> >> > >> >> >[auto build test WARNING on akpm-mm/mm-nonmm-unstable] >> >> >[also build test WARNING on akpm-mm/mm-everything linus/master v6.12-rc4 next-20241022] >> >> >[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/Wei-Yang/maple_tree-print-empty-for-an-empty-tree-on-mt_dump/20241019-103832 >> >> >base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable >> >> >patch link: https://lore.kernel.org/r/20241019023716.4516-6-richard.weiyang%40gmail.com >> >> >patch subject: [PATCH v4 5/5] maple_tree: add a test checking storing null >> >> >config: x86_64-randconfig-123-20241022 (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-lkp@intel.com/config) >> >> >compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) >> >> >reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410230105.UApdwd9S-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/202410230105.UApdwd9S-lkp@intel.com/ >> >> > >> >> >sparse warnings: (new ones prefixed by >>) >> >> >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> >> > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry >> >> > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root >> >> >>> lib/test_maple_tree.c:1456:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> >> > lib/test_maple_tree.c:1456:9: sparse: expected void const *entry >> >> > lib/test_maple_tree.c:1456:9: sparse: got void [noderef] __rcu *ma_root >> >> > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> >> > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry >> >> > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root >> >> > lib/test_maple_tree.c:1468:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const *entry @@ got void [noderef] __rcu *ma_root @@ >> >> > lib/test_maple_tree.c:1468:9: sparse: expected void const *entry >> >> > lib/test_maple_tree.c:1468:9: sparse: got void [noderef] __rcu *ma_root >> >> > >> >> >vim +1456 lib/test_maple_tree.c >> >> > >> >> > 1389 >> >> > 1390 static noinline void __init check_store_null(struct maple_tree *mt) >> >> > 1391 { >> >> > 1392 MA_STATE(mas, mt, 0, ULONG_MAX); >> >> > 1393 >> >> > 1394 /* >> >> > 1395 * Store NULL at range [0, ULONG_MAX] to an empty tree should result >> >> > 1396 * in an empty tree >> >> > 1397 */ >> >> > 1398 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> >> > 1399 mas_lock(&mas); >> >> > 1400 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> >> > 1401 MT_BUG_ON(mt, !mtree_empty(mt)); >> >> > 1402 mas_unlock(&mas); >> >> > 1403 mtree_destroy(mt); >> >> > 1404 >> >> > 1405 /* >> >> > 1406 * Store NULL at any range to an empty tree should result in an empty >> >> > 1407 * tree >> >> > 1408 */ >> >> > 1409 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> >> > 1410 mas_lock(&mas); >> >> > 1411 mas_set_range(&mas, 3, 10); >> >> > 1412 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> >> > 1413 MT_BUG_ON(mt, !mtree_empty(mt)); >> >> > 1414 mas_unlock(&mas); >> >> > 1415 mtree_destroy(mt); >> >> > 1416 >> >> > 1417 /* >> >> > 1418 * Store NULL at range [0, ULONG_MAX] to a single entry tree should >> >> > 1419 * result in an empty tree >> >> > 1420 */ >> >> > 1421 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> >> > 1422 mas_lock(&mas); >> >> > 1423 mas_set(&mas, 0); >> >> > 1424 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> >> > 1425 mas_set_range(&mas, 0, ULONG_MAX); >> >> > 1426 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> >> > 1427 MT_BUG_ON(mt, !mtree_empty(mt)); >> >> > 1428 mas_unlock(&mas); >> >> > 1429 mtree_destroy(mt); >> >> > 1430 >> >> > 1431 /* >> >> > 1432 * Store NULL at range [0, n] to a single entry tree should >> >> > 1433 * result in an empty tree >> >> > 1434 */ >> >> > 1435 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> >> > 1436 mas_lock(&mas); >> >> > 1437 mas_set(&mas, 0); >> >> > 1438 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> >> > 1439 mas_set_range(&mas, 0, 5); >> >> > 1440 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> >> > 1441 MT_BUG_ON(mt, !mtree_empty(mt)); >> >> > 1442 mas_unlock(&mas); >> >> > 1443 mtree_destroy(mt); >> >> > 1444 >> >> > 1445 /* >> >> > 1446 * Store NULL at range [m, n] where m > 0 to a single entry tree >> >> > 1447 * should still be a single entry tree >> >> > 1448 */ >> >> > 1449 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> >> > 1450 mas_lock(&mas); >> >> > 1451 mas_set(&mas, 0); >> >> > 1452 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> >> > 1453 mas_set_range(&mas, 2, 5); >> >> > 1454 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> >> > 1455 MT_BUG_ON(mt, mtree_empty(mt)); >> >> >> 1456 MT_BUG_ON(mt, xa_is_node(mt->ma_root)); >> >> >> >> Thanks. >> >> >> >> Will fix it to xa_is_node(mas_root(&mas)) in next version. >> > >> >By the looks of the bot output, there are quite a lot of existing cases >> >of this in the test code. >> > >> >> Hi, Liam >> >> Thanks for your review. I may not follow you. >> >> I saw you add you RB. Do you prefer me to spin a new round with this adjusted >> or the current version is fine? > >Please fix what you added. The rest will need to eventually be fixed, >but someone can do that later. > Got it, thanks. >> >> >> >> >> >> >> > 1457 mas_unlock(&mas); >> >> > 1458 mtree_destroy(mt); >> >> > 1459 >> >> > 1460 /* >> >> > 1461 * Store NULL at range [0, ULONG_MAX] to a tree with node should >> >> > 1462 * result in an empty tree >> >> > 1463 */ >> >> > 1464 mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); >> >> > 1465 mas_lock(&mas); >> >> > 1466 mas_set_range(&mas, 1, 3); >> >> > 1467 mas_store_gfp(&mas, &mas, GFP_KERNEL); >> >> > 1468 MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); >> >> > 1469 mas_set_range(&mas, 0, ULONG_MAX); >> >> > 1470 mas_store_gfp(&mas, NULL, GFP_KERNEL); >> >> > 1471 MT_BUG_ON(mt, !mtree_empty(mt)); >> >> > 1472 mas_unlock(&mas); >> >> > 1473 mtree_destroy(mt); >> >> > 1474 } >> >> > 1475 >> >> > >> >> >-- >> >> >0-DAY CI Kernel Test Service >> >> >https://github.com/intel/lkp-tests/wiki >> >> >> >> -- >> >> Wei Yang >> >> Help you, Help me >> >> -- >> Wei Yang >> Help you, Help me
diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 31561e0e1a0d..2ef72f6c6d1b 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -1387,6 +1387,92 @@ static noinline void __init check_prev_entry(struct maple_tree *mt) mas_unlock(&mas); } +static noinline void __init check_store_null(struct maple_tree *mt) +{ + MA_STATE(mas, mt, 0, ULONG_MAX); + + /* + * Store NULL at range [0, ULONG_MAX] to an empty tree should result + * in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at any range to an empty tree should result in an empty + * tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set_range(&mas, 3, 10); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [0, ULONG_MAX] to a single entry tree should + * result in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set(&mas, 0); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + mas_set_range(&mas, 0, ULONG_MAX); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [0, n] to a single entry tree should + * result in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set(&mas, 0); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + mas_set_range(&mas, 0, 5); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [m, n] where m > 0 to a single entry tree + * should still be a single entry tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set(&mas, 0); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + mas_set_range(&mas, 2, 5); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, mtree_empty(mt)); + MT_BUG_ON(mt, xa_is_node(mt->ma_root)); + mas_unlock(&mas); + mtree_destroy(mt); + + /* + * Store NULL at range [0, ULONG_MAX] to a tree with node should + * result in an empty tree + */ + mt_init_flags(mt, MT_FLAGS_ALLOC_RANGE); + mas_lock(&mas); + mas_set_range(&mas, 1, 3); + mas_store_gfp(&mas, &mas, GFP_KERNEL); + MT_BUG_ON(mt, !xa_is_node(mt->ma_root)); + mas_set_range(&mas, 0, ULONG_MAX); + mas_store_gfp(&mas, NULL, GFP_KERNEL); + MT_BUG_ON(mt, !mtree_empty(mt)); + mas_unlock(&mas); + mtree_destroy(mt); +} + static noinline void __init check_root_expand(struct maple_tree *mt) { MA_STATE(mas, mt, 0, 0); @@ -3710,6 +3796,10 @@ static int __init maple_tree_seed(void) goto skip; #endif + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); + check_store_null(&tree); + mtree_destroy(&tree); + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); check_root_expand(&tree); mtree_destroy(&tree);
Add a test to assert that, when storing null to am empty tree or a single entry tree it will not result into: * a root node with range [0, ULONG_MAX] set to NULL * a root node with consecutive slot set to NULL Signed-off-by: Wei Yang <richard.weiyang@gmail.com> CC: Liam R. Howlett <Liam.Howlett@Oracle.com> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> --- v3: move test into lib/test_maple_tree.c --- lib/test_maple_tree.c | 90 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)