Commit 27bf60db authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-amdkfd-fixes-2016-06-03' of...

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
parents 7ff6977b 0fbbbf8b
...@@ -242,13 +242,19 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, ...@@ -242,13 +242,19 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn,
pqm_uninit(&p->pqm); pqm_uninit(&p->pqm);
/* Iterate over all process device data structure and check /* Iterate over all process device data structure and check
* if we should reset all wavefronts */ * if we should delete debug managers and reset all wavefronts
list_for_each_entry(pdd, &p->per_device_data, per_device_list) */
list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
if ((pdd->dev->dbgmgr) &&
(pdd->dev->dbgmgr->pasid == p->pasid))
kfd_dbgmgr_destroy(pdd->dev->dbgmgr);
if (pdd->reset_wavefronts) { if (pdd->reset_wavefronts) {
pr_warn("amdkfd: Resetting all wave fronts\n"); pr_warn("amdkfd: Resetting all wave fronts\n");
dbgdev_wave_reset_wavefronts(pdd->dev, p); dbgdev_wave_reset_wavefronts(pdd->dev, p);
pdd->reset_wavefronts = false; pdd->reset_wavefronts = false;
} }
}
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
...@@ -404,42 +410,52 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) ...@@ -404,42 +410,52 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid)
idx = srcu_read_lock(&kfd_processes_srcu); idx = srcu_read_lock(&kfd_processes_srcu);
/*
* Look for the process that matches the pasid. If there is no such
* process, we either released it in amdkfd's own notifier, or there
* is a bug. Unfortunately, there is no way to tell...
*/
hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes) hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes)
if (p->pasid == pasid) if (p->pasid == pasid) {
break;
srcu_read_unlock(&kfd_processes_srcu, idx); srcu_read_unlock(&kfd_processes_srcu, idx);
BUG_ON(p->pasid != pasid); pr_debug("Unbinding process %d from IOMMU\n", pasid);
mutex_lock(&p->mutex); mutex_lock(&p->mutex);
if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid)) if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid))
kfd_dbgmgr_destroy(dev->dbgmgr); kfd_dbgmgr_destroy(dev->dbgmgr);
pqm_uninit(&p->pqm); pqm_uninit(&p->pqm);
pdd = kfd_get_process_device_data(dev, p); pdd = kfd_get_process_device_data(dev, p);
if (!pdd) { if (!pdd) {
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
return; return;
} }
if (pdd->reset_wavefronts) { if (pdd->reset_wavefronts) {
dbgdev_wave_reset_wavefronts(pdd->dev, p); dbgdev_wave_reset_wavefronts(pdd->dev, p);
pdd->reset_wavefronts = false; pdd->reset_wavefronts = false;
} }
/* /*
* Just mark pdd as unbound, because we still need it to call * Just mark pdd as unbound, because we still need it
* amd_iommu_unbind_pasid() in when the process exits. * to call amd_iommu_unbind_pasid() in when the
* We don't call amd_iommu_unbind_pasid() here * process exits.
* because the IOMMU called us. * We don't call amd_iommu_unbind_pasid() here
*/ * because the IOMMU called us.
pdd->bound = false; */
pdd->bound = false;
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
return;
}
srcu_read_unlock(&kfd_processes_srcu, idx);
} }
struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p) struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p)
......
...@@ -666,7 +666,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, ...@@ -666,7 +666,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
dev->node_props.simd_count); dev->node_props.simd_count);
if (dev->mem_bank_count < dev->node_props.mem_banks_count) { if (dev->mem_bank_count < dev->node_props.mem_banks_count) {
pr_warn("kfd: mem_banks_count truncated from %d to %d\n", pr_info_once("kfd: mem_banks_count truncated from %d to %d\n",
dev->node_props.mem_banks_count, dev->node_props.mem_banks_count,
dev->mem_bank_count); dev->mem_bank_count);
sysfs_show_32bit_prop(buffer, "mem_banks_count", sysfs_show_32bit_prop(buffer, "mem_banks_count",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment