Skip to contentSkip to conversation

drm-tip amdgpu not compiling, possible fix attached

PATCH Hans de Goede 2 participants 2 messages Jul 10, 2022 – Jul 11, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi All,

I've been rebasing my backlight refactor on top of drm-tip to submit a new version upstream and I noticed that drm-tip does not compile.

This is caused by a mismerge of:

commit 925b6e59138cefa47275c67891c65d48d3266d57 (drm-misc/for-linux-next-fixes, drm-misc/drm-misc-fixes, drm-misc-fixes)Selvam <[email protected]>
Date: Fri Jul 8 02:30:47 2022 -0700
Revert "drm/amdgpu: add drm buddy support to amdgpu"

This reverts commit c9cad937c0c58618fe5b0310fd539a854dc1ae95.

This is part of a revert of the following commits:
commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")

[WHY]
Few users reported garbaged graphics as soon as x starts, reverting until this can be resolved.

From drm-misc/for-linux-next-fixes / drm-misc-fixes

The attached patch on top of drm-tip fixes the mismerge. Note compile-tested only!

If someone with more rerere experience then me can use this to fix things that would be great.

Regards,

Hans

From 49aacb8d7b29c8d448ce469e66ddb33f8a19e552 Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Sun, 10 Jul 2022 21:27:41 +0200
Subject: [PATCH] fix amdpgu mismerge

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 84 +-------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 62 ---------------
 2 files changed, 2 insertions(+), 144 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +2 -82
index 254954aa983c..0a7611648573 100644
@@ -48,35 +48,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
 	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
 }
 
-static inline struct drm_buddy_block *
-amdgpu_vram_mgr_first_block(struct list_head *list)
-{
-	return list_first_entry_or_null(list, struct drm_buddy_block, link);
-}
-
-static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
-{
-	struct drm_buddy_block *block;
-	u64 start, size;
-
-	block = amdgpu_vram_mgr_first_block(head);
-	if (!block)
-		return false;
-
-	while (head != block->link.next) {
-		start = amdgpu_vram_mgr_block_start(block);
-		size = amdgpu_vram_mgr_block_size(block);
-
-		block = list_entry(block->link.next, struct drm_buddy_block, link);
-		if (start + size != amdgpu_vram_mgr_block_start(block))
-			return false;
-	}
-
-	return true;
-}
-
-
-
 /**
  * DOC: mem_info_vram_total
  *
@@ -485,59 +456,8 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
 	}
 	spin_unlock(&mgr->lock);
 
-	if (cur_size != size) {
-		struct drm_buddy_block *block;
-		struct list_head *trim_list;
-		u64 original_size;
-		LIST_HEAD(temp);
-
-		trim_list = &vres->blocks;
-		original_size = vres->base.num_pages << PAGE_SHIFT;
-
-		/*
-		 * If size value is rounded up to min_block_size, trim the last
-		 * block to the required size
-		 */
-		if (!list_is_singular(&vres->blocks)) {
-			block = list_last_entry(&vres->blocks, typeof(*block), link);
-			list_move_tail(&block->link, &temp);
-			trim_list = &temp;
-			/*
-			 * Compute the original_size value by subtracting the
-			 * last block size with (aligned size - original size)
-			 */
-			original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size);
-		}
-
-		mutex_lock(&mgr->lock);
-		drm_buddy_block_trim(mm,
-				     original_size,
-				     trim_list);
-		mutex_unlock(&mgr->lock);
-
-		if (!list_empty(&temp))
-			list_splice_tail(trim_list, &vres->blocks);
-	}
-
-	vres->base.start = 0;
-	list_for_each_entry(block, &vres->blocks, link) {
-		unsigned long start;
-
-		start = amdgpu_vram_mgr_block_start(block) +
-			amdgpu_vram_mgr_block_size(block);
-		start >>= PAGE_SHIFT;
-
-		if (start > vres->base.num_pages)
-			start -= vres->base.num_pages;
-		else
-			start = 0;
-		vres->base.start = max(vres->base.start, start);
-
-		vis_usage += amdgpu_vram_mgr_vis_size(adev, block);
-	}
-
-	if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks))
-		vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
+	if (i == 1)
+		node->base.placement |= TTM_PL_FLAG_CONTIGUOUS;
 
 	if (adev->gmc.xgmi.connected_to_cpu)
 		node->base.bus.caching = ttm_cached;
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h deleted +0 -62

62 lines not on this page · raw message

Signature · 1 line
2.36.0
#1 lore raw

Hi

Am 10.07.22 um 22:01 schrieb Hans de Goede:

Quoted 22 lines

Hi All,

I've been rebasing my backlight refactor on top of drm-tip to submit a new version upstream and I noticed that drm-tip does not compile.

This is caused by a mismerge of:

commit 925b6e59138cefa47275c67891c65d48d3266d57 (drm-misc/for-linux-next-fixes, drm-misc/drm-misc-fixes, drm-misc-fixes)Selvam <[email protected]>
Date: Fri Jul 8 02:30:47 2022 -0700
Revert "drm/amdgpu: add drm buddy support to amdgpu"

This reverts commit c9cad937c0c58618fe5b0310fd539a854dc1ae95.

This is part of a revert of the following commits:
commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")

[WHY]
Few users reported garbaged graphics as soon as x starts, reverting until this can be resolved.

Quoted 6 lines

From drm-misc/for-linux-next-fixes / drm-misc-fixes

The attached patch on top of drm-tip fixes the mismerge. Note compile-tested only!

Thank you for the workaround. I ran into the same problem yesterday after synchronizing with drm-tip. amdgpu doesn't build on drm-tip.

Best regards
Thomas

Quoted 7 lines

If someone with more rerere experience then me can use this to fix things that would be great.

Regards,

Hans

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev