[PATCH] drm/i915/gvt: install gvt core threads with high priority
Weinan Li
weinan.z.li at intel.com
Thu Feb 1 06:11:05 UTC 2018
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);
+}
+
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
More information about the intel-gvt-dev
mailing list