diff options
author | Yan Zhao <yan.y.zhao@intel.com> | 2019-03-27 05:55:45 +0100 |
---|---|---|
committer | Zhenyu Wang <zhenyuw@linux.intel.com> | 2019-03-29 03:27:42 +0100 |
commit | 663a50ceac75c2208d2ad95365bc8382fd42f44d (patch) | |
tree | acf9b544b07b6fd2d9142ba146e9286aea27cf63 | |
parent | drm/i915/gvt: do not deliver a workload if its creation fails (diff) | |
download | linux-663a50ceac75c2208d2ad95365bc8382fd42f44d.tar.xz linux-663a50ceac75c2208d2ad95365bc8382fd42f44d.zip |
drm/i915/gvt: do not let pin count of shadow mm go negative
shadow mm's pin count got increased in workload preparation phase, which
is after workload scanning.
it will get decreased in complete_current_workload() anyway after
workload completion.
Sometimes, if a workload meets a scanning error, its shadow mm pin count
will not get increased but will get decreased in the end.
This patch lets shadow mm's pin count not go below 0.
Fixes: 2707e4446688 ("drm/i915/gvt: vGPU graphics memory virtualization")
Cc: zhenyuw@linux.intel.com
Cc: stable@vger.kernel.org #4.14+
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/gvt/gtt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c index d7052ab7908c..cf133ef03873 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c @@ -1946,7 +1946,7 @@ void _intel_vgpu_mm_release(struct kref *mm_ref) */ void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm) { - atomic_dec(&mm->pincount); + atomic_dec_if_positive(&mm->pincount); } /** |