]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdkfd: GFP_NOIO while holding locks taken in MMU notifier
authorFelix Kuehling <Felix.Kuehling@amd.com>
Fri, 23 Mar 2018 19:32:31 +0000 (15:32 -0400)
committerOded Gabbay <oded.gabbay@gmail.com>
Fri, 23 Mar 2018 19:32:31 +0000 (15:32 -0400)
When an MMU notifier runs in memory reclaim context, it can deadlock
trying to take locks that are already held in the thread causing the
memory reclaim. The solution is to avoid memory reclaim while holding
locks that are taken in MMU notifiers by using GFP_NOIO.

This commit fixes memory allocations done while holding the dqm->lock
which is needed in the MMU notifier (dqm->ops.evict_process_queues).

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c

index 3346699960ddb1cbf60147540b706f424e4a5384..0434f659eeafb7364b3185eb22531bb99db9a990 100644 (file)
@@ -652,7 +652,7 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,
        if (size > kfd->gtt_sa_num_of_chunks * kfd->gtt_sa_chunk_size)
                return -ENOMEM;
 
-       *mem_obj = kmalloc(sizeof(struct kfd_mem_obj), GFP_KERNEL);
+       *mem_obj = kmalloc(sizeof(struct kfd_mem_obj), GFP_NOIO);
        if ((*mem_obj) == NULL)
                return -ENOMEM;
 
index c00c325ed3c97ba8f59a09f2496badca10ff3ba3..2bc49c62cc8c8a77842db04115f990a187e5e739 100644 (file)
@@ -412,7 +412,7 @@ struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
        if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
                return NULL;
 
-       mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+       mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
        if (!mqd)
                return NULL;
 
index 89e4242e43e719d5b6ede365a7d3c3c471151df1..481307b8b4dbdae29c4fafd39ff577a410696410 100644 (file)
@@ -394,7 +394,7 @@ struct mqd_manager *mqd_manager_init_vi(enum KFD_MQD_TYPE type,
        if (WARN_ON(type >= KFD_MQD_TYPE_MAX))
                return NULL;
 
-       mqd = kzalloc(sizeof(*mqd), GFP_KERNEL);
+       mqd = kzalloc(sizeof(*mqd), GFP_NOIO);
        if (!mqd)
                return NULL;