OSDN Git Service

drm/amdkfd: unbind only existing processes
authorOded Gabbay <oded.gabbay@gmail.com>
Thu, 26 May 2016 05:41:08 +0000 (08:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jul 2016 16:47:33 +0000 (09:47 -0700)
commitcf2e8061303f03be32a3c285cd06a73a42f7ceab
tree8aeb6d0310b51cb2cc9a00008e09188fc0c4471b
parentca8a32b2170621da0bb1807470917cf30a2af2c8
drm/amdkfd: unbind only existing processes

commit 121b78e679ee3ffab780115e260b2775d0cc1f73 upstream.

When unbinding a process from a device (initiated by amd_iommu_v2), the
driver needs to make sure that process still exists in the process table.
There is a possibility that amdkfd's own notifier handler -
kfd_process_notifier_release() - was called before the unbind function
and it already removed the process from the process table.

v2:
Because there can be only one process with the specified pasid, and
because *p can't be NULL inside the hash_for_each_rcu macro, it is more
reasonable to just put the whole code inside the if statement that
compares the pasid value. That way, when we exit hash_for_each_rcu, we
simply exit the function as well.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdkfd/kfd_process.c