Skip to contentSkip to conversation

drm/amdgpu: allocate GTT space for shadow VM page tables

PATCH In review Christian König 3 participants 4 messages Sep 16, 2016 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: allocate GTT space for shadow VM page tables

From: Christian König <[email protected]>

We need to access those with the system domain.

Fixes fallout from only allocating GTT space on demand.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +17 -0
index a6a48ed..8928a2a 100644
@@ -552,6 +552,10 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
 	if (r)
 		goto error;
 
+	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+	if (r)
+		goto error;
+
 	addr = amdgpu_bo_gpu_offset(bo);
 	entries = amdgpu_bo_size(bo) / 8;
 
@@ -625,6 +629,11 @@ static int amdgpu_vm_update_pd_or_shadow(struct amdgpu_device *adev,
 
 	if (!pd)
 		return 0;
+
+	r = amdgpu_ttm_bind(&pd->tbo, &pd->tbo.mem);
+	if (r)
+		return r;
+
 	pd_addr = amdgpu_bo_gpu_offset(pd);
 	ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
 
@@ -650,6 +659,14 @@ static int amdgpu_vm_update_pd_or_shadow(struct amdgpu_device *adev,
 		if (bo == NULL)
 			continue;
 
+		if (bo->shadow) {
+			struct amdgpu_bo *shadow = bo->shadow;
+
+			r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem);
+			if (r)
+				return r;
+		}
+
 		pt = amdgpu_bo_gpu_offset(bo);
 		if (!shadow) {
 			if (vm->page_tables[pt_idx].addr == pt)
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1474019288-5770-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw

Does this fix the issue I was seeing since the new memory manager went into thr 4.9-wip branch?

Quoted 58 lines · Christian König,

From: Christian König <[email protected]>

We need to access those with the system domain.

Fixes fallout from only allocating GTT space on demand.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +17 -0
index a6a48ed..8928a2a 100644
@@ -552,6 +552,10 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device
 *adev,
        if (r)
                goto error;
 
+       r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+       if (r)
+               goto error;
+
        addr = amdgpu_bo_gpu_offset(bo);
        entries = amdgpu_bo_size(bo) / 8;
@@ -625,6 +629,11 @@ static int amdgpu_vm_update_pd_or_shadow(struct
 amdgpu_device *adev,
 
        if (!pd)
                return 0;
+
+       r = amdgpu_ttm_bind(&pd->tbo, &pd->tbo.mem);
+       if (r)
+               return r;
+
        pd_addr = amdgpu_bo_gpu_offset(pd);
        ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
@@ -650,6 +659,14 @@ static int amdgpu_vm_update_pd_or_shadow(struct
 amdgpu_device *adev,
                if (bo == NULL)
                        continue;
 
+               if (bo->shadow) {
+                       struct amdgpu_bo *shadow = bo->shadow;
+
+                       r = amdgpu_ttm_bind(&shadow->tbo,
 &shadow->tbo.mem);
+                       if (r)
+                               return r;
+               }
+
                pt = amdgpu_bo_gpu_offset(bo);
                if (!shadow) {
                        if (vm->page_tables[pt_idx].addr == pt)
Quoted 8 lines

--
2.5.0

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAHbf0-EBxKZqwWstQxTYt_=2yy_0e0CGMtnnoZiQ_wFs-0itMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Could be, but possible that I've missed a few other places where GTT is used as well.

What issues where you seeing and are there any backtraces logged? I have a WARN_ON() in the code path which should trigger whenever I missed something.

Christian.

Am 16.09.2016 um 11:55 schrieb Mike Lothian:

Quoted 66 lines

Does this fix the issue I was seeing since the new memory manager went into thr 4.9-wip branch?

On Fri, 16 Sep 2016, 10:48 am Christian König, <[email protected] <mailto:[email protected]>> wrote:

    From: Christian König <[email protected]
    <mailto:[email protected]>>

    We need to access those with the system domain.

    Fixes fallout from only allocating GTT space on demand.

    Signed-off-by: Christian König <[email protected]
    <mailto:[email protected]>>
    ---
     drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 +++++++++++++++++
     1 file changed, 17 insertions(+)

    diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
    b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
    index a6a48ed..8928a2a 100644
    --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
    +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
    @@ -552,6 +552,10 @@ static int amdgpu_vm_clear_bo(struct
    amdgpu_device *adev,
            if (r)
                    goto error;

    +       r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
    +       if (r)
    +               goto error;
    +
            addr = amdgpu_bo_gpu_offset(bo);
            entries = amdgpu_bo_size(bo) / 8;

    @@ -625,6 +629,11 @@ static int
    amdgpu_vm_update_pd_or_shadow(struct amdgpu_device *adev,

            if (!pd)
                    return 0;
    +
    +       r = amdgpu_ttm_bind(&pd->tbo, &pd->tbo.mem);
    +       if (r)
    +               return r;
    +
            pd_addr = amdgpu_bo_gpu_offset(pd);
            ring = container_of(vm->entity.sched, struct amdgpu_ring,
    sched);

    @@ -650,6 +659,14 @@ static int
    amdgpu_vm_update_pd_or_shadow(struct amdgpu_device *adev,
                    if (bo == NULL)
                            continue;

    +               if (bo->shadow) {
    +                       struct amdgpu_bo *shadow = bo->shadow;
    +
    +                       r = amdgpu_ttm_bind(&shadow->tbo,
    &shadow->tbo.mem);
    +                       if (r)
    +                               return r;
    +               }
    +
                    pt = amdgpu_bo_gpu_offset(bo);
                    if (!shadow) {
Quoted 9 lines
                            if (vm->page_tables[pt_idx].addr == pt)
    --
    2.5.0

    _______________________________________________
    amd-gfx mailing list
    [email protected] <mailto:[email protected]>
    https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Alex Deucher
#5 lore raw
In reply to a message not in the archive
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Friday, September 16, 2016 5:48 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: allocate GTT space for shadow VM page tables

Quoted 7 lines

From: Christian König <[email protected]>

We need to access those with the system domain.

Fixes fallout from only allocating GTT space on demand.

Quoted 54 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +17 -0
index a6a48ed..8928a2a 100644
@@ -552,6 +552,10 @@ static int amdgpu_vm_clear_bo(struct
 amdgpu_device *adev,
 	if (r)
 		goto error;
 
+	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+	if (r)
+		goto error;
+
 	addr = amdgpu_bo_gpu_offset(bo);
 	entries = amdgpu_bo_size(bo) / 8;
@@ -625,6 +629,11 @@ static int
 amdgpu_vm_update_pd_or_shadow(struct amdgpu_device *adev,
 
 	if (!pd)
 		return 0;
+
+	r = amdgpu_ttm_bind(&pd->tbo, &pd->tbo.mem);
+	if (r)
+		return r;
+
 	pd_addr = amdgpu_bo_gpu_offset(pd);
 	ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
@@ -650,6 +659,14 @@ static int
 amdgpu_vm_update_pd_or_shadow(struct amdgpu_device *adev,
 		if (bo == NULL)
 			continue;
 
+		if (bo->shadow) {
+			struct amdgpu_bo *shadow = bo->shadow;
+
+			r = amdgpu_ttm_bind(&shadow->tbo, &shadow-
 >tbo.mem);
+			if (r)
+				return r;
+		}
+
 		pt = amdgpu_bo_gpu_offset(bo);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
 		if (!shadow) {
 			if (vm->page_tables[pt_idx].addr == pt)
--

2.5.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx