drm/amdgpu: Disable page faults while reading user wptrs
These wptrs must be pinned and GPU accessible when this is called from hqd_load functions. So they should never fault. This resolves a circular lock dependency issue involving four locks including the DQM lock and mmap_sem. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Oak Zeng <Oak.Zeng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
811bc15b49
commit
cd05c86510
@@ -179,10 +179,17 @@ uint64_t amdgpu_amdkfd_get_mmio_remap_phys_addr(struct kgd_dev *kgd);
|
|||||||
uint32_t amdgpu_amdkfd_get_num_gws(struct kgd_dev *kgd);
|
uint32_t amdgpu_amdkfd_get_num_gws(struct kgd_dev *kgd);
|
||||||
uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *src);
|
uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *src);
|
||||||
|
|
||||||
|
/* Read user wptr from a specified user address space with page fault
|
||||||
|
* disabled. The memory must be pinned and mapped to the hardware when
|
||||||
|
* this is called in hqd_load functions, so it should never fault in
|
||||||
|
* the first place. This resolves a circular lock dependency involving
|
||||||
|
* four locks, including the DQM lock and mmap_sem.
|
||||||
|
*/
|
||||||
#define read_user_wptr(mmptr, wptr, dst) \
|
#define read_user_wptr(mmptr, wptr, dst) \
|
||||||
({ \
|
({ \
|
||||||
bool valid = false; \
|
bool valid = false; \
|
||||||
if ((mmptr) && (wptr)) { \
|
if ((mmptr) && (wptr)) { \
|
||||||
|
pagefault_disable(); \
|
||||||
if ((mmptr) == current->mm) { \
|
if ((mmptr) == current->mm) { \
|
||||||
valid = !get_user((dst), (wptr)); \
|
valid = !get_user((dst), (wptr)); \
|
||||||
} else if (current->mm == NULL) { \
|
} else if (current->mm == NULL) { \
|
||||||
@@ -190,6 +197,7 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s
|
|||||||
valid = !get_user((dst), (wptr)); \
|
valid = !get_user((dst), (wptr)); \
|
||||||
unuse_mm(mmptr); \
|
unuse_mm(mmptr); \
|
||||||
} \
|
} \
|
||||||
|
pagefault_enable(); \
|
||||||
} \
|
} \
|
||||||
valid; \
|
valid; \
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user