提交 440a9b9f 编写于 作者: C Changbin Du 提交者: Zhenyu Wang

drm/i915/gvt: dec vgpu->running_workload_num after the workload is really done

The vgpu->running_workload_num is used to determine whether a vgpu has
any workload running or not. So we should make sure the workload is
really done before we dec running_workload_num. Function
complete_current_workload is not the right place to do it, since this
function is still processing the workload. This patch move the dec op
afterward.

v2: move dec op before wake_up(&scheduler->workload_complete_wq) (Min He)
Signed-off-by: NChangbin Du <changbin.du@intel.com>
Reviewed-by: NMin He <min.he@intel.com>
Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
上级 2e51ef32
...@@ -350,13 +350,15 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) ...@@ -350,13 +350,15 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id)
{ {
struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler;
struct intel_vgpu_workload *workload; struct intel_vgpu_workload *workload;
struct intel_vgpu *vgpu;
int event; int event;
mutex_lock(&gvt->lock); mutex_lock(&gvt->lock);
workload = scheduler->current_workload[ring_id]; workload = scheduler->current_workload[ring_id];
vgpu = workload->vgpu;
if (!workload->status && !workload->vgpu->resetting) { if (!workload->status && !vgpu->resetting) {
wait_event(workload->shadow_ctx_status_wq, wait_event(workload->shadow_ctx_status_wq,
!atomic_read(&workload->shadow_ctx_active)); !atomic_read(&workload->shadow_ctx_active));
...@@ -364,8 +366,7 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) ...@@ -364,8 +366,7 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id)
for_each_set_bit(event, workload->pending_events, for_each_set_bit(event, workload->pending_events,
INTEL_GVT_EVENT_MAX) INTEL_GVT_EVENT_MAX)
intel_vgpu_trigger_virtual_event(workload->vgpu, intel_vgpu_trigger_virtual_event(vgpu, event);
event);
} }
gvt_dbg_sched("ring id %d complete workload %p status %d\n", gvt_dbg_sched("ring id %d complete workload %p status %d\n",
...@@ -373,11 +374,10 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) ...@@ -373,11 +374,10 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id)
scheduler->current_workload[ring_id] = NULL; scheduler->current_workload[ring_id] = NULL;
atomic_dec(&workload->vgpu->running_workload_num);
list_del_init(&workload->list); list_del_init(&workload->list);
workload->complete(workload); workload->complete(workload);
atomic_dec(&vgpu->running_workload_num);
wake_up(&scheduler->workload_complete_wq); wake_up(&scheduler->workload_complete_wq);
mutex_unlock(&gvt->lock); mutex_unlock(&gvt->lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册