diff options
author | Chuanxiao Dong <chuanxiao.dong@intel.com> | 2017-02-17 06:29:52 -0500 |
---|---|---|
committer | Zhenyu Wang <zhenyuw@linux.intel.com> | 2017-02-23 04:32:13 -0500 |
commit | 9272f73f79bd780502134f227fa52fd280ecda17 (patch) | |
tree | d8596485a231f43d6b9b2389dbe2abaf53f56923 | |
parent | a33fc7a0482a40068c022aefcefd50f9f0f44f87 (diff) |
drm/i915/gvt: add a NULL pointer check to avoid kernel panic
Due to the request replay, context switch interrupt may come after
gvt free the workload thus can cause a kernel NULL pointer kernel
panic. This patch will add a simple check to avoid this for a short
term.
From long term, gvt workload lifecycle doesn't match with i915 request
and need to find a proper way to manage this.
v4: simplify the NULL pointer check.
v5: add unlikely to optimize.
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/gvt/scheduler.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c index d6b6d0efdd1a..e355a82ccabd 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.c +++ b/drivers/gpu/drm/i915/gvt/scheduler.c | |||
@@ -139,6 +139,9 @@ static int shadow_context_status_change(struct notifier_block *nb, | |||
139 | struct intel_vgpu_workload *workload = | 139 | struct intel_vgpu_workload *workload = |
140 | scheduler->current_workload[req->engine->id]; | 140 | scheduler->current_workload[req->engine->id]; |
141 | 141 | ||
142 | if (unlikely(!workload)) | ||
143 | return NOTIFY_OK; | ||
144 | |||
142 | switch (action) { | 145 | switch (action) { |
143 | case INTEL_CONTEXT_SCHEDULE_IN: | 146 | case INTEL_CONTEXT_SCHEDULE_IN: |
144 | intel_gvt_load_render_mmio(workload->vgpu, | 147 | intel_gvt_load_render_mmio(workload->vgpu, |