Skip to contentSkip to conversation

drm/amdgpu: To get gds, gws and oa from adev->gds

PATCH In review Emily Deng 3 participants 7 messages May 29, 2018 – May 30, 2018 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: To get gds, gws and oa from adev->gds

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38 ++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +23 -15
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 	struct amdgpu_bo_list_entry *e;
 	struct list_head duplicates;
 	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
 	int r;
 
 	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
 	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
 				     p->bytes_moved_vis);
+
 	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;
 		struct amdgpu_vm *vm = &fpriv->vm;
 		unsigned i;
 
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
 			p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo);
 		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
 	}
 
 	if (!r && p->uf_entry.robj) {
Signature · 6 lines
2.7.4

_______________________________________________
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): 1527585469-4424-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 25 lines · Emily Deng

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38 ++++++++++++++++++++--------------
  1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
  	struct amdgpu_bo_list_entry *e;
  	struct list_head duplicates;
  	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
  	int r;
 
  	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · line 708

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -3
  	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
  				     p->bytes_moved_vis);
+
  	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;

out of curious, why not directly use p->adev->gds however per-vm-bo is enabled?

Regards,
David Zhou

Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +9 -12
  		struct amdgpu_vm *vm = &fpriv->vm;
  		unsigned i;
 
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
  			p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo);
  		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · line 736

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +7 -0
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
  	}
 
  	if (!r && p->uf_entry.robj) {

_______________________________________________
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): 90460b27-2c68-ad86-c222-161757e00722-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Hi David,
For the use case that the user mode creates the gds, gws, and oa buffer object itself, it need to pass bo_list to kernel driver, and we need
to get those objects from bo_list.

Best Wishes,
Emily Deng

Quoted 93 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, May 29, 2018 7:23 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: To get gds, gws and oa from adev->gds

Quoted 7 lines · Emily Deng

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38

++++++++++++++++++++--------------

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct

Quoted 8 lines
  1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct

amdgpu_cs_parser *p,

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
  	struct amdgpu_bo_list_entry *e;
  	struct list_head duplicates;
  	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
  	int r;
 
  	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 709

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -3
  	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
  				     p->bytes_moved_vis);
+
  	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;

out of curious, why not directly use p->adev->gds however per-vm-bo is enabled?

Regards,
David Zhou

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 716

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
  		struct amdgpu_vm *vm = &fpriv->vm;
  		unsigned i;
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 
  			p->bo_list->array[i].bo_va =

amdgpu_vm_bo_find(vm, bo);

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -12
  		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
  	}
 
Quoted 1 line
Quoted 1 line
  	if (!r && p->uf_entry.robj) {

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

#6 lore raw

Yes, but how to make sure there is bo list if all BOs are per-vm-bo? Maybe we say we should give this rule to UMD, but who can make sure it? we can imagine a situation when UMD forgot this rule, they create gds bo with per-vm-bo, there is no bo list for CS, then our kernel give a kernel gds as backup, everything runs ok, but UMD never get right result, it will be very difficult to debug, right?

That is why I created patch #2 to make sure gds BOs created from user space are in bo list.

Regards,
David Zhou

Quoted 100 lines · Emily

Hi David,
For the use case that the user mode creates the gds, gws, and oa buffer object itself, it need to pass bo_list to kernel driver, and we need
to get those objects from bo_list.

Best Wishes,
Emily Deng

Quoted 93 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, May 29, 2018 7:23 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: To get gds, gws and oa from adev->gds

Quoted 7 lines · Emily Deng

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38

++++++++++++++++++++--------------

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct

Quoted 8 lines
   1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct

amdgpu_cs_parser *p,

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
   	struct amdgpu_bo_list_entry *e;
   	struct list_head duplicates;
   	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
   	int r;
 
   	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 709

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -3
   	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
   				     p->bytes_moved_vis);
+
   	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;

out of curious, why not directly use p->adev->gds however per-vm-bo is enabled?

Regards,
David Zhou

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 716

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
   		struct amdgpu_vm *vm = &fpriv->vm;
   		unsigned i;
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 
   			p->bo_list->array[i].bo_va =

amdgpu_vm_bo_find(vm, bo);

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -12
   		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
   	}
 
Quoted 1 line
Quoted 1 line
Quoted 1 line
   	if (!r && p->uf_entry.robj) {

_______________________________________________
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): ecf1e921-974f-6467-cf9f-4e9e49645aa9-5C7GfCeVMHo@public.gmane.org

#8 lore raw

Yes, I think we should add this rule to tell user mode driver, just like they will pass bo_list if they share bo with others.

Best Wishes,
Emily Deng

Quoted 124 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of zhoucm1
Sent: Wednesday, May 30, 2018 11:36 AM
To: Deng, Emily <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: To get gds, gws and oa from adev->gds

Yes, but how to make sure there is bo list if all BOs are per-vm-bo? Maybe we say we should give this rule to UMD, but who can make sure it? we can imagine a situation when UMD forgot this rule, they create gds bo with per-vm-bo, there is no bo list for CS, then our kernel give a kernel gds as backup, everything runs ok, but UMD never get right result, it will be very difficult to debug, right?

That is why I created patch #2 to make sure gds BOs created from user space are in bo list.

Regards,
David Zhou

Quoted 2 lines · Emily

Hi David,
For the use case that the user mode creates the gds, gws, and oa buffer

object itself, it need to pass bo_list to kernel driver, and we need

Quoted 99 lines

to get those objects from bo_list.

Best Wishes,
Emily Deng

Quoted 5 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, May 29, 2018 7:23 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: To get gds, gws and oa from adev-

gds

Quoted 88 lines · Emily Deng
Quoted 7 lines

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38

++++++++++++++++++++--------------

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct

Quoted 8 lines
   1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct

amdgpu_cs_parser *p,

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
   	struct amdgpu_bo_list_entry *e;
   	struct list_head duplicates;
   	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
   	int r;
 
   	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 709

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -3
   	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
   				     p->bytes_moved_vis);
+
   	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;

out of curious, why not directly use p->adev->gds however per-vm-bo is enabled?

Regards,
David Zhou

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 716

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
   		struct amdgpu_vm *vm = &fpriv->vm;
   		unsigned i;
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 
   			p->bo_list->array[i].bo_va =

amdgpu_vm_bo_find(vm, bo);

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -12
   		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
   	}
 
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
   	if (!r && p->uf_entry.robj) {

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

#10 lore raw

Shared BOs have the check to prevent per-vm-bo creation:

struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev, struct drm_gem_object *gobj, int flags)
{
        struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj); struct dma_buf *buf;

        if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) || bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) return ERR_PTR(-EPERM);
......

Regards,

David Zhou

Quoted 133 lines · Emily

Yes, I think we should add this rule to tell user mode driver, just like they will pass bo_list if they share bo with others.

Best Wishes,
Emily Deng

Quoted 128 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of zhoucm1
Sent: Wednesday, May 30, 2018 11:36 AM
To: Deng, Emily <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: To get gds, gws and oa from adev->gds

Yes, but how to make sure there is bo list if all BOs are per-vm-bo? Maybe we say we should give this rule to UMD, but who can make sure it? we can imagine a situation when UMD forgot this rule, they create gds bo with per-vm-bo, there is no bo list for CS, then our kernel give a kernel gds as backup, everything runs ok, but UMD never get right result, it will be very difficult to debug, right?

That is why I created patch #2 to make sure gds BOs created from user space are in bo list.

Regards,
David Zhou

Quoted 2 lines · Emily

Hi David,
For the use case that the user mode creates the gds, gws, and oa buffer

object itself, it need to pass bo_list to kernel driver, and we need

Quoted 98 lines

to get those objects from bo_list.

Best Wishes,
Emily Deng

Quoted 5 lines

-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, May 29, 2018 7:23 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: To get gds, gws and oa from adev-

gds

Quoted 87 lines · Emily Deng
Quoted 7 lines

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

---
    drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38

++++++++++++++++++++--------------

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct

Quoted 8 lines
    1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct

amdgpu_cs_parser *p,

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
    	struct amdgpu_bo_list_entry *e;
    	struct list_head duplicates;
    	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
    	int r;
 
    	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 709

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -3
    	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
    				     p->bytes_moved_vis);
+
    	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;

out of curious, why not directly use p->adev->gds however per-vm-bo is enabled?

Regards,
David Zhou

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct · line 716

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
    		struct amdgpu_vm *vm = &fpriv->vm;
    		unsigned i;
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct
 amdgpu_cs_parser *p,
 
    			p->bo_list->array[i].bo_va =

amdgpu_vm_bo_find(vm, bo);

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -12
    		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
    	}
 
Quoted 1 line
Quoted 1 line
Quoted 1 line
    	if (!r && p->uf_entry.robj) {

_______________________________________________
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
#11 lore raw
In reply to a message not in the archive

Am 29.05.2018 um 11:17 schrieb Emily Deng:

Quoted 5 lines

As now enabled per vm bo feature, the user mode driver won't supply the bo_list generally, for this case, the gdb_base, gds_size, gws_base, gws_size and oa_base, oa_size won't be set.

Quoted 59 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38 ++++++++++++++++++++--------------
  1 file changed, 23 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -15
index d296c95..ff94435 100644
@@ -546,6 +546,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
  	struct amdgpu_bo_list_entry *e;
  	struct list_head duplicates;
  	unsigned i, tries = 10;
+	struct amdgpu_bo *gds;
+	struct amdgpu_bo *gws;
+	struct amdgpu_bo *oa;
  	int r;
 
  	INIT_LIST_HEAD(&p->validated);
@@ -698,10 +701,11 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
  	amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved,
  				     p->bytes_moved_vis);
+
  	if (p->bo_list) {
-		struct amdgpu_bo *gds = p->bo_list->gds_obj;
-		struct amdgpu_bo *gws = p->bo_list->gws_obj;
-		struct amdgpu_bo *oa = p->bo_list->oa_obj;
+		gds = p->bo_list->gds_obj;
+		gws = p->bo_list->gws_obj;
+		oa = p->bo_list->oa_obj;
  		struct amdgpu_vm *vm = &fpriv->vm;
  		unsigned i;
 
@@ -710,19 +714,23 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
  			p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo);
  		}
+	} else {
+		gds = p->adev->gds.gds_gfx_bo;
+		gws = p->adev->gds.gws_gfx_bo;
+		oa = p->adev->gds.oa_gfx_bo;
+	}
 
-		if (gds) {
-			p->job->gds_base = amdgpu_bo_gpu_offset(gds);
-			p->job->gds_size = amdgpu_bo_size(gds);
-		}
-		if (gws) {
-			p->job->gws_base = amdgpu_bo_gpu_offset(gws);
-			p->job->gws_size = amdgpu_bo_size(gws);
-		}
-		if (oa) {
-			p->job->oa_base = amdgpu_bo_gpu_offset(oa);
-			p->job->oa_size = amdgpu_bo_size(oa);
-		}
+	if (gds) {
+		p->job->gds_base = amdgpu_bo_gpu_offset(gds);
+		p->job->gds_size = amdgpu_bo_size(gds);
+	}

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, · line 736

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +7 -0
+	if (gws) {
+		p->job->gws_base = amdgpu_bo_gpu_offset(gws);
+		p->job->gws_size = amdgpu_bo_size(gws);
+	}
+	if (oa) {
+		p->job->oa_base = amdgpu_bo_gpu_offset(oa);
+		p->job->oa_size = amdgpu_bo_size(oa);
  	}
 
  	if (!r && p->uf_entry.robj) {

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