diff options
author | Dave Airlie <airlied@redhat.com> | 2018-01-18 13:30:48 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2018-01-18 13:30:48 +1000 |
commit | 92eb5f0c00b7c11d85ae823a814b2a34dda8a3c4 (patch) | |
tree | e405883462fca0ab309240a29b17d67912e78d70 /drivers/gpu/drm/amd | |
parent | 4a6cc7a44e98a0460bd094b68c75f0705fdc450a (diff) | |
parent | 2e3dca53654ddc51bada4cee4ca32d0d266fc9dd (diff) | |
download | linux-92eb5f0c00b7c11d85ae823a814b2a34dda8a3c4.tar.gz linux-92eb5f0c00b7c11d85ae823a814b2a34dda8a3c4.tar.bz2 linux-92eb5f0c00b7c11d85ae823a814b2a34dda8a3c4.zip |
Merge tag 'drm-amdkfd-next-fixes-2018-01-15' of git://people.freedesktop.org/~gabbayo/linux into drm-next
- fix NULL pointer dereference
- fix compiler warning on large define values
- remove unnecessary call to execute_queues_cpsch
* tag 'drm-amdkfd-next-fixes-2018-01-15' of git://people.freedesktop.org/~gabbayo/linux:
drm/amdkfd: Fix potential NULL pointer dereferences
drm/amdkfd: add ull suffix to 64bit defines
drm/amdkfd: don't always call execute_queues_cpsch()
drm/amdkfd: Fix return value 0 when execute_queues_cpsch fails
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 8 |
3 files changed, 16 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index d0693fd8cbf8..b21285afa4ea 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1013,13 +1013,13 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, list_del(&q->list); qpd->queue_count--; - if (q->properties.is_active) + if (q->properties.is_active) { dqm->queue_count--; - - retval = execute_queues_cpsch(dqm, + retval = execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); - if (retval == -ETIME) - qpd->reset_wavefronts = true; + if (retval == -ETIME) + qpd->reset_wavefronts = true; + } mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); @@ -1033,7 +1033,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, mutex_unlock(&dqm->lock); - return 0; + return retval; failed: failed_try_destroy_debugged_queue: diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 6a48d29ada47..0bedcf9cc08c 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -41,9 +41,9 @@ #define KFD_SYSFS_FILE_MODE 0444 -#define KFD_MMAP_DOORBELL_MASK 0x8000000000000 -#define KFD_MMAP_EVENTS_MASK 0x4000000000000 -#define KFD_MMAP_RESERVED_MEM_MASK 0x2000000000000 +#define KFD_MMAP_DOORBELL_MASK 0x8000000000000ull +#define KFD_MMAP_EVENTS_MASK 0x4000000000000ull +#define KFD_MMAP_RESERVED_MEM_MASK 0x2000000000000ull /* * When working with cp scheduler we should assign the HIQ manually or via diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index a22fb0710f15..4ff5f0fe6db8 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -461,7 +461,8 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev) hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { mutex_lock(&p->mutex); pdd = kfd_get_process_device_data(dev, p); - if (pdd->bound != PDD_BOUND_SUSPENDED) { + + if (WARN_ON(!pdd) || pdd->bound != PDD_BOUND_SUSPENDED) { mutex_unlock(&p->mutex); continue; } @@ -501,6 +502,11 @@ void kfd_unbind_processes_from_device(struct kfd_dev *dev) mutex_lock(&p->mutex); pdd = kfd_get_process_device_data(dev, p); + if (WARN_ON(!pdd)) { + mutex_unlock(&p->mutex); + continue; + } + if (pdd->bound == PDD_BOUND) pdd->bound = PDD_BOUND_SUSPENDED; mutex_unlock(&p->mutex); |