Lines Matching full:nodes
251 struct drm_mm_node nodes[2]; in drm_test_mm_debug() local
253 /* Create a small drm_mm with a couple of nodes and a few holes, and in drm_test_mm_debug()
259 memset(nodes, 0, sizeof(nodes)); in drm_test_mm_debug()
260 nodes[0].start = 512; in drm_test_mm_debug()
261 nodes[0].size = 1024; in drm_test_mm_debug()
262 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_reserve_node(&mm, &nodes[0]), in drm_test_mm_debug()
264 nodes[0].start, nodes[0].size); in drm_test_mm_debug()
266 nodes[1].size = 1024; in drm_test_mm_debug()
267 nodes[1].start = 4096 - 512 - nodes[1].size; in drm_test_mm_debug()
268 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_reserve_node(&mm, &nodes[1]), in drm_test_mm_debug()
270 nodes[0].start, nodes[0].size); in drm_test_mm_debug()
348 struct drm_mm_node tmp, *nodes, *node, *next; in __drm_test_mm_reserve() local
355 * the tree and nodes should be intact. in __drm_test_mm_reserve()
366 nodes = vzalloc(array_size(count, sizeof(*nodes))); in __drm_test_mm_reserve()
367 KUNIT_ASSERT_TRUE(test, nodes); in __drm_test_mm_reserve()
376 nodes[n].start = order[n] * size; in __drm_test_mm_reserve()
377 nodes[n].size = size; in __drm_test_mm_reserve()
379 err = drm_mm_reserve_node(&mm, &nodes[n]); in __drm_test_mm_reserve()
382 n, nodes[n].start); in __drm_test_mm_reserve()
387 if (!drm_mm_node_allocated(&nodes[n])) { in __drm_test_mm_reserve()
389 n, nodes[n].start); in __drm_test_mm_reserve()
393 if (!expect_reserve_fail(test, &mm, &nodes[n])) in __drm_test_mm_reserve()
397 /* After random insertion the nodes should be in order */ in __drm_test_mm_reserve()
408 drm_mm_remove_node(&nodes[order[n]]); in __drm_test_mm_reserve()
409 err = drm_mm_reserve_node(&mm, &nodes[order[n]]); in __drm_test_mm_reserve()
412 n, nodes[n].start); in __drm_test_mm_reserve()
434 node = &nodes[order[(o + m) % count]]; in __drm_test_mm_reserve()
439 node = &nodes[order[(o + m) % count]]; in __drm_test_mm_reserve()
460 vfree(nodes); in __drm_test_mm_reserve()
532 struct drm_mm_node *nodes, *node, *next; in __drm_test_mm_insert() local
536 /* Fill a range with lots of nodes, check it doesn't fail too early */ in __drm_test_mm_insert()
542 nodes = vmalloc(array_size(count, sizeof(*nodes))); in __drm_test_mm_insert()
543 KUNIT_ASSERT_TRUE(test, nodes); in __drm_test_mm_insert()
556 node = replace ? &tmp : &nodes[n]; in __drm_test_mm_insert()
565 drm_mm_replace_node(&tmp, &nodes[n]); in __drm_test_mm_insert()
573 if (!assert_node(test, &nodes[n], &mm, size, 0, n)) { in __drm_test_mm_insert()
580 if (tmp.start != nodes[n].start) { in __drm_test_mm_insert()
583 tmp.start, size, nodes[n].start, nodes[n].size); in __drm_test_mm_insert()
589 /* After random insertion the nodes should be in order */ in __drm_test_mm_insert()
599 u64 addr = nodes[n].start; in __drm_test_mm_insert()
601 drm_mm_remove_node(&nodes[n]); in __drm_test_mm_insert()
602 if (!expect_insert(test, &mm, &nodes[n], size, 0, n, mode)) { in __drm_test_mm_insert()
608 if (nodes[n].start != addr) { in __drm_test_mm_insert()
611 mode->name, n, addr, nodes[n].start); in __drm_test_mm_insert()
622 node = &nodes[order[(o + m) % count]]; in __drm_test_mm_insert()
627 node = &nodes[order[(o + m) % count]]; in __drm_test_mm_insert()
659 vfree(nodes); in __drm_test_mm_insert()
816 struct drm_mm_node *nodes, *node, *next; in __drm_test_mm_insert_range() local
829 nodes = vzalloc(array_size(count, sizeof(*nodes))); in __drm_test_mm_insert_range()
830 KUNIT_ASSERT_TRUE(test, nodes); in __drm_test_mm_insert_range()
840 if (!expect_insert_in_range(test, &mm, &nodes[n], size, size, n, in __drm_test_mm_insert_range()
858 u64 addr = nodes[n].start; in __drm_test_mm_insert_range()
860 drm_mm_remove_node(&nodes[n]); in __drm_test_mm_insert_range()
861 if (!expect_insert_in_range(test, &mm, &nodes[n], size, size, n, in __drm_test_mm_insert_range()
867 if (nodes[n].start != addr) { in __drm_test_mm_insert_range()
870 mode->name, n, addr, nodes[n].start); in __drm_test_mm_insert_range()
894 vfree(nodes); in __drm_test_mm_insert_range()
950 static int prepare_frag(struct kunit *test, struct drm_mm *mm, struct drm_mm_node *nodes, in prepare_frag() argument
957 if (!expect_insert(test, mm, &nodes[i], size, 0, i, mode) != 0) { in prepare_frag()
966 drm_mm_remove_node(&nodes[i]); in prepare_frag()
973 unsigned int num_insert, struct drm_mm_node *nodes, in get_insert_time() argument
982 if (!expect_insert(test, mm, &nodes[i], size, 0, i, mode) != 0) { in get_insert_time()
995 struct drm_mm_node *nodes, *node, *next; in drm_test_mm_frag() local
999 /* We need 4 * insert_size nodes to hold intermediate allocated in drm_test_mm_frag()
1000 * drm_mm nodes. in drm_test_mm_frag()
1005 nodes = vzalloc(array_size(insert_size * 4, sizeof(*nodes))); in drm_test_mm_frag()
1006 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_frag()
1020 if (prepare_frag(test, &mm, nodes, insert_size, mode)) in drm_test_mm_frag()
1024 nodes + insert_size, mode); in drm_test_mm_frag()
1029 nodes + insert_size * 2, mode); in drm_test_mm_frag()
1050 vfree(nodes); in drm_test_mm_frag()
1058 struct drm_mm_node *nodes, *node, *next; in drm_test_mm_align() local
1066 nodes = vzalloc(array_size(max_count, sizeof(*nodes))); in drm_test_mm_align()
1067 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_align()
1077 if (!expect_insert(test, &mm, &nodes[i], size, prime, i, mode)) { in drm_test_mm_align()
1097 vfree(nodes); in drm_test_mm_align()
1187 struct evict_node *nodes, unsigned int *order, unsigned int count, in evict_nodes() argument
1194 e = &nodes[order ? order[i] : i]; in evict_nodes()
1224 "drm_mm_scan_color_evict unexpectedly reported overlapping nodes!\n"); in evict_nodes()
1233 unsigned int total_size, struct evict_node *nodes) in evict_nothing() argument
1243 e = &nodes[n]; in evict_nothing()
1251 e = &nodes[n]; in evict_nothing()
1267 e = &nodes[n]; in evict_nothing()
1275 return assert_continuous(test, mm, nodes[0].node.size); in evict_nothing()
1279 unsigned int total_size, struct evict_node *nodes) in evict_everything() argument
1289 e = &nodes[n]; in evict_everything()
1323 return assert_continuous(test, mm, nodes[0].node.size); in evict_everything()
1327 u64 range_start, u64 range_end, struct evict_node *nodes, in evict_something() argument
1339 if (!evict_nodes(test, &scan, nodes, order, count, false, &evict_list)) in evict_something()
1382 if (!assert_continuous(test, mm, nodes[0].node.size)) { in evict_something()
1396 struct evict_node *nodes; in drm_test_mm_evict() local
1401 * by evicting other nodes in a random order. The drm_mm_scan should in drm_test_mm_evict()
1407 nodes = vzalloc(array_size(size, sizeof(*nodes))); in drm_test_mm_evict()
1408 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_evict()
1416 if (drm_mm_insert_node(&mm, &nodes[n].node, 1)) { in drm_test_mm_evict()
1423 if (!evict_nothing(test, &mm, size, nodes)) { in drm_test_mm_evict()
1427 if (!evict_everything(test, &mm, size, nodes)) { in drm_test_mm_evict()
1435 if (evict_something(test, &mm, 0, U64_MAX, nodes, order, size, n, 1, in drm_test_mm_evict()
1445 if (evict_something(test, &mm, 0, U64_MAX, nodes, order, size, in drm_test_mm_evict()
1460 if (evict_something(test, &mm, 0, U64_MAX, nodes, order, size, in drm_test_mm_evict()
1478 vfree(nodes); in drm_test_mm_evict()
1490 struct evict_node *nodes; in drm_test_mm_evict_range() local
1498 nodes = vzalloc(array_size(size, sizeof(*nodes))); in drm_test_mm_evict_range()
1499 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_evict_range()
1507 if (drm_mm_insert_node(&mm, &nodes[n].node, 1)) { in drm_test_mm_evict_range()
1516 if (evict_something(test, &mm, range_start, range_end, nodes, in drm_test_mm_evict_range()
1527 if (evict_something(test, &mm, range_start, range_end, nodes, in drm_test_mm_evict_range()
1542 if (evict_something(test, &mm, range_start, range_end, nodes, in drm_test_mm_evict_range()
1560 vfree(nodes); in drm_test_mm_evict_range()
1577 struct drm_mm_node *nodes, *node, *next; in drm_test_mm_topdown() local
1585 nodes = vzalloc(array_size(count, sizeof(*nodes))); in drm_test_mm_topdown()
1586 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_topdown()
1599 if (!expect_insert(test, &mm, &nodes[n], size, 0, n, topdown)) { in drm_test_mm_topdown()
1604 if (drm_mm_hole_follows(&nodes[n])) { in drm_test_mm_topdown()
1607 n, nodes[n].start, size); in drm_test_mm_topdown()
1621 node = &nodes[order[(o + m) % count]]; in drm_test_mm_topdown()
1629 node = &nodes[order[(o + m) % count]]; in drm_test_mm_topdown()
1672 vfree(nodes); in drm_test_mm_topdown()
1684 struct drm_mm_node *nodes, *node, *next; in drm_test_mm_bottomup() local
1691 nodes = vzalloc(array_size(count, sizeof(*nodes))); in drm_test_mm_bottomup()
1692 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_bottomup()
1705 if (!expect_insert(test, &mm, &nodes[n], size, 0, n, bottomup)) { in drm_test_mm_bottomup()
1721 node = &nodes[order[(o + m) % count]]; in drm_test_mm_bottomup()
1729 node = &nodes[order[(o + m) % count]]; in drm_test_mm_bottomup()
1764 vfree(nodes); in drm_test_mm_bottomup()
1791 KUNIT_FAIL(test, "Expected a hole after lo and high nodes!\n"); in drm_test_mm_once()
1857 * any two nodes, and so after each insertion we check that those in drm_test_mm_color()
1984 u64 range_end, struct evict_node *nodes, unsigned int *order, in evict_color() argument
1996 if (!evict_nodes(test, &scan, nodes, order, count, true, &evict_list)) in evict_color()
2052 struct evict_node *nodes; in drm_test_mm_color_evict() local
2058 * allow two nodes to be placed together without an intervening hole in drm_test_mm_color_evict()
2062 nodes = vzalloc(array_size(total_size, sizeof(*nodes))); in drm_test_mm_color_evict()
2063 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_color_evict()
2072 if (!expect_insert(test, &mm, &nodes[n].node, in drm_test_mm_color_evict()
2083 if (evict_color(test, &mm, 0, U64_MAX, nodes, order, total_size, in drm_test_mm_color_evict()
2092 if (evict_color(test, &mm, 0, U64_MAX, nodes, order, total_size, in drm_test_mm_color_evict()
2106 if (evict_color(test, &mm, 0, U64_MAX, nodes, order, total_size, in drm_test_mm_color_evict()
2123 vfree(nodes); in drm_test_mm_color_evict()
2136 struct evict_node *nodes; in drm_test_mm_color_evict_range() local
2144 nodes = vzalloc(array_size(total_size, sizeof(*nodes))); in drm_test_mm_color_evict_range()
2145 KUNIT_ASSERT_TRUE(test, nodes); in drm_test_mm_color_evict_range()
2154 if (!expect_insert(test, &mm, &nodes[n].node, in drm_test_mm_color_evict_range()
2165 if (evict_color(test, &mm, range_start, range_end, nodes, order, in drm_test_mm_color_evict_range()
2176 if (evict_color(test, &mm, range_start, range_end, nodes, order, in drm_test_mm_color_evict_range()
2191 if (evict_color(test, &mm, range_start, range_end, nodes, order, in drm_test_mm_color_evict_range()
2209 vfree(nodes); in drm_test_mm_color_evict_range()