diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-20 11:25:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-20 11:25:44 -0400 |
commit | af52739b922f656eb1f39016fabaabe4baeda2e2 (patch) | |
tree | 79a7aa810d0493cd0cf4adebac26d37f12e8b545 /drivers/gpu/drm/amd/amdkfd/kfd_process.c | |
parent | 25ed6a5e97809129a1bc852b6b5c7d03baa112c4 (diff) | |
parent | 33688abb2802ff3a230bd2441f765477b94cc89e (diff) |
Merge 4.7-rc4 into staging-next
We want the fixes in here, and we can resolve a merge issue in
drivers/iio/industrialio-trigger.c
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_process.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 70 |
1 files changed, 43 insertions, 27 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index ac005796b71c..7708d90b9da9 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c | |||
@@ -242,13 +242,19 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, | |||
242 | pqm_uninit(&p->pqm); | 242 | pqm_uninit(&p->pqm); |
243 | 243 | ||
244 | /* Iterate over all process device data structure and check | 244 | /* Iterate over all process device data structure and check |
245 | * if we should reset all wavefronts */ | 245 | * if we should delete debug managers and reset all wavefronts |
246 | list_for_each_entry(pdd, &p->per_device_data, per_device_list) | 246 | */ |
247 | list_for_each_entry(pdd, &p->per_device_data, per_device_list) { | ||
248 | if ((pdd->dev->dbgmgr) && | ||
249 | (pdd->dev->dbgmgr->pasid == p->pasid)) | ||
250 | kfd_dbgmgr_destroy(pdd->dev->dbgmgr); | ||
251 | |||
247 | if (pdd->reset_wavefronts) { | 252 | if (pdd->reset_wavefronts) { |
248 | pr_warn("amdkfd: Resetting all wave fronts\n"); | 253 | pr_warn("amdkfd: Resetting all wave fronts\n"); |
249 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | 254 | dbgdev_wave_reset_wavefronts(pdd->dev, p); |
250 | pdd->reset_wavefronts = false; | 255 | pdd->reset_wavefronts = false; |
251 | } | 256 | } |
257 | } | ||
252 | 258 | ||
253 | mutex_unlock(&p->mutex); | 259 | mutex_unlock(&p->mutex); |
254 | 260 | ||
@@ -404,42 +410,52 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) | |||
404 | 410 | ||
405 | idx = srcu_read_lock(&kfd_processes_srcu); | 411 | idx = srcu_read_lock(&kfd_processes_srcu); |
406 | 412 | ||
413 | /* | ||
414 | * Look for the process that matches the pasid. If there is no such | ||
415 | * process, we either released it in amdkfd's own notifier, or there | ||
416 | * is a bug. Unfortunately, there is no way to tell... | ||
417 | */ | ||
407 | hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes) | 418 | hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes) |
408 | if (p->pasid == pasid) | 419 | if (p->pasid == pasid) { |
409 | break; | ||
410 | 420 | ||
411 | srcu_read_unlock(&kfd_processes_srcu, idx); | 421 | srcu_read_unlock(&kfd_processes_srcu, idx); |
412 | 422 | ||
413 | BUG_ON(p->pasid != pasid); | 423 | pr_debug("Unbinding process %d from IOMMU\n", pasid); |
414 | 424 | ||
415 | mutex_lock(&p->mutex); | 425 | mutex_lock(&p->mutex); |
416 | 426 | ||
417 | if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) | 427 | if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) |
418 | kfd_dbgmgr_destroy(dev->dbgmgr); | 428 | kfd_dbgmgr_destroy(dev->dbgmgr); |
419 | 429 | ||
420 | pqm_uninit(&p->pqm); | 430 | pqm_uninit(&p->pqm); |
421 | 431 | ||
422 | pdd = kfd_get_process_device_data(dev, p); | 432 | pdd = kfd_get_process_device_data(dev, p); |
423 | 433 | ||
424 | if (!pdd) { | 434 | if (!pdd) { |
425 | mutex_unlock(&p->mutex); | 435 | mutex_unlock(&p->mutex); |
426 | return; | 436 | return; |
427 | } | 437 | } |
428 | 438 | ||
429 | if (pdd->reset_wavefronts) { | 439 | if (pdd->reset_wavefronts) { |
430 | dbgdev_wave_reset_wavefronts(pdd->dev, p); | 440 | dbgdev_wave_reset_wavefronts(pdd->dev, p); |
431 | pdd->reset_wavefronts = false; | 441 | pdd->reset_wavefronts = false; |
432 | } | 442 | } |
433 | 443 | ||
434 | /* | 444 | /* |
435 | * Just mark pdd as unbound, because we still need it to call | 445 | * Just mark pdd as unbound, because we still need it |
436 | * amd_iommu_unbind_pasid() in when the process exits. | 446 | * to call amd_iommu_unbind_pasid() in when the |
437 | * We don't call amd_iommu_unbind_pasid() here | 447 | * process exits. |
438 | * because the IOMMU called us. | 448 | * We don't call amd_iommu_unbind_pasid() here |
439 | */ | 449 | * because the IOMMU called us. |
440 | pdd->bound = false; | 450 | */ |
451 | pdd->bound = false; | ||
441 | 452 | ||
442 | mutex_unlock(&p->mutex); | 453 | mutex_unlock(&p->mutex); |
454 | |||
455 | return; | ||
456 | } | ||
457 | |||
458 | srcu_read_unlock(&kfd_processes_srcu, idx); | ||
443 | } | 459 | } |
444 | 460 | ||
445 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) | 461 | struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) |