Skip to contentSkip to conversation

drm/radeon: TTM must be init with cpu-visible VRAM, v2

PATCH Applied Lauri Kasanen 4 participants 7 messages Feb 28, 2014 – Mar 2, 2014

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

PATCH 1/1 drm/radeon: TTM must be init with cpu-visible VRAM, v2

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Doing this has no downsides, as the real VRAM size gets set as soon as the CP engines get init.

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

---
 drivers/gpu/drm/radeon/radeon_ttm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_ttm.c +3 -0
index 3aa853c..b966f85 100644
@@ -715,6 +715,9 @@ int radeon_ttm_init(struct radeon_device *rdev)
 		DRM_ERROR("Failed initializing VRAM heap.\n");
 		return r;
 	}
+	/* Change the size here instead of the init above so only lpfn is affected */
+	radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size);
+
 	r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true,
 			     RADEON_GEM_DOMAIN_VRAM,
 			     NULL, &rdev->stollen_vga_memory);
Signature · 1 line
1.8.3.1
Applied
#1 lore raw
Quoted 6 lines · Lauri Kasanen

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Quoted 8 lines

Doing this has no downsides, as the real VRAM size gets set as soon as the CP engines get init.

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

Applied to my fixes tree. thanks!

Alex

Quoted 25 lines
---
 drivers/gpu/drm/radeon/radeon_ttm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_ttm.c +3 -1
index 3aa853c..b966f85 100644
@@ -715,6 +715,9 @@ int radeon_ttm_init(struct radeon_device *rdev)
                DRM_ERROR("Failed initializing VRAM heap.\n");
                return r;
        }
+       /* Change the size here instead of the init above so only lpfn is affected */
+       radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size);
+
        r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true,
                             RADEON_GEM_DOMAIN_VRAM,
                             NULL, &rdev->stollen_vga_memory);
--

1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Lauri Kasanen

Am 28.02.2014 19:50, schrieb Lauri Kasanen:

Quoted 6 lines

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Quoted 8 lines

Doing this has no downsides, as the real VRAM size gets set as soon as the CP engines get init.

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

And I suggest to add "Cc: [email protected]" as well.

Christian.

Quoted 18 lines
---
  drivers/gpu/drm/radeon/radeon_ttm.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_ttm.c +3 -0
index 3aa853c..b966f85 100644
@@ -715,6 +715,9 @@ int radeon_ttm_init(struct radeon_device *rdev)
  		DRM_ERROR("Failed initializing VRAM heap.\n");
  		return r;
  	}
+	/* Change the size here instead of the init above so only lpfn is affected */
+	radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size);
+
  	r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true,
  			     RADEON_GEM_DOMAIN_VRAM,
  			     NULL, &rdev->stollen_vga_memory);
maintainer
#3 lore raw
Quoted 15 lines · Christian König

Am 28.02.2014 19:50, schrieb Lauri Kasanen:

Quoted 13 lines

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Doing this has no downsides, as the real VRAM size gets set as soon as the CP engines get init.

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

Quoted 8 lines
Quoted 1 line

And I suggest to add "Cc: [email protected]" as well.

Christian.

Won't this create objects that are stuck in the middle of VRAM with the new top down approach?

then when we go to use all the VRAM they'll be pinned in the middle?

Dave.

#4 lore raw
Quoted 16 lines · On Sat, 1 Mar 2014 06:47:41 +1000 Dave Airlie <[email protected]> wrote:
Quoted 14 lines · Christian König

Am 28.02.2014 19:50, schrieb Lauri Kasanen:

Quoted 12 lines

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Doing this has no downsides, as the real VRAM size gets set as soon as the CP engines get init.

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

Quoted 8 lines
Quoted 3 lines

And I suggest to add "Cc: [email protected]" as well.

Won't this create objects that are stuck in the middle of VRAM with the new top down approach?

then when we go to use all the VRAM they'll be pinned in the middle?

Yes, the initial pins would act like that with the top-down code. But the top-down logic is 3.15 material and still WIP.

Depending on their constraints, I think I'll either add a new flag, or turn them into FIXED allocations - do they need to be at exact position foo or only at the beginning. (Christian?)

So sending this fix to stable is safe, as they all use bottom-up.

- Lauri

#5 lore raw

Am 01.03.2014 10:15, schrieb Lauri Kasanen:

Quoted 24 lines
Quoted 21 lines · On Sat, 1 Mar 2014 06:47:41 +1000 Dave Airlie <[email protected]> wrote:
Quoted 11 lines · Christian König

Am 28.02.2014 19:50, schrieb Lauri Kasanen:

Quoted 9 lines

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Doing this has no downsides, as the real VRAM size gets set as soon as the CP engines get init.

Quoted 6 lines
Quoted 3 lines

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

And I suggest to add "Cc: [email protected]" as well.

Won't this create objects that are stuck in the middle of VRAM with the new top down approach?

Quoted 7 lines
Quoted 1 line

then when we go to use all the VRAM they'll be pinned in the middle?

Yes, the initial pins would act like that with the top-down code. But the top-down logic is 3.15 material and still WIP.

Depending on their constraints, I think I'll either add a new flag, or turn them into FIXED allocations - do they need to be at exact position foo or only at the beginning. (Christian?)

AFAIK the stolen VGA memory must be at the very beginning.

The UVD firmware memory block needs to be in the first 256MB, allocated and initialized before all other blocks are started and after used once can't be moved around any more.

I'm not sure about this but we probably have more allocations that assume they end up at the beginning of the address space (GART?).

Christian.

Quoted 4 lines

So sending this fix to stable is safe, as they all use bottom-up.

- Lauri

#6 lore raw
Quoted 41 lines · Christian König

Am 01.03.2014 10:15, schrieb Lauri Kasanen:

Quoted 29 lines
Quoted 26 lines · On Sat, 1 Mar 2014 06:47:41 +1000 Dave Airlie <[email protected]> wrote:
Quoted 13 lines · Christian König

Am 28.02.2014 19:50, schrieb Lauri Kasanen:

Quoted 10 lines

Without this, a bo may get created in the cpu-inaccessible vram. Before the CP engines get setup, all copies are done via cpu memcpy.

This means that the cpu tries to read from inaccessible memory, fails, and the radeon module proceeds to disable acceleration.

Doing this has no downsides, as the real VRAM size gets set as soon as the
CP engines get init.

Quoted 7 lines
Quoted 3 lines

This is a candidate for 3.14 fixes.

v2: Add comment on why the function is used

And I suggest to add "Cc: [email protected]" as well.

Won't this create objects that are stuck in the middle of VRAM with the new top down approach?

Quoted 8 lines
Quoted 1 line

then when we go to use all the VRAM they'll be pinned in the middle?

Yes, the initial pins would act like that with the top-down code. But the top-down logic is 3.15 material and still WIP.

Depending on their constraints, I think I'll either add a new flag, or turn them into FIXED allocations - do they need to be at exact position foo or only at the beginning. (Christian?)

Quoted 9 lines

AFAIK the stolen VGA memory must be at the very beginning.

The UVD firmware memory block needs to be in the first 256MB, allocated and initialized before all other blocks are started and after used once can't be moved around any more.

I'm not sure about this but we probably have more allocations that assume they end up at the beginning of the address space (GART?).

Gart (vmid 0) needs to be in the visible area since we use the CPU to update it.

Alex

Quoted 13 lines

Christian.

Quoted 4 lines

So sending this fix to stable is safe, as they all use bottom-up.

- Lauri

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel