Skip to contentSkip to conversation

drm/radeon/kms: fix indirect buffer management V2

PATCH In review Jerome Glisse 3 participants 4 messages Feb 15, 2010 – Feb 17, 2010

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

PATCH 1/2 drm/radeon/kms: fix indirect buffer management V2

There is 3 different distinct states for an indirect buffer (IB) :
1- free with no fence
2- free with a fence
3- non free (fence doesn't matter)
Previous code mixed case 2 & 3 in a single one leading to possible catastrophique failure. This patch rework the handling and properly separate each case. So when you get ib we set the ib as non free and fence status doesn't matter. Fence become active (ie has a meaning for the ib code) once the ib is scheduled or free. This patch also get rid of the alloc bitmap as it was overkill, we know go through IB pool list like in a ring buffer as the oldest IB is the first one the will be free.

Fix :
https://bugs.freedesktop.org/show_bug.cgi?id=26438
and likely other bugs.

V2 remove the scheduled list, it's useless now, fix free ib scanning

---
 drivers/gpu/drm/radeon/r600_blit_kms.c |    3 -
 drivers/gpu/drm/radeon/radeon.h        |    9 ++-
 drivers/gpu/drm/radeon/radeon_ring.c   |  105 ++++++++++++--------------------
 3 files changed, 45 insertions(+), 72 deletions(-)
drivers/gpu/drm/radeon/r600_blit_kms.c +0 -3
index 2d7d16e..ec49dad 100644
@@ -541,9 +541,6 @@ int r600_vb_ib_get(struct radeon_device *rdev)
 void r600_vb_ib_put(struct radeon_device *rdev)
 {
 	radeon_fence_emit(rdev, rdev->r600_blit.vb_ib->fence);
-	mutex_lock(&rdev->ib_pool.mutex);
-	list_add_tail(&rdev->r600_blit.vb_ib->list, &rdev->ib_pool.scheduled_ibs);
-	mutex_unlock(&rdev->ib_pool.mutex);
 	radeon_ib_free(rdev, &rdev->r600_blit.vb_ib);
 }
 
drivers/gpu/drm/radeon/radeon.h +5 -4
index 993cdf2..9f35bee 100644
@@ -97,6 +97,7 @@ extern int radeon_audio;
  * symbol;
  */
 #define RADEON_MAX_USEC_TIMEOUT		100000	/* 100 ms */
+/* RADEON_IB_POOL_SIZE must be a power of 2 */
 #define RADEON_IB_POOL_SIZE		16
 #define RADEON_DEBUGFS_MAX_NUM_FILES	32
 #define RADEONFB_CONN_LIMIT		4
@@ -371,11 +372,12 @@ void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev);
  */
 struct radeon_ib {
 	struct list_head	list;
-	unsigned long		idx;
+	unsigned		idx;
 	uint64_t		gpu_addr;
 	struct radeon_fence	*fence;
-	uint32_t	*ptr;
+	uint32_t		*ptr;
 	uint32_t		length_dw;
+	bool			free;
 };
 
 /*
@@ -385,11 +387,10 @@ struct radeon_ib {
 struct radeon_ib_pool {
 	struct mutex		mutex;
 	struct radeon_bo	*robj;
-	struct list_head	scheduled_ibs;
 	struct list_head	bogus_ib;
 	struct radeon_ib	ibs[RADEON_IB_POOL_SIZE];
 	bool			ready;
-	DECLARE_BITMAP(alloc_bm, RADEON_IB_POOL_SIZE);
+	unsigned		head_id;
 };
 
 struct radeon_cp {
drivers/gpu/drm/radeon/radeon_ring.c +40 -65

170 lines not on this page · raw message

Signature · 8 lines
1.6.6


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
#1 lore raw
Quoted 13 lines · Jerome Glisse

There is 3 different distinct states for an indirect buffer (IB) :
1- free with no fence
2- free with a fence
3- non free (fence doesn't matter)
Previous code mixed case 2 & 3 in a single one leading to possible catastrophique failure. This patch rework the handling and properly separate each case. So when you get ib we set the ib as non free and fence status doesn't matter. Fence become active (ie has a meaning for the ib code) once the ib is scheduled or free. This patch also get rid of the alloc bitmap as it was overkill, we know go through IB pool list like in a ring buffer as the oldest IB is the first one the will be free.

Quoted 5 lines

Fix :
https://bugs.freedesktop.org/show_bug.cgi?id=26438
and likely other bugs.

V2 remove the scheduled list, it's useless now, fix free ib scanning

Hi,

thank you very much for your fix. It seems I get no more hard lockups. But I have quite a lot of radeon_fence_signaled warnings just after X start. See attachment

I use kernel-2.6.git from Linus with merged drm-radeon-testing. xf86-video-ati git and mesa git. Running KDE 4.4.0 on Gentoo with OpenGL composting turned on.

What could be the issue?

Best regards,

Signature · 8 lines
Ladislav Kunc


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
#2 lore raw
Quoted 28 lines · Ladislav Kunc
Quoted 13 lines · Jerome Glisse

There is 3 different distinct states for an indirect buffer (IB) :
1- free with no fence
2- free with a fence
3- non free (fence doesn't matter)
Previous code mixed case 2 & 3 in a single one leading to possible catastrophique failure. This patch rework the handling and properly separate each case. So when you get ib we set the ib as non free and fence status doesn't matter. Fence become active (ie has a meaning for the ib code) once the ib is scheduled or free. This patch also get rid of the alloc bitmap as it was overkill, we know go through IB pool list like in a ring buffer as the oldest IB is the first one the will be free.

Quoted 5 lines

Fix :
https://bugs.freedesktop.org/show_bug.cgi?id=26438
and likely other bugs.

V2 remove the scheduled list, it's useless now, fix free ib scanning

Hi,

thank you very much for your fix. It seems I get no more hard lockups. But I have quite a lot of radeon_fence_signaled warnings just after X start. See attachment

Quoted 12 lines

I use kernel-2.6.git from Linus with merged drm-radeon-testing. xf86-video-ati git and mesa git. Running KDE 4.4.0 on Gentoo with OpenGL composting turned on.

What could be the issue?

Best regards,

Signature · 1 line
Ladislav Kunc

Did you apply the other patch too ? If yes please attach full kernel log containing the message you saw to a bug and send me bug url

Cheers,
Jerome

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--

#3 lore raw

Dne 17.2.2010 10:36, Jerome Glisse napsal(a):

Quoted 7 lines

Did you apply the other patch too ? If yes please attach full kernel log containing the message you saw to a bug and send me bug url

Cheers,
Jerome

Yes. Applied both of them. Here is the bug url:
https://bugs.freedesktop.org/show_bug.cgi?id=26603

Bye

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--