[PATCH v2 3/9] drm/i915/gvt: insert the dummy vGPU into scheduler
Gao, Ping A
ping.a.gao at intel.com
Wed Feb 15 02:35:57 UTC 2017
On 2017/2/14 16:51, Tian, Kevin wrote:
>> From: Ping Gao
>> Sent: Tuesday, February 14, 2017 12:26 PM
>>
>> Let the dummy vGPU take part in scheduling, it has no real HW effect
>> as it's workload queue is always empty.
>>
>> Signed-off-by: Ping Gao <ping.a.gao at intel.com>
>> ---
>> drivers/gpu/drm/i915/gvt/gvt.c | 1 +
>> drivers/gpu/drm/i915/gvt/sched_policy.c | 6 +++---
>> 2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
>> index 7cd23dc..e41aa18 100644
>> --- a/drivers/gpu/drm/i915/gvt/gvt.c
>> +++ b/drivers/gpu/drm/i915/gvt/gvt.c
>> @@ -301,6 +301,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
>> goto out_clean_types;
>> }
>> gvt->dummy_vgpu = vgpu;
>> + intel_vgpu_start_schedule(vgpu);
>>
>> gvt_dbg_core("gvt device initialization is done\n");
>> dev_priv->gvt = gvt;
>> diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c
>> b/drivers/gpu/drm/i915/gvt/sched_policy.c
>> index e48bbad..ff6e104 100644
>> --- a/drivers/gpu/drm/i915/gvt/sched_policy.c
>> +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
>> @@ -114,7 +114,7 @@ static void tbs_sched_func(struct tbs_sched_data *sched_data)
>> struct list_head *pos, *head;
>>
>> /* no vgpu or has already had a target */
>> - if (list_empty(&sched_data->runq_head) || scheduler->next_vgpu)
>> + if (gvt->num_vgpu_sched <= 1 || scheduler->next_vgpu)
>> goto out;
>>
>> if (scheduler->current_vgpu) {
>> @@ -237,7 +237,7 @@ static void tbs_sched_start_schedule(struct intel_vgpu *vgpu)
>> list_add_tail(&vgpu_data->list, &sched_data->runq_head);
>>
>> vgpu->gvt->num_vgpu_sched++;
>> - if (vgpu->gvt->num_vgpu_sched == 1)
>> + if (vgpu->gvt->num_vgpu_sched == 2)
> please define some macro or inline function for such purpose. It's
> not maintainable just doing number changes.
Sure, I will change it.
> also is it really necessary to actually add dummy vGPU into the
> schedule list? Can it be directly referred to in scheduler code
> when required?
Possible can used it directly as need; But if we move dummy vGPU out of
the schedule list, when the dummy vGPU become current_vgpu, it's not
easy to find next vGPU base on the alone idle vGPU, there will bring
some unclear logic to find next one. Besides that follow patchs will
dynamic change the schedule list to avoid unfairness, alone dummy vGPU
will make those things difficult.
>> hrtimer_start(&sched_data->timer, ktime_add_ns(ktime_get(),
>> sched_data->period), HRTIMER_MODE_ABS);
>> }
>> @@ -253,7 +253,7 @@ static void tbs_sched_stop_schedule(struct intel_vgpu *vgpu)
>> list_del_init(&vgpu_data->list);
>>
>> vgpu->gvt->num_vgpu_sched--;
>> - if (vgpu->gvt->num_vgpu_sched == 0)
>> + if (vgpu->gvt->num_vgpu_sched == 1)
>> hrtimer_cancel(&sched_data->timer);
>> }
>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> intel-gvt-dev mailing list
>> intel-gvt-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
More information about the intel-gvt-dev
mailing list