Skip to contentSkip to conversation

drm7amdgpu: once more fix amdgpu_bo_create_kernel_at

PATCH In review Christian König 3 participants 5 messages Sep 24, 2019 – Sep 25, 2019 3 messages not in the archive

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

PATCH 1/1 drm7amdgpu: once more fix amdgpu_bo_create_kernel_at

When CPU access is needed we should tell that to amdgpu_bo_create_reserved() or otherwise the access is denied later on.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +6 -3
index 12d2adcdf14e..f10b6175e20c 100644
@@ -369,7 +369,7 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
 	size = ALIGN(size, PAGE_SIZE);
 
 	r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain, bo_ptr,
-				      NULL, NULL);
+				      NULL, cpu_addr);
 	if (r)
 		return r;
 
@@ -377,12 +377,15 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
 	 * Remove the original mem node and create a new one at the request
 	 * position.
 	 */
+	if (cpu_addr)
+		amdgpu_bo_kunmap(*bo_ptr);
+
+	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
+
 	for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
 		(*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
 		(*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
 	}
-
-	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
 	r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
 			     &(*bo_ptr)->tbo.mem, &ctx);
 	if (r)
Signature · 6 lines
2.14.1

_______________________________________________
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): 20190924115624.10949-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 5 lines · Christian König

When CPU access is needed we should tell that to amdgpu_bo_create_reserved() or otherwise the access is denied later on.

Quoted 38 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +6 -4
index 12d2adcdf14e..f10b6175e20c 100644
@@ -369,7 +369,7 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
        size = ALIGN(size, PAGE_SIZE);
 
        r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain, bo_ptr,
-                                     NULL, NULL);
+                                     NULL, cpu_addr);
        if (r)
                return r;
 
@@ -377,12 +377,15 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
         * Remove the original mem node and create a new one at the request
         * position.
         */
+       if (cpu_addr)
+               amdgpu_bo_kunmap(*bo_ptr);
+
+       ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
+
        for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
                (*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
                (*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
        }
-
-       ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
        r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
                             &(*bo_ptr)->tbo.mem, &ctx);
        if (r)
--

2.14.1

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

Reviewed-by Emily Deng
#3 lore raw
In reply to a message not in the archive
Quoted 50 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, September 24, 2019 7:56 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: [PATCH] drm7amdgpu: once more fix amdgpu_bo_create_kernel_at

When CPU access is needed we should tell that to amdgpu_bo_create_reserved() or otherwise the access is denied later on.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---

1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 12d2adcdf14e..f10b6175e20c 100644
@@ -369,7 +369,7 @@ int amdgpu_bo_create_kernel_at(struct
 amdgpu_device *adev,
 	size = ALIGN(size, PAGE_SIZE);
 
 	r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain,
 bo_ptr,
-				      NULL, NULL);
+				      NULL, cpu_addr);
 	if (r)
		return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
@@ -377,12 +377,15 @@ int amdgpu_bo_create_kernel_at(struct
 amdgpu_device *adev,
 	 * Remove the original mem node and create a new one at the

request

	 * position.
	 */
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -0
+	if (cpu_addr)
+		amdgpu_bo_kunmap(*bo_ptr);
+
+	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
+
	for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
		(*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
		(*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
	}
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -2
-
-	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
	r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
			     &(*bo_ptr)->tbo.mem, &ctx);
	if (r)
Quoted 2 lines

--
2.14.1

_______________________________________________
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): MN2PR12MB29750C8C515A2924B3454E488F870-rweVpJHSKToFlvJWC7EAqwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#5 lore raw

Hi Emily,

have you also tested this? I don't have the hardware to test it so that would be rather nice to have.

Thanks,
Christian.

Am 25.09.19 um 11:31 schrieb Deng, Emily:

Quoted 46 lines
Quoted 44 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, September 24, 2019 7:56 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: [PATCH] drm7amdgpu: once more fix amdgpu_bo_create_kernel_at

When CPU access is needed we should tell that to amdgpu_bo_create_reserved() or otherwise the access is denied later on.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---

1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 12d2adcdf14e..f10b6175e20c 100644
@@ -369,7 +369,7 @@ int amdgpu_bo_create_kernel_at(struct
 amdgpu_device *adev,
 	size = ALIGN(size, PAGE_SIZE);
 
 	r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain,
 bo_ptr,
-				      NULL, NULL);
+				      NULL, cpu_addr);
 	if (r)
		return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
@@ -377,12 +377,15 @@ int amdgpu_bo_create_kernel_at(struct
 amdgpu_device *adev,
 	 * Remove the original mem node and create a new one at the

request

	 * position.
	 */
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -0
+	if (cpu_addr)
+		amdgpu_bo_kunmap(*bo_ptr);
+
+	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
+
	for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
		(*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
		(*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
Quoted 8 lines
Quoted 8 lines
	}
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -2
-
-	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
	r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
			     &(*bo_ptr)->tbo.mem, &ctx);
	if (r)

--
2.14.1

_______________________________________________
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): 05ae5f93-535b-96c9-9687-db9e8de456be-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#7 lore raw

Yes, I have already tested it.

Best wishes
Emily Deng

Quoted 63 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Wednesday, September 25, 2019 5:36 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm7amdgpu: once more fix amdgpu_bo_create_kernel_at

Hi Emily,

have you also tested this? I don't have the hardware to test it so that would be rather nice to have.

Thanks,
Christian.

Am 25.09.19 um 11:31 schrieb Deng, Emily:

Quoted 7 lines
Quoted 5 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, September 24, 2019 7:56 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: [PATCH] drm7amdgpu: once more fix

amdgpu_bo_create_kernel_at

Quoted 18 lines
Quoted 18 lines

When CPU access is needed we should tell that to amdgpu_bo_create_reserved() or otherwise the access is denied later on.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---

1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 12d2adcdf14e..f10b6175e20c 100644
@@ -369,7 +369,7 @@ int amdgpu_bo_create_kernel_at(struct
 amdgpu_device *adev,
 	size = ALIGN(size, PAGE_SIZE);
 
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_kernel_at(struct · line 372

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
 	r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain,

bo_ptr,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_kernel_at(struct · line 378

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
-				      NULL, NULL);
+				      NULL, cpu_addr);
 	if (r)
 		return r;
@@ -377,12 +377,15 @@ int amdgpu_bo_create_kernel_at(struct
 amdgpu_device *adev,
 	 * Remove the original mem node and create a new one at the

request

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -0
 	 * position.
 	 */
+	if (cpu_addr)
+		amdgpu_bo_kunmap(*bo_ptr);
+
+	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
+
 	for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
 		(*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
 		(*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -2
 	}
-
-	ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
 	r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
 			     &(*bo_ptr)->tbo.mem, &ctx);
	if (r)

--
2.14.1

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