From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <ben@bwidawsk.net>
Subject: [PATCH 13/15] drm/i915: get/set scheduler type from debugfs
Date: Fri, 18 Nov 2011 18:24:30 -0800 [thread overview]
Message-ID: <1321669472-8045-14-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1321669472-8045-1-git-send-email-ben@bwidawsk.net>
Allows users to get and set the type of GPU scheduling done in the i915
driver.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
drivers/gpu/drm/i915/i915_debugfs.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 790875d..903a004 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1543,6 +1543,9 @@ static const struct file_operations i915_cache_sharing_fops = {
.llseek = default_llseek,
};
+static const char *sched_type[I915_SCHEDULER_INVALID] =
+ {"none", "fair"};
+
static ssize_t
i915_sched_read(struct file *filp,
char __user *ubuf,
@@ -1552,7 +1555,7 @@ i915_sched_read(struct file *filp,
struct drm_device *dev = filp->private_data;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_file_private *temp;
- unsigned high, low;
+ unsigned high, low, type;
size_t len = 0;
char *buf, *buf2;
struct {
@@ -1564,13 +1567,11 @@ i915_sched_read(struct file *filp,
} requests[20];
int entries, entry_size, i = 0, ret = 0;
- if (!i915_scheduler)
- return 0;
-
ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
return ret;
+ type = dev_priv->scheduler.type;
high = dev_priv->scheduler.high_watermark;
low = dev_priv->scheduler.low_watermark;
list_for_each_entry(temp, &dev_priv->i915_client_list, client_link) {
@@ -1600,7 +1601,7 @@ i915_sched_read(struct file *filp,
"Scheduler = %s\n"
"High watermark = %d buffers\n"
"Low watermark = %d buffers\n",
- buf2, "fair", high, low);
+ buf2, sched_type[type], high, low);
len = strlen(buf);
@@ -1620,7 +1621,7 @@ i915_sched_write(struct file *filp,
struct drm_device *dev = filp->private_data;
struct drm_i915_private *dev_priv = dev->dev_private;
char *buf, *ptr;
- uint32_t high, low;
+ uint32_t high, low, type;
int ret;
buf = drm_malloc_ab(cnt + 1, 1);
@@ -1637,11 +1638,21 @@ i915_sched_write(struct file *filp,
low = dev_priv->scheduler.low_watermark;
high = dev_priv->scheduler.high_watermark;
+ type = dev_priv->scheduler.type;
buf[cnt] = 0;
ptr = buf;
while ((ptr != NULL) && *ptr != 0) {
+ if (!strncmp(ptr, "type=", 5)) {
+ char *tmp = strchr(ptr, '=');
+ if (tmp != NULL)
+ tmp += strspn(tmp, "= \t\n");
+ if (!strncmp("fair", tmp, 4))
+ type = I915_SCHEDULER_FAIR;
+ if (!strncmp("none", tmp, 4))
+ type = I915_SCHEDULER_NONE;
+ }
if (!strncmp(ptr, "high=", 5))
high = simple_strtoul(ptr + 5, NULL, 0);
if (!strncmp(ptr, "low=", 4))
@@ -1652,11 +1663,16 @@ i915_sched_write(struct file *filp,
}
if (high != dev_priv->scheduler.high_watermark ||
- low != dev_priv->scheduler.low_watermark) {
+ (low != dev_priv->scheduler.low_watermark) ||
+ (type != dev_priv->scheduler.type)) {
+ if (i915_gpu_idle(dev))
+ DRM_ERROR("Couldn't idle GPU before sched changes\n");
+ DRM_INFO("new type = %d\n", type);
DRM_INFO("new high = %d\n", high);
DRM_INFO("new low = %d\n", low);
dev_priv->scheduler.high_watermark = high;
dev_priv->scheduler.low_watermark = low;
+ dev_priv->scheduler.type = type;
}
mutex_unlock(&dev->struct_mutex);
--
1.7.7.3
next prev parent reply other threads:[~2011-11-19 2:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-19 2:24 [PATCH 00/15] [RFC] Forced throttling/scheduling Ben Widawsky
2011-11-19 2:24 ` [PATCH 01/15] drm/i915: refactor debugfs open function Ben Widawsky
2011-11-20 18:50 ` Kenneth Graunke
2011-11-19 2:24 ` [PATCH 02/15] drm/i915: refactor debugfs create functions Ben Widawsky
2011-11-19 2:24 ` [PATCH 03/15] drm/i915: relative_constants_mode race fix Ben Widawsky
2011-11-23 22:30 ` Ben Widawsky
2011-11-19 2:24 ` [PATCH 04/15] drm/i915: drop lock support for i915_wait_request Ben Widawsky
2011-11-19 2:24 ` [PATCH 05/15] drm/i915: remove mm structure from file_priv Ben Widawsky
2011-11-19 2:24 ` [PATCH 06/15] drm/i915: Keep track of drm_file in file_priv Ben Widawsky
2011-11-19 2:24 ` [PATCH 07/15] drm/i915: Keep track of request counts Ben Widawsky
2011-11-19 2:24 ` [PATCH 08/15] drm/i915: fairness Ben Widawsky
2011-11-19 2:24 ` [PATCH 09/15] drm/i915: Keep track of open i915 clients Ben Widawsky
2011-11-19 2:24 ` [PATCH 10/15] drm/i915: debugfs entry for " Ben Widawsky
2011-11-19 2:24 ` [PATCH 11/15] drm/i915: debugfs entries for scheduler params Ben Widawsky
2011-11-19 2:24 ` [PATCH 12/15] drm/i915: infrastructure to support scheduler types Ben Widawsky
2011-11-19 2:24 ` Ben Widawsky [this message]
2011-11-19 2:24 ` [PATCH 14/15] drm/i915: Implement batch scheduler Ben Widawsky
2011-11-19 2:24 ` [PATCH 15/15] drm/i915: Add handling for batch parameters in debugfs Ben Widawsky
2011-11-29 14:30 ` [PATCH 00/15] [RFC] Forced throttling/scheduling Eugeni Dodonov
2012-04-02 18:28 ` Ben Widawsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321669472-8045-14-git-send-email-ben@bwidawsk.net \
--to=ben@bwidawsk.net \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).