drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c:139:9: sparse: sparse: cast removes address space '__rcu' of expression
From: kernel test robot
Date: Thu Jun 11 2026 - 11:16:34 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9716c086c8e8b141d35aa61f2e96a2e83de212a7
commit: df75430515c33ece3de46562f917acd9792505ad drm: fix dead default for DRM_TTM_KUNIT_TEST
date: 3 months ago
config: parisc-randconfig-r113-20260611 (https://download.01.org/0day-ci/archive/20260611/202606112339.NhNq32KS-lkp@xxxxxxxxx/config)
compiler: hppa-linux-gcc (GCC) 9.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260611/202606112339.NhNq32KS-lkp@xxxxxxxxx/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
| Fixes: df75430515c3 ("drm: fix dead default for DRM_TTM_KUNIT_TEST")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606112339.NhNq32KS-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c:139:9: sparse: sparse: cast removes address space '__rcu' of expression
>> drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c:139:9: sparse: sparse: cast removes address space '__rcu' of expression
vim +/__rcu +139 drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 100
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 101 KUNIT_ARRAY_PARAM(ttm_bo_types, ttm_bo_type_cases,
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 102 ttm_bo_validate_case_desc);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 103
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 104 static void ttm_bo_init_reserved_sys_man(struct kunit *test)
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 105 {
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 106 const struct ttm_bo_validate_test_case *params = test->param_value;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 107 struct ttm_test_devices *priv = test->priv;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 108 enum ttm_bo_type bo_type = params->bo_type;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 109 u32 size = ALIGN(BO_SIZE, PAGE_SIZE);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 110 struct ttm_operation_ctx ctx = { };
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 111 struct ttm_placement *placement;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 112 struct ttm_buffer_object *bo;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 113 struct ttm_place *place;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 114 int err;
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 115
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 116 bo = kunit_kzalloc(test, sizeof(*bo), GFP_KERNEL);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 117 KUNIT_ASSERT_NOT_NULL(test, bo);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 118
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 119 place = ttm_place_kunit_init(test, TTM_PL_SYSTEM, 0);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 120 placement = ttm_placement_kunit_init(test, place, 1);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 121
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 122 drm_gem_private_object_init(priv->drm, &bo->base, size);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 123
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 124 err = ttm_bo_init_reserved(priv->ttm_dev, bo, bo_type, placement,
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 125 PAGE_SIZE, &ctx, NULL, NULL,
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 126 &dummy_ttm_bo_destroy);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 127 dma_resv_unlock(bo->base.resv);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 128
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 129 KUNIT_EXPECT_EQ(test, err, 0);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 130 KUNIT_EXPECT_EQ(test, kref_read(&bo->kref), 1);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 131 KUNIT_EXPECT_PTR_EQ(test, bo->bdev, priv->ttm_dev);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 132 KUNIT_EXPECT_EQ(test, bo->type, bo_type);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 133 KUNIT_EXPECT_EQ(test, bo->page_alignment, PAGE_SIZE);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 134 KUNIT_EXPECT_PTR_EQ(test, bo->destroy, &dummy_ttm_bo_destroy);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 135 KUNIT_EXPECT_EQ(test, bo->pin_count, 0);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 136 KUNIT_EXPECT_NULL(test, bo->bulk_move);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 137 KUNIT_EXPECT_NOT_NULL(test, bo->ttm);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 138 KUNIT_EXPECT_FALSE(test, ttm_tt_is_populated(bo->ttm));
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 @139 KUNIT_EXPECT_NOT_NULL(test, (void *)bo->base.resv->fences);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 140 KUNIT_EXPECT_EQ(test, ctx.bytes_moved, size);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 141
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 142 if (bo_type != ttm_bo_type_kernel)
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 143 KUNIT_EXPECT_TRUE(test,
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 144 drm_mm_node_allocated(&bo->base.vma_node.vm_node));
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 145
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 146 ttm_resource_free(bo, &bo->resource);
ed7a4397f55bfa Christian König 2025-06-13 147 ttm_bo_fini(bo);
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 148 }
8bd1ff5ddc7bcc Karolina Stolarek 2024-06-12 149
:::::: The code at line 139 was first introduced by commit
:::::: 8bd1ff5ddc7bccabf5be7cf540b9af8d5f968866 drm/ttm/tests: Test simple BO creation and validation
:::::: TO: Karolina Stolarek <karolina.stolarek@xxxxxxxxx>
:::::: CC: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki