[PATCH 1/2] drm/i915/gvt: support event based scheduling

Gao, Ping A ping.a.gao at intel.com
Tue May 16 07:52:34 UTC 2017


On 2017/5/16 13:22, Zhenyu Wang wrote:
> On 2017.05.12 12:50:29 +0800, Ping Gao wrote:
>> This patch decouple the time slice caculation and scheduler, let
>> other event be able to trigger scheduling without impact the
>> calcuation for QoS.
>>
>> Signed-off-by: Ping Gao <ping.a.gao at intel.com>
>> ---
>>  drivers/gpu/drm/i915/gvt/gvt.c          |  4 +++-
>>  drivers/gpu/drm/i915/gvt/gvt.h          |  3 ++-
>>  drivers/gpu/drm/i915/gvt/sched_policy.c | 17 +++++++++++------
>>  3 files changed, 16 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
>> index 7dea5e5..b429ea2 100644
>> --- a/drivers/gpu/drm/i915/gvt/gvt.c
>> +++ b/drivers/gpu/drm/i915/gvt/gvt.c
>> @@ -147,7 +147,9 @@ static int gvt_service_thread(void *data)
>>  			mutex_unlock(&gvt->lock);
>>  		}
>>  
>> -		if (test_and_clear_bit(INTEL_GVT_REQUEST_SCHED,
>> +		if (test_bit(INTEL_GVT_REQUEST_TIME_SCHED,
>> +				(void *)&gvt->service_request) ||
>> +			test_bit(INTEL_GVT_REQUEST_EVENT_SCHED,
>>  					(void *)&gvt->service_request)) {
>>  			intel_gvt_schedule(gvt);
>>  		}
>> diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
>> index 930732e..36c849f 100644
>> --- a/drivers/gpu/drm/i915/gvt/gvt.h
>> +++ b/drivers/gpu/drm/i915/gvt/gvt.h
>> @@ -257,7 +257,8 @@ static inline struct intel_gvt *to_gvt(struct drm_i915_private *i915)
>>  
>>  enum {
>>  	INTEL_GVT_REQUEST_EMULATE_VBLANK = 0,
>> -	INTEL_GVT_REQUEST_SCHED = 1,
>> +	INTEL_GVT_REQUEST_TIME_SCHED = 1,
>> +	INTEL_GVT_REQUEST_EVENT_SCHED = 2,
> This seems right thing to do, but more like to keep original define as request/event
> is mostly same thing. I know some people might not be favor of enum define and this
> changed order too. Could we just add a new TIME_SCHED and keep old SCHED? And better
> to have comment to describe request type.
>
> With that change, I'm fine with this series.

Thanks for review.  I will add TIME_SCHED only for next version.

>
>>  };
>>  
>>  static inline void intel_gvt_request_service(struct intel_gvt *gvt,
>> diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c
>> index f25ff13..febf560 100644
>> --- a/drivers/gpu/drm/i915/gvt/sched_policy.c
>> +++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
>> @@ -202,11 +202,6 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data)
>>  	struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler;
>>  	struct vgpu_sched_data *vgpu_data;
>>  	struct intel_vgpu *vgpu = NULL;
>> -	static uint64_t timer_check;
>> -
>> -	if (!(timer_check++ % GVT_TS_BALANCE_PERIOD_MS))
>> -		gvt_balance_timeslice(sched_data);
>> -
>>  	/* no active vgpu or has already had a target */
>>  	if (list_empty(&sched_data->lru_runq_head) || scheduler->next_vgpu)
>>  		goto out;
>> @@ -231,9 +226,19 @@ static void tbs_sched_func(struct gvt_sched_data *sched_data)
>>  void intel_gvt_schedule(struct intel_gvt *gvt)
>>  {
>>  	struct gvt_sched_data *sched_data = gvt->scheduler.sched_data;
>> +	static uint64_t timer_check;
>>  
>>  	mutex_lock(&gvt->lock);
>> +
>> +	if (test_and_clear_bit(INTEL_GVT_REQUEST_TIME_SCHED,
>> +				(void *)&gvt->service_request)) {
>> +		if (!(timer_check++ % GVT_TS_BALANCE_PERIOD_MS))
>> +			gvt_balance_timeslice(sched_data);
>> +	}
>> +	clear_bit(INTEL_GVT_REQUEST_EVENT_SCHED, (void *)&gvt->service_request);
>> +
>>  	tbs_sched_func(sched_data);
>> +
>>  	mutex_unlock(&gvt->lock);
>>  }
>>  
>> @@ -243,7 +248,7 @@ static enum hrtimer_restart tbs_timer_fn(struct hrtimer *timer_data)
>>  
>>  	data = container_of(timer_data, struct gvt_sched_data, timer);
>>  
>> -	intel_gvt_request_service(data->gvt, INTEL_GVT_REQUEST_SCHED);
>> +	intel_gvt_request_service(data->gvt, INTEL_GVT_REQUEST_TIME_SCHED);
>>  
>>  	hrtimer_add_expires_ns(&data->timer, data->period);
>>  
>> -- 
>> 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