diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-10 19:34:20 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-10 19:34:20 -0400 |
commit | 27bf60db2485c09eba3b473ce5ffbaa4bba0c24e (patch) | |
tree | c4a29c3d33a76ea3ea92451aa499e4a8aff2b0e5 | |
parent | 7ff6977be8e3c7e6f5ae1ee56bc1535c5ca653b1 (diff) | |
parent | 0fbbbf8b599ff840ff1a3c0cc00dd67ba8a52c9c (diff) |
Merge tag 'drm-amdkfd-fixes-2016-06-03' of git://people.freedesktop.org/~gabbayo/linux into drm-fixes
* tag 'drm-amdkfd-fixes-2016-06-03' of git://people.freedesktop.org/~gabbayo/linux:
drm/amdkfd: print once about mem_banks truncation
drm/amdkfd: destroy dbgmgr in notifier release
drm/amdkfd: unbind only existing processes
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 70 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 |
2 files changed, 44 insertions, 28 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) |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index 74909e72a009..884c96f50c3d 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c | |||
@@ -666,7 +666,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, | |||
666 | dev->node_props.simd_count); | 666 | dev->node_props.simd_count); |
667 | 667 | ||
668 | if (dev->mem_bank_count < dev->node_props.mem_banks_count) { | 668 | if (dev->mem_bank_count < dev->node_props.mem_banks_count) { |
669 | pr_warn("kfd: mem_banks_count truncated from %d to %d\n", | 669 | pr_info_once("kfd: mem_banks_count truncated from %d to %d\n", |
670 | dev->node_props.mem_banks_count, | 670 | dev->node_props.mem_banks_count, |
671 | dev->mem_bank_count); | 671 | dev->mem_bank_count); |
672 | sysfs_show_32bit_prop(buffer, "mem_banks_count", | 672 | sysfs_show_32bit_prop(buffer, "mem_banks_count", |