Lines Matching full:block

47 			 struct drm_buddy_block *block, bool buddy)  in __dump_block()  argument
49 …kunit_err(test, "block info: header=%llx, state=%u, order=%d, offset=%llx size=%llx root=%d buddy=… in __dump_block()
50 block->header, drm_buddy_block_state(block), in __dump_block()
51 drm_buddy_block_order(block), drm_buddy_block_offset(block), in __dump_block()
52 drm_buddy_block_size(mm, block), !block->parent, buddy); in __dump_block()
56 struct drm_buddy_block *block) in dump_block() argument
60 __dump_block(test, mm, block, false); in dump_block()
62 buddy = drm_get_buddy(block); in dump_block()
68 struct drm_buddy_block *block) in check_block() argument
76 block_state = drm_buddy_block_state(block); in check_block()
80 kunit_err(test, "block state mismatch\n"); in check_block()
84 block_size = drm_buddy_block_size(mm, block); in check_block()
85 offset = drm_buddy_block_offset(block); in check_block()
88 kunit_err(test, "block size smaller than min size\n"); in check_block()
94 kunit_err(test, "block size not power of two\n"); in check_block()
99 kunit_err(test, "block size not aligned to min size\n"); in check_block()
104 kunit_err(test, "block offset not aligned to min size\n"); in check_block()
109 kunit_err(test, "block offset not aligned to block size\n"); in check_block()
113 buddy = drm_get_buddy(block); in check_block()
115 if (!buddy && block->parent) { in check_block()
133 kunit_err(test, "block and its buddy are free\n"); in check_block()
144 struct drm_buddy_block *block; in check_blocks() local
149 block = NULL; in check_blocks()
153 list_for_each_entry(block, blocks, link) { in check_blocks()
154 err = check_block(test, mm, block); in check_blocks()
156 if (!drm_buddy_block_is_allocated(block)) { in check_blocks()
157 kunit_err(test, "block not allocated\n"); in check_blocks()
168 offset = drm_buddy_block_offset(block); in check_blocks()
171 kunit_err(test, "block offset mismatch\n"); in check_blocks()
179 total += drm_buddy_block_size(mm, block); in check_blocks()
180 prev = block; in check_blocks()
193 kunit_err(test, "prev block, dump:\n"); in check_blocks()
197 kunit_err(test, "bad block, dump:\n"); in check_blocks()
198 dump_block(test, mm, block); in check_blocks()
227 struct drm_buddy_block *block; in check_mm() local
268 block = list_first_entry_or_null(&mm->free_list[order], in check_mm()
270 if (block != root) { in check_mm()
328 struct drm_buddy_block *block; in drm_test_buddy_alloc_pathological() local
340 * page left. Free the largest block, then whittle down again. in drm_test_buddy_alloc_pathological()
351 /* Make room by freeing the largest allocated block */ in drm_test_buddy_alloc_pathological()
352 block = list_first_entry_or_null(&blocks, typeof(*block), link); in drm_test_buddy_alloc_pathological()
353 if (block) { in drm_test_buddy_alloc_pathological()
354 list_del(&block->link); in drm_test_buddy_alloc_pathological()
355 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pathological()
366 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_pathological()
367 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_pathological()
369 list_move_tail(&block->link, &blocks); in drm_test_buddy_alloc_pathological()
378 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_pathological()
379 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_pathological()
381 list_move_tail(&block->link, &holes); in drm_test_buddy_alloc_pathological()
426 struct drm_buddy_block *block; in drm_test_buddy_alloc_smoke() local
461 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_smoke()
462 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_smoke()
464 list_move_tail(&block->link, &blocks); in drm_test_buddy_alloc_smoke()
465 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_order(block), order, in drm_test_buddy_alloc_smoke()
468 total += drm_buddy_block_size(&mm, block); in drm_test_buddy_alloc_smoke()
499 struct drm_buddy_block *block, *bn; in drm_test_buddy_alloc_pessimistic() local
526 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_pessimistic()
527 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_pessimistic()
529 list_move_tail(&block->link, &blocks); in drm_test_buddy_alloc_pessimistic()
532 /* And now the last remaining block available */ in drm_test_buddy_alloc_pessimistic()
538 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_pessimistic()
539 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_pessimistic()
541 list_move_tail(&block->link, &blocks); in drm_test_buddy_alloc_pessimistic()
551 block = list_last_entry(&blocks, typeof(*block), link); in drm_test_buddy_alloc_pessimistic()
552 list_del(&block->link); in drm_test_buddy_alloc_pessimistic()
553 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
557 list_for_each_entry_safe(block, bn, &blocks, link) { in drm_test_buddy_alloc_pessimistic()
558 list_del(&block->link); in drm_test_buddy_alloc_pessimistic()
559 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
567 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_pessimistic()
568 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_pessimistic()
570 list_del(&block->link); in drm_test_buddy_alloc_pessimistic()
571 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
582 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_pessimistic()
583 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_pessimistic()
585 list_del(&block->link); in drm_test_buddy_alloc_pessimistic()
586 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
594 struct drm_buddy_block *block; in drm_test_buddy_alloc_optimistic() local
603 * Create a mm with one block of each order available, and in drm_test_buddy_alloc_optimistic()
621 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_optimistic()
622 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_blocks has no blocks\n"); in drm_test_buddy_alloc_optimistic()
624 list_move_tail(&block->link, &blocks); in drm_test_buddy_alloc_optimistic()
657 struct drm_buddy_block *block; in drm_test_buddy_alloc_range() local
668 block = list_first_entry_or_null(&tmp, struct drm_buddy_block, link); in drm_test_buddy_alloc_range()
669 KUNIT_ASSERT_TRUE_MSG(test, block, "alloc_range has no blocks\n"); in drm_test_buddy_alloc_range()
671 KUNIT_ASSERT_EQ_MSG(test, drm_buddy_block_offset(block), offset, in drm_test_buddy_alloc_range()
673 drm_buddy_block_offset(block), offset); in drm_test_buddy_alloc_range()
698 struct drm_buddy_block *block; in drm_test_buddy_alloc_limit() local
713 block = list_first_entry_or_null(&allocated, struct drm_buddy_block, link); in drm_test_buddy_alloc_limit()
714 KUNIT_EXPECT_TRUE(test, block); in drm_test_buddy_alloc_limit()
716 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_order(block), mm.max_order, in drm_test_buddy_alloc_limit()
717 "block order(%d) != %d\n", in drm_test_buddy_alloc_limit()
718 drm_buddy_block_order(block), mm.max_order); in drm_test_buddy_alloc_limit()
720 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_size(&mm, block), in drm_test_buddy_alloc_limit()
722 "block size(%llu) != %llu\n", in drm_test_buddy_alloc_limit()
723 drm_buddy_block_size(&mm, block), in drm_test_buddy_alloc_limit()