drm/amdkfd: Set handle to invalid for non GTT/VRAM BOs
Subsystems (3)
PATCH 1/1 drm/amdkfd: Set handle to invalid for non GTT/VRAM BOs
Set dmabuf handle to invalid for BOs that cannot be accessed using SDMA during checkpoint/restore.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6 -2
@@ -1767,7 +1767,9 @@ static int criu_checkpoint_bos(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret) goto exit; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ; +if (bo_bucket->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL ) bo_bucket->offset =KFD_MMAP_TYPE_DOORBELL |KFD_MMAP_GPU_ID (pdd->dev->id);
@@ -2219,7 +2221,9 @@ static int criu_restore_bo(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret)return ret; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ; +return 0 ; }
include/uapi/linux/kfd_ioctl.h +2 -0
@@ -196,6 +196,8 @@ struct kfd_ioctl_dbg_wave_control_args {__u32 buf_size_in_bytes;/*including gpu_id and buf_size */ }; +#define KFD_INVALID_FD 0xffffffff +/* Matching HSA_EVENTTYPE */ #define KFD_IOC_EVENT_SIGNAL 0#define KFD_IOC_EVENT_NODECHANGE 1
Signature · 1 line
2.35.1
Felix Kuehling
maintainerQuoted 14 lines · David Yat Sin
Set dmabuf handle to invalid for BOs that cannot be accessed using SDMA during checkpoint/restore.
Signed-off-by David Yat Sin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int criu_checkpoint_bos(struct kfd_process *p, · line 1771
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -1767,7 +1767,9 @@ static int criu_checkpoint_bos(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret) goto exit; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ;
Minor nit-pick: It would be better to use {} around the else-branch for consistency with the if-branch. Same below.
Ideally, this should have been part of the patch that bumped the KFD version to 1.8. Alex, is there a way to squash this when you send this in a pull-request for drm-next? Maybe if we create the commit with "git commit --fixup" you can let auto-squash handle it.
Other than that, the patch looks good to me.
Regards,
Felix
Quoted 28 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +4
-1+if (bo_bucket->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL ) bo_bucket->offset =KFD_MMAP_TYPE_DOORBELL |KFD_MMAP_GPU_ID (pdd->dev->id);@@ -2219,7 +2221,9 @@ static int criu_restore_bo(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret)return ret; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ; +return 0 ; }include/uapi/linux/kfd_ioctl.h +2
-0@@ -196,6 +196,8 @@ struct kfd_ioctl_dbg_wave_control_args {__u32 buf_size_in_bytes;/*including gpu_id and buf_size */ }; +#define KFD_INVALID_FD 0xffffffff +/* Matching HSA_EVENTTYPE */ #define KFD_IOC_EVENT_SIGNAL 0#define KFD_IOC_EVENT_NODECHANGE 1
Quoted 26 lines · Felix Kuehling
Quoted 14 lines · David Yat Sin
Set dmabuf handle to invalid for BOs that cannot be accessed using SDMA during checkpoint/restore.
Signed-off-by David Yat Sin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int criu_checkpoint_bos(struct kfd_process *p, · line 1771
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -1767,7 +1767,9 @@ static int criu_checkpoint_bos(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret) goto exit; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ;Minor nit-pick: It would be better to use {} around the else-branch for consistency with the if-branch. Same below.
Quoted 5 lines
Ideally, this should have been part of the patch that bumped the KFD version to 1.8. Alex, is there a way to squash this when you send this in a pull-request for drm-next? Maybe if we create the commit with "git commit --fixup" you can let auto-squash handle it.
When did that patch land? If I haven't included it in a PR yet, I can squash this in.
Alex
Quoted 34 lines
Other than that, the patch looks good to me.
Regards,
FelixQuoted 28 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +4
-1+if (bo_bucket->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL ) bo_bucket->offset =KFD_MMAP_TYPE_DOORBELL |KFD_MMAP_GPU_ID (pdd->dev->id);@@ -2219,7 +2221,9 @@ static int criu_restore_bo(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret)return ret; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ; +return 0 ; }include/uapi/linux/kfd_ioctl.h +2
-0@@ -196,6 +196,8 @@ struct kfd_ioctl_dbg_wave_control_args {__u32 buf_size_in_bytes;/*including gpu_id and buf_size */ }; +#define KFD_INVALID_FD 0xffffffff +/* Matching HSA_EVENTTYPE */ #define KFD_IOC_EVENT_SIGNAL 0#define KFD_IOC_EVENT_NODECHANGE 1
Quoted 28 lines · Alex Deucher
Quoted 26 lines · Felix Kuehling
Quoted 14 lines · David Yat Sin
Set dmabuf handle to invalid for BOs that cannot be accessed using SDMA during checkpoint/restore.
Signed-off-by David Yat Sin <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++-- include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0
-0drivers/gpu/drm/amd/amdkfd/kfd_chardev.c static int criu_checkpoint_bos(struct kfd_process *p, · line 1771
Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2
-1@@ -1767,7 +1767,9 @@ static int criu_checkpoint_bos(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret) goto exit; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ;Minor nit-pick: It would be better to use {} around the else-branch for consistency with the if-branch. Same below.
Quoted 8 lines
Quoted 5 lines
Ideally, this should have been part of the patch that bumped the KFD version to 1.8. Alex, is there a way to squash this when you send this in a pull-request for drm-next? Maybe if we create the commit with "git commit --fixup" you can let auto-squash handle it.
When did that patch land? If I haven't included it in a PR yet, I can squash this in.
Ah, I see it. It was from yesterday, so no problem.
Alex
Quoted 38 lines
Alex
Quoted 34 lines
Other than that, the patch looks good to me.
Regards,
FelixQuoted 28 lines
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +4
-1+if (bo_bucket->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL ) bo_bucket->offset =KFD_MMAP_TYPE_DOORBELL |KFD_MMAP_GPU_ID (pdd->dev->id);@@ -2219,7 +2221,9 @@ static int criu_restore_bo(struct kfd_process *p, &bo_bucket->dmabuf_fd);if (ret)return ret; - } + }else + bo_bucket->dmabuf_fd =KFD_INVALID_FD ; +return 0 ; }include/uapi/linux/kfd_ioctl.h +2
-0@@ -196,6 +196,8 @@ struct kfd_ioctl_dbg_wave_control_args {__u32 buf_size_in_bytes;/*including gpu_id and buf_size */ }; +#define KFD_INVALID_FD 0xffffffff +/* Matching HSA_EVENTTYPE */ #define KFD_IOC_EVENT_SIGNAL 0#define KFD_IOC_EVENT_NODECHANGE 1