[PATCH] drm/i915/gvt: install gvt core threads with high priority
Zhenyu Wang
zhenyuw at linux.intel.com
Thu Feb 1 08:16:12 UTC 2018
On 2018.02.01 14:11:05 +0800, Weinan Li wrote:
> GVT-g core threads current use the default priority which is same as host
> application, so if one application with heavy CPU workload running in host,
> it will impact the latency of GVT-g core threads. This patch set the core
> threads policy as FIFO and priority as high which is lower then i915 signal
> thread for improving the scheduling performance.
>
> Signed-off-by: Weinan Li <weinan.z.li at intel.com>
> ---
> drivers/gpu/drm/i915/gvt/gvt.c | 10 ++++++++++
> drivers/gpu/drm/i915/gvt/gvt.h | 2 ++
> drivers/gpu/drm/i915/gvt/scheduler.c | 3 +++
> 3 files changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
> index fac54f3..49006c5 100644
> --- a/drivers/gpu/drm/i915/gvt/gvt.c
> +++ b/drivers/gpu/drm/i915/gvt/gvt.c
> @@ -33,6 +33,7 @@
> #include <linux/types.h>
> #include <xen/xen.h>
> #include <linux/kthread.h>
> +#include <uapi/linux/sched/types.h>
>
> #include "i915_drv.h"
> #include "gvt.h"
> @@ -253,6 +254,12 @@ static void init_device_info(struct intel_gvt *gvt)
> info->msi_cap_offset = pdev->msi_cap;
> }
>
> +void set_gvt_thread_priority(void)
> +{
> + struct sched_param param = { .sched_priority = 10 };
> + sched_setscheduler_nocheck(current, SCHED_FIFO, ¶m);
> +}
Let's use name as intel_gvt_set_thread_priority() and might inline it too.
> +
> static int gvt_service_thread(void *data)
> {
> struct intel_gvt *gvt = (struct intel_gvt *)data;
> @@ -260,6 +267,9 @@ static int gvt_service_thread(void *data)
>
> gvt_dbg_core("service thread start\n");
>
> + /* Install ourselves with high priority to reduce scheduling latency */
> + set_gvt_thread_priority();
> +
> while (!kthread_should_stop()) {
> ret = wait_event_interruptible(gvt->service_thread_wq,
> kthread_should_stop() || gvt->service_request);
> diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
> index c88c489..262d281 100644
> --- a/drivers/gpu/drm/i915/gvt/gvt.h
> +++ b/drivers/gpu/drm/i915/gvt/gvt.h
> @@ -337,6 +337,8 @@ static inline void intel_gvt_request_service(struct intel_gvt *gvt,
> wake_up(&gvt->service_thread_wq);
> }
>
> +void set_gvt_thread_priority(void);
> +
> void intel_gvt_free_firmware(struct intel_gvt *gvt);
> int intel_gvt_load_firmware(struct intel_gvt *gvt);
>
> diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
> index b55b358..f71b917 100644
> --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> @@ -847,6 +847,9 @@ static int workload_thread(void *priv)
>
> gvt_dbg_core("workload thread for ring %d started\n", ring_id);
>
> + /* Install ourselves with high priority to reduce scheduling latency */
> + set_gvt_thread_priority();
> +
> while (!kthread_should_stop()) {
> add_wait_queue(&scheduler->waitq[ring_id], &wait);
> do {
> --
> 1.9.1
>
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20180201/95316d01/attachment.sig>
More information about the intel-gvt-dev
mailing list