All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdkfd: add new flags for svm
@ 2022-06-24 16:02 Eric Huang
  2022-06-24 16:02 ` [PATCH 2/3] drm/amdkfd: change svm range evict Eric Huang
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eric Huang @ 2022-06-24 16:02 UTC (permalink / raw)
  To: amd-gfx; +Cc: Eric Huang, Philip.Yang

It is to add new options for always keeping gpu mapping
and custom of coarse grain allocation intead of fine
grain as default.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
---
 include/uapi/linux/kfd_ioctl.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index fd49dde4d5f4..9dbf215675a0 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
 #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
 /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */
 #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY     0x00000020
+/* Keep GPU memory mapping always valid as if XNACK is disable */
+#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
+/* Allow set custom flags instead of defaults */
+#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
 
 /**
  * kfd_ioctl_svm_op - SVM ioctl operations
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] drm/amdkfd: change svm range evict
  2022-06-24 16:02 [PATCH 1/3] drm/amdkfd: add new flags for svm Eric Huang
@ 2022-06-24 16:02 ` Eric Huang
  2022-06-24 16:02 ` [PATCH 3/3] drm/amdkfd: add custom svm range flags setting Eric Huang
  2022-06-27 15:33 ` [PATCH 1/3] drm/amdkfd: add new flags for svm Alex Deucher
  2 siblings, 0 replies; 10+ messages in thread
From: Eric Huang @ 2022-06-24 16:02 UTC (permalink / raw)
  To: amd-gfx; +Cc: Eric Huang, Philip.Yang

Two changes:
1. reducing unnecessary evict/unmap when range is not mapped to gpu.
2. adding always evict when flags is set to always_mapped.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 4bf2f75f853b..353306037959 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1767,12 +1767,16 @@ svm_range_evict(struct svm_range *prange, struct mm_struct *mm,
 	struct kfd_process *p;
 	int r = 0;
 
+	if (prange->mapped_to_gpu)
+		return 0;
+
 	p = container_of(svms, struct kfd_process, svms);
 
 	pr_debug("invalidate svms 0x%p prange [0x%lx 0x%lx] [0x%lx 0x%lx]\n",
 		 svms, prange->start, prange->last, start, last);
 
-	if (!p->xnack_enabled) {
+	if (!p->xnack_enabled ||
+	    (prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED)) {
 		int evicted_ranges;
 
 		list_for_each_entry(pchild, &prange->child_list, child_list) {
@@ -3321,7 +3325,9 @@ svm_range_set_attr(struct kfd_process *p, struct mm_struct *mm,
 		if (r)
 			goto out_unlock_range;
 
-		if (migrated && !p->xnack_enabled) {
+		if (migrated && (!p->xnack_enabled ||
+		    (prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED)) &&
+		    prange->mapped_to_gpu) {
 			pr_debug("restore_work will update mappings of GPUs\n");
 			mutex_unlock(&prange->migrate_mutex);
 			continue;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] drm/amdkfd: add custom svm range flags setting
  2022-06-24 16:02 [PATCH 1/3] drm/amdkfd: add new flags for svm Eric Huang
  2022-06-24 16:02 ` [PATCH 2/3] drm/amdkfd: change svm range evict Eric Huang
@ 2022-06-24 16:02 ` Eric Huang
  2022-06-27 15:33 ` [PATCH 1/3] drm/amdkfd: add new flags for svm Alex Deucher
  2 siblings, 0 replies; 10+ messages in thread
From: Eric Huang @ 2022-06-24 16:02 UTC (permalink / raw)
  To: amd-gfx; +Cc: Eric Huang, Philip.Yang

It is to give a chance for user to change default
flags setting, such as fine grain to coarse grain.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 353306037959..caadd18c447a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -722,7 +722,10 @@ svm_range_apply_attrs(struct kfd_process *p, struct svm_range *prange,
 			break;
 		case KFD_IOCTL_SVM_ATTR_SET_FLAGS:
 			*update_mapping = true;
-			prange->flags |= attrs[i].value;
+			if (attrs[i].value & KFD_IOCTL_SVM_FLAG_CUSTOM)
+				prange->flags = attrs[i].value;
+			else
+				prange->flags |= attrs[i].value;
 			break;
 		case KFD_IOCTL_SVM_ATTR_CLR_FLAGS:
 			*update_mapping = true;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-24 16:02 [PATCH 1/3] drm/amdkfd: add new flags for svm Eric Huang
  2022-06-24 16:02 ` [PATCH 2/3] drm/amdkfd: change svm range evict Eric Huang
  2022-06-24 16:02 ` [PATCH 3/3] drm/amdkfd: add custom svm range flags setting Eric Huang
@ 2022-06-27 15:33 ` Alex Deucher
  2022-06-27 15:36   ` Eric Huang
  2 siblings, 1 reply; 10+ messages in thread
From: Alex Deucher @ 2022-06-27 15:33 UTC (permalink / raw)
  To: Eric Huang; +Cc: Yang, Philip, amd-gfx list

On Fri, Jun 24, 2022 at 12:03 PM Eric Huang <jinhuieric.huang@amd.com> wrote:
>
> It is to add new options for always keeping gpu mapping
> and custom of coarse grain allocation intead of fine
> grain as default.
>
> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>

Can you provide a link to the proposed userspace for this?

Alex

> ---
>  include/uapi/linux/kfd_ioctl.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
> index fd49dde4d5f4..9dbf215675a0 100644
> --- a/include/uapi/linux/kfd_ioctl.h
> +++ b/include/uapi/linux/kfd_ioctl.h
> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
>  #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
>  /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */
>  #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY     0x00000020
> +/* Keep GPU memory mapping always valid as if XNACK is disable */
> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
> +/* Allow set custom flags instead of defaults */
> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
>
>  /**
>   * kfd_ioctl_svm_op - SVM ioctl operations
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-27 15:33 ` [PATCH 1/3] drm/amdkfd: add new flags for svm Alex Deucher
@ 2022-06-27 15:36   ` Eric Huang
  2022-06-27 15:58     ` Alex Deucher
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Huang @ 2022-06-27 15:36 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Yang, Philip, amd-gfx list

http://gerrit-git.amd.com/c/compute/ec/libhsakmt/+/697296

Regards,
Eric

On 2022-06-27 11:33, Alex Deucher wrote:
> On Fri, Jun 24, 2022 at 12:03 PM Eric Huang <jinhuieric.huang@amd.com> wrote:
>> It is to add new options for always keeping gpu mapping
>> and custom of coarse grain allocation intead of fine
>> grain as default.
>>
>> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
> Can you provide a link to the proposed userspace for this?
>
> Alex
>
>> ---
>>   include/uapi/linux/kfd_ioctl.h | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
>> index fd49dde4d5f4..9dbf215675a0 100644
>> --- a/include/uapi/linux/kfd_ioctl.h
>> +++ b/include/uapi/linux/kfd_ioctl.h
>> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
>>   #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
>>   /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */
>>   #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY     0x00000020
>> +/* Keep GPU memory mapping always valid as if XNACK is disable */
>> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
>> +/* Allow set custom flags instead of defaults */
>> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
>>
>>   /**
>>    * kfd_ioctl_svm_op - SVM ioctl operations
>> --
>> 2.25.1
>>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-27 15:36   ` Eric Huang
@ 2022-06-27 15:58     ` Alex Deucher
  2022-06-27 16:01       ` Eric Huang
  0 siblings, 1 reply; 10+ messages in thread
From: Alex Deucher @ 2022-06-27 15:58 UTC (permalink / raw)
  To: Eric Huang; +Cc: Yang, Philip, amd-gfx list

On Mon, Jun 27, 2022 at 11:36 AM Eric Huang <jinhuieric.huang@amd.com> wrote:
>
> http://gerrit-git.amd.com/c/compute/ec/libhsakmt/+/697296

Got an external link?

Alex

>
> Regards,
> Eric
>
> On 2022-06-27 11:33, Alex Deucher wrote:
> > On Fri, Jun 24, 2022 at 12:03 PM Eric Huang <jinhuieric.huang@amd.com> wrote:
> >> It is to add new options for always keeping gpu mapping
> >> and custom of coarse grain allocation intead of fine
> >> grain as default.
> >>
> >> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
> > Can you provide a link to the proposed userspace for this?
> >
> > Alex
> >
> >> ---
> >>   include/uapi/linux/kfd_ioctl.h | 4 ++++
> >>   1 file changed, 4 insertions(+)
> >>
> >> diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
> >> index fd49dde4d5f4..9dbf215675a0 100644
> >> --- a/include/uapi/linux/kfd_ioctl.h
> >> +++ b/include/uapi/linux/kfd_ioctl.h
> >> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
> >>   #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
> >>   /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */
> >>   #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY     0x00000020
> >> +/* Keep GPU memory mapping always valid as if XNACK is disable */
> >> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
> >> +/* Allow set custom flags instead of defaults */
> >> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
> >>
> >>   /**
> >>    * kfd_ioctl_svm_op - SVM ioctl operations
> >> --
> >> 2.25.1
> >>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-27 15:58     ` Alex Deucher
@ 2022-06-27 16:01       ` Eric Huang
  2022-06-27 16:41         ` Alex Deucher
  2022-06-28 20:44         ` Felix Kuehling
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Huang @ 2022-06-27 16:01 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Yang, Philip, amd-gfx list

No. There is only internal link for now, because it is under review. 
Once it is submitted, external link should be in gerritgit for libhsakmt.

Regards,
Eric

On 2022-06-27 11:58, Alex Deucher wrote:
> On Mon, Jun 27, 2022 at 11:36 AM Eric Huang <jinhuieric.huang@amd.com> wrote:
>> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgerrit-git.amd.com%2Fc%2Fcompute%2Fec%2Flibhsakmt%2F%2B%2F697296&amp;data=05%7C01%7Cjinhuieric.huang%40amd.com%7C61498029cd6743a4519108da5855f02e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637919423397667222%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=wPlHRSmOyzO%2B2vbwN9IK4qR5dhk%2BaOw2rt3JEdjizRU%3D&amp;reserved=0
> Got an external link?
>
> Alex
>
>> Regards,
>> Eric
>>
>> On 2022-06-27 11:33, Alex Deucher wrote:
>>> On Fri, Jun 24, 2022 at 12:03 PM Eric Huang <jinhuieric.huang@amd.com> wrote:
>>>> It is to add new options for always keeping gpu mapping
>>>> and custom of coarse grain allocation intead of fine
>>>> grain as default.
>>>>
>>>> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
>>> Can you provide a link to the proposed userspace for this?
>>>
>>> Alex
>>>
>>>> ---
>>>>    include/uapi/linux/kfd_ioctl.h | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
>>>> index fd49dde4d5f4..9dbf215675a0 100644
>>>> --- a/include/uapi/linux/kfd_ioctl.h
>>>> +++ b/include/uapi/linux/kfd_ioctl.h
>>>> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
>>>>    #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
>>>>    /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */
>>>>    #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY     0x00000020
>>>> +/* Keep GPU memory mapping always valid as if XNACK is disable */
>>>> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
>>>> +/* Allow set custom flags instead of defaults */
>>>> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
>>>>
>>>>    /**
>>>>     * kfd_ioctl_svm_op - SVM ioctl operations
>>>> --
>>>> 2.25.1
>>>>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-27 16:01       ` Eric Huang
@ 2022-06-27 16:41         ` Alex Deucher
  2022-06-28 20:44         ` Felix Kuehling
  1 sibling, 0 replies; 10+ messages in thread
From: Alex Deucher @ 2022-06-27 16:41 UTC (permalink / raw)
  To: Eric Huang; +Cc: Yang, Philip, amd-gfx list

On Mon, Jun 27, 2022 at 12:01 PM Eric Huang <jinhuieric.huang@amd.com> wrote:
>
> No. There is only internal link for now, because it is under review.
> Once it is submitted, external link should be in gerritgit for libhsakmt.

We need to have that available at the same time so that the kernel
side can be properly reviewed here.

Alex

>
> Regards,
> Eric
>
> On 2022-06-27 11:58, Alex Deucher wrote:
> > On Mon, Jun 27, 2022 at 11:36 AM Eric Huang <jinhuieric.huang@amd.com> wrote:
> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgerrit-git.amd.com%2Fc%2Fcompute%2Fec%2Flibhsakmt%2F%2B%2F697296&amp;data=05%7C01%7Cjinhuieric.huang%40amd.com%7C61498029cd6743a4519108da5855f02e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637919423397667222%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=wPlHRSmOyzO%2B2vbwN9IK4qR5dhk%2BaOw2rt3JEdjizRU%3D&amp;reserved=0
> > Got an external link?
> >
> > Alex
> >
> >> Regards,
> >> Eric
> >>
> >> On 2022-06-27 11:33, Alex Deucher wrote:
> >>> On Fri, Jun 24, 2022 at 12:03 PM Eric Huang <jinhuieric.huang@amd.com> wrote:
> >>>> It is to add new options for always keeping gpu mapping
> >>>> and custom of coarse grain allocation intead of fine
> >>>> grain as default.
> >>>>
> >>>> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
> >>> Can you provide a link to the proposed userspace for this?
> >>>
> >>> Alex
> >>>
> >>>> ---
> >>>>    include/uapi/linux/kfd_ioctl.h | 4 ++++
> >>>>    1 file changed, 4 insertions(+)
> >>>>
> >>>> diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
> >>>> index fd49dde4d5f4..9dbf215675a0 100644
> >>>> --- a/include/uapi/linux/kfd_ioctl.h
> >>>> +++ b/include/uapi/linux/kfd_ioctl.h
> >>>> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
> >>>>    #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
> >>>>    /* GPUs mostly read, may allow similar optimizations as RO, but writes fault */
> >>>>    #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY     0x00000020
> >>>> +/* Keep GPU memory mapping always valid as if XNACK is disable */
> >>>> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
> >>>> +/* Allow set custom flags instead of defaults */
> >>>> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
> >>>>
> >>>>    /**
> >>>>     * kfd_ioctl_svm_op - SVM ioctl operations
> >>>> --
> >>>> 2.25.1
> >>>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-27 16:01       ` Eric Huang
  2022-06-27 16:41         ` Alex Deucher
@ 2022-06-28 20:44         ` Felix Kuehling
  2022-06-28 20:53           ` Eric Huang
  1 sibling, 1 reply; 10+ messages in thread
From: Felix Kuehling @ 2022-06-28 20:44 UTC (permalink / raw)
  To: Eric Huang, Alex Deucher; +Cc: Yang, Philip, amd-gfx list

Am 2022-06-27 um 12:01 schrieb Eric Huang:
> No. There is only internal link for now, because it is under review. 
> Once it is submitted, external link should be in gerritgit for libhsakmt.

Hi Eric,

For anything that requires ioctl API changes, the user mode and kernel 
mode changes need to be reviewed together in public. You can either post 
the libhsakmt change by email to amd-gfx, or you can push your libhsakmt 
development branch to a personal branch on github and include a link to 
that in the kernel commit description.

Alex, some background about this series: We are looking into using 
unified memory for CWSR context save space. This allows us to get lower 
preemption latency when VRAM is available, but migrate it to system 
memory when more VRAM is needed for application allocations. Because we 
cannot preempt in the trap handler, and we want to guarantee finite time 
for preemption and trap handler execution, we need to prevent page 
faults on any memory accessed by the trap handler. The 
KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED flag is meant to guarantee that.

I think the KFD_IOCTL_SVM_FLAG_CUSTOM is not necessary. I've responded 
to Eric with an alternative idea.

Regards,
   Felix


>
> Regards,
> Eric
>
> On 2022-06-27 11:58, Alex Deucher wrote:
>> On Mon, Jun 27, 2022 at 11:36 AM Eric Huang 
>> <jinhuieric.huang@amd.com> wrote:
>>> http://gerrit-git.amd.com/c/compute/ec/libhsakmt/+/697296
>> Got an external link?
>>
>> Alex
>>
>>> Regards,
>>> Eric
>>>
>>> On 2022-06-27 11:33, Alex Deucher wrote:
>>>> On Fri, Jun 24, 2022 at 12:03 PM Eric Huang 
>>>> <jinhuieric.huang@amd.com> wrote:
>>>>> It is to add new options for always keeping gpu mapping
>>>>> and custom of coarse grain allocation intead of fine
>>>>> grain as default.
>>>>>
>>>>> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
>>>> Can you provide a link to the proposed userspace for this?
>>>>
>>>> Alex
>>>>
>>>>> ---
>>>>>    include/uapi/linux/kfd_ioctl.h | 4 ++++
>>>>>    1 file changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/include/uapi/linux/kfd_ioctl.h 
>>>>> b/include/uapi/linux/kfd_ioctl.h
>>>>> index fd49dde4d5f4..9dbf215675a0 100644
>>>>> --- a/include/uapi/linux/kfd_ioctl.h
>>>>> +++ b/include/uapi/linux/kfd_ioctl.h
>>>>> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
>>>>>    #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
>>>>>    /* GPUs mostly read, may allow similar optimizations as RO, but 
>>>>> writes fault */
>>>>>    #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020
>>>>> +/* Keep GPU memory mapping always valid as if XNACK is disable */
>>>>> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED   0x00000040
>>>>> +/* Allow set custom flags instead of defaults */
>>>>> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
>>>>>
>>>>>    /**
>>>>>     * kfd_ioctl_svm_op - SVM ioctl operations
>>>>> -- 
>>>>> 2.25.1
>>>>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] drm/amdkfd: add new flags for svm
  2022-06-28 20:44         ` Felix Kuehling
@ 2022-06-28 20:53           ` Eric Huang
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Huang @ 2022-06-28 20:53 UTC (permalink / raw)
  To: Felix Kuehling, Alex Deucher; +Cc: Yang, Philip, amd-gfx list

Thank you, Felix.

I will send all libhsakmt changes and amdkfd changes to amd-gfx.

Regards,
Eric

On 2022-06-28 16:44, Felix Kuehling wrote:
> Am 2022-06-27 um 12:01 schrieb Eric Huang:
>> No. There is only internal link for now, because it is under review. 
>> Once it is submitted, external link should be in gerritgit for 
>> libhsakmt.
>
> Hi Eric,
>
> For anything that requires ioctl API changes, the user mode and kernel 
> mode changes need to be reviewed together in public. You can either 
> post the libhsakmt change by email to amd-gfx, or you can push your 
> libhsakmt development branch to a personal branch on github and 
> include a link to that in the kernel commit description.
>
> Alex, some background about this series: We are looking into using 
> unified memory for CWSR context save space. This allows us to get 
> lower preemption latency when VRAM is available, but migrate it to 
> system memory when more VRAM is needed for application allocations. 
> Because we cannot preempt in the trap handler, and we want to 
> guarantee finite time for preemption and trap handler execution, we 
> need to prevent page faults on any memory accessed by the trap 
> handler. The KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED flag is meant to 
> guarantee that.
>
> I think the KFD_IOCTL_SVM_FLAG_CUSTOM is not necessary. I've responded 
> to Eric with an alternative idea.
>
> Regards,
>   Felix
>
>
>>
>> Regards,
>> Eric
>>
>> On 2022-06-27 11:58, Alex Deucher wrote:
>>> On Mon, Jun 27, 2022 at 11:36 AM Eric Huang 
>>> <jinhuieric.huang@amd.com> wrote:
>>>> http://gerrit-git.amd.com/c/compute/ec/libhsakmt/+/697296
>>> Got an external link?
>>>
>>> Alex
>>>
>>>> Regards,
>>>> Eric
>>>>
>>>> On 2022-06-27 11:33, Alex Deucher wrote:
>>>>> On Fri, Jun 24, 2022 at 12:03 PM Eric Huang 
>>>>> <jinhuieric.huang@amd.com> wrote:
>>>>>> It is to add new options for always keeping gpu mapping
>>>>>> and custom of coarse grain allocation intead of fine
>>>>>> grain as default.
>>>>>>
>>>>>> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
>>>>> Can you provide a link to the proposed userspace for this?
>>>>>
>>>>> Alex
>>>>>
>>>>>> ---
>>>>>>    include/uapi/linux/kfd_ioctl.h | 4 ++++
>>>>>>    1 file changed, 4 insertions(+)
>>>>>>
>>>>>> diff --git a/include/uapi/linux/kfd_ioctl.h 
>>>>>> b/include/uapi/linux/kfd_ioctl.h
>>>>>> index fd49dde4d5f4..9dbf215675a0 100644
>>>>>> --- a/include/uapi/linux/kfd_ioctl.h
>>>>>> +++ b/include/uapi/linux/kfd_ioctl.h
>>>>>> @@ -1076,6 +1076,10 @@ struct kfd_ioctl_cross_memory_copy_args {
>>>>>>    #define KFD_IOCTL_SVM_FLAG_GPU_EXEC    0x00000010
>>>>>>    /* GPUs mostly read, may allow similar optimizations as RO, 
>>>>>> but writes fault */
>>>>>>    #define KFD_IOCTL_SVM_FLAG_GPU_READ_MOSTLY 0x00000020
>>>>>> +/* Keep GPU memory mapping always valid as if XNACK is disable */
>>>>>> +#define KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED 0x00000040
>>>>>> +/* Allow set custom flags instead of defaults */
>>>>>> +#define KFD_IOCTL_SVM_FLAG_CUSTOM      0x80000000
>>>>>>
>>>>>>    /**
>>>>>>     * kfd_ioctl_svm_op - SVM ioctl operations
>>>>>> -- 
>>>>>> 2.25.1
>>>>>>
>>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-06-28 20:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24 16:02 [PATCH 1/3] drm/amdkfd: add new flags for svm Eric Huang
2022-06-24 16:02 ` [PATCH 2/3] drm/amdkfd: change svm range evict Eric Huang
2022-06-24 16:02 ` [PATCH 3/3] drm/amdkfd: add custom svm range flags setting Eric Huang
2022-06-27 15:33 ` [PATCH 1/3] drm/amdkfd: add new flags for svm Alex Deucher
2022-06-27 15:36   ` Eric Huang
2022-06-27 15:58     ` Alex Deucher
2022-06-27 16:01       ` Eric Huang
2022-06-27 16:41         ` Alex Deucher
2022-06-28 20:44         ` Felix Kuehling
2022-06-28 20:53           ` Eric Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.