drm/amdkfd: Fix CRIU restore op due to doorbell offset
Subsystems (3)
PATCH v2 1/1 drm/amdkfd: Fix CRIU restore op due to doorbell offset
Recently introduced change to allocate doorbells only when the first queue is created or mapped for CPU / GPU access, did not consider Checkpoint Restore scenario completely. This fix allows the CRIU restore operation by extending the doorbell optimization to CRIU restore scenario.
Fixes 'commit 15bcfbc55b57 ("drm/amdkfd: Allocate doorbells only when needed")'
Signed-off-by Rajneesh Bhardwaj <[email protected]>
---
Changes in v2:
* Addressed review feedback from Felix
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 ++++++ drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 7 +++++++ 3 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6 -0
@@ -2153,6 +2153,12 @@ static int criu_restore_devices(struct kfd_process *p, ret =PTR_ERR (pdd); goto exit; } + +if (!pdd->doorbell_index && +kfd_alloc_process_doorbells (pdd->dev, &pdd->doorbell_index) <0 ) { + ret = -ENOMEM ; + goto exit; + } }/*
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +3 -0
@@ -303,6 +303,9 @@ int kfd_alloc_process_doorbells(struct kfd_dev *kfd, unsigned int *doorbell_indeif (r >0 ) *doorbell_index = r; +if (r <0 ) +pr_err ("Failed to allocate process doorbells\n" ); +return r; }
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +7 -0
@@ -857,6 +857,13 @@ int kfd_criu_restore_queue(struct kfd_process *p, ret = -EINVAL ; goto exit; } + +if (!pdd->doorbell_index && +kfd_alloc_process_doorbells (pdd->dev, &pdd->doorbell_index) <0 ) { + ret = -ENOMEM ; + goto exit; + } +/* data stored in this order: mqd, ctl_stack */ mqd = q_extra_data; ctl_stack = mqd + q_data->mqd_size;
Signature · 1 line
2.17.1
Quoted 9 lines · Rajneesh Bhardwaj
Recently introduced change to allocate doorbells only when the first queue is created or mapped for CPU / GPU access, did not consider Checkpoint Restore scenario completely. This fix allows the CRIU restore operation by extending the doorbell optimization to CRIU restore scenario.
Fixes 'commit 15bcfbc55b57 ("drm/amdkfd: Allocate doorbells only when needed")'Signed-off-by Rajneesh Bhardwaj <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Thanks!
Quoted 60 lines
---
Changes in v2:
* Addressed review feedback from Felix
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 ++++++ drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 7 +++++++ 3 files changed, 16 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +6
-0@@ -2153,6 +2153,12 @@ static int criu_restore_devices(struct kfd_process *p, ret =PTR_ERR (pdd); goto exit; } + +if (!pdd->doorbell_index && +kfd_alloc_process_doorbells (pdd->dev, &pdd->doorbell_index) <0 ) { + ret = -ENOMEM ; + goto exit; + } }/* drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +3
-0@@ -303,6 +303,9 @@ int kfd_alloc_process_doorbells(struct kfd_dev *kfd, unsigned int *doorbell_indeif (r >0 ) *doorbell_index = r; +if (r <0 ) +pr_err ("Failed to allocate process doorbells\n" ); +return r; }drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +7
-0@@ -857,6 +857,13 @@ int kfd_criu_restore_queue(struct kfd_process *p, ret = -EINVAL ; goto exit; } + +if (!pdd->doorbell_index && +kfd_alloc_process_doorbells (pdd->dev, &pdd->doorbell_index) <0 ) { + ret = -ENOMEM ; + goto exit; + } +/* data stored in this order: mqd, ctl_stack */ mqd = q_extra_data; ctl_stack = mqd + q_data->mqd_size;