* [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs
@ 2023-04-27 12:45 Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init Tvrtko Ursulin
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2023-04-27 12:45 UTC (permalink / raw)
To: Intel-gfx, dri-devel
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
From patch 4:
User feedback indicates significant performance gains are possible in
specific games with non default RPS up/down thresholds.
Expose these tunables via sysfs which will allow users to achieve best
performance when running games and best power efficiency elsewhere.
Note this patch supports non GuC based platforms only.
References: https://gitlab.freedesktop.org/drm/intel/-/issues/8389
Issue 8389 suggests 10-15% performance gains are possible with tweaked
thresholds.
One question is are we able to find a "one size fits all" values.
However regardless of that, given we already expose frequency controls in sysfs
with the same reasoning of allowing system owners explicit control if so wanted,
I think exposing the thresholds can be equally justified.
Tvrtko Ursulin (4):
drm/i915: Move setting of rps thresholds to init
drm/i915: Record default rps threshold values
drm/i915: Add helpers for managing rps thresholds
drm/i915: Expose RPS thresholds in sysfs
drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 104 ++++++++++++++++++++
drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 +
drivers/gpu/drm/i915/gt/intel_rps.c | 65 +++++++++---
drivers/gpu/drm/i915/gt/intel_rps.h | 4 +
4 files changed, 165 insertions(+), 11 deletions(-)
--
2.37.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init
2023-04-27 12:45 [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs Tvrtko Ursulin
@ 2023-04-27 12:45 ` Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 2/4] drm/i915: Record default rps threshold values Tvrtko Ursulin
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2023-04-27 12:45 UTC (permalink / raw)
To: Intel-gfx, dri-devel
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Since 36d516be867c ("drm/i915/gt: Switch to manual evaluation of RPS")
thresholds are invariant so lets move their setting to init time.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/gt/intel_rps.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 80968e49e2c3..05ce71ec5add 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -670,7 +670,6 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
{
struct intel_gt *gt = rps_to_gt(rps);
struct intel_uncore *uncore = gt->uncore;
- u32 threshold_up = 0, threshold_down = 0; /* in % */
u32 ei_up = 0, ei_down = 0;
lockdep_assert_held(&rps->power.mutex);
@@ -678,9 +677,6 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
if (new_power == rps->power.mode)
return;
- threshold_up = 95;
- threshold_down = 85;
-
/* Note the units here are not exactly 1us, but 1280ns. */
switch (new_power) {
case LOW_POWER:
@@ -707,17 +703,22 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
GT_TRACE(gt,
"changing power mode [%d], up %d%% @ %dus, down %d%% @ %dus\n",
- new_power, threshold_up, ei_up, threshold_down, ei_down);
+ new_power,
+ rps->power.up_threshold, ei_up,
+ rps->power.down_threshold, ei_down);
set(uncore, GEN6_RP_UP_EI,
intel_gt_ns_to_pm_interval(gt, ei_up * 1000));
set(uncore, GEN6_RP_UP_THRESHOLD,
- intel_gt_ns_to_pm_interval(gt, ei_up * threshold_up * 10));
+ intel_gt_ns_to_pm_interval(gt,
+ ei_up * rps->power.up_threshold * 10));
set(uncore, GEN6_RP_DOWN_EI,
intel_gt_ns_to_pm_interval(gt, ei_down * 1000));
set(uncore, GEN6_RP_DOWN_THRESHOLD,
- intel_gt_ns_to_pm_interval(gt, ei_down * threshold_down * 10));
+ intel_gt_ns_to_pm_interval(gt,
+ ei_down *
+ rps->power.down_threshold * 10));
set(uncore, GEN6_RP_CONTROL,
(GRAPHICS_VER(gt->i915) > 9 ? 0 : GEN6_RP_MEDIA_TURBO) |
@@ -729,8 +730,6 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
skip_hw_write:
rps->power.mode = new_power;
- rps->power.up_threshold = threshold_up;
- rps->power.down_threshold = threshold_down;
}
static void gen6_rps_set_thresholds(struct intel_rps *rps, u8 val)
@@ -1556,10 +1555,12 @@ void intel_rps_enable(struct intel_rps *rps)
return;
GT_TRACE(rps_to_gt(rps),
- "min:%x, max:%x, freq:[%d, %d]\n",
+ "min:%x, max:%x, freq:[%d, %d], thresholds:[%u, %u]\n",
rps->min_freq, rps->max_freq,
intel_gpu_freq(rps, rps->min_freq),
- intel_gpu_freq(rps, rps->max_freq));
+ intel_gpu_freq(rps, rps->max_freq),
+ rps->power.threshold_up,
+ rps->power.threshold_down);
GEM_BUG_ON(rps->max_freq < rps->min_freq);
GEM_BUG_ON(rps->idle_freq > rps->max_freq);
@@ -2012,6 +2013,10 @@ void intel_rps_init(struct intel_rps *rps)
}
}
+ /* Set default thresholds in % */
+ rps->power.up_threshold = 95;
+ rps->power.down_threshold = 85;
+
/* Finally allow us to boost to max by default */
rps->boost_freq = rps->max_freq;
rps->idle_freq = rps->min_freq;
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] [RFC 2/4] drm/i915: Record default rps threshold values
2023-04-27 12:45 [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init Tvrtko Ursulin
@ 2023-04-27 12:45 ` Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 3/4] drm/i915: Add helpers for managing rps thresholds Tvrtko Ursulin
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2023-04-27 12:45 UTC (permalink / raw)
To: Intel-gfx, dri-devel
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Record the default values as preparation for exposing the sysfs controls.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 +++
drivers/gpu/drm/i915/gt/intel_rps.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
index f08c2556aa25..1b22d7a50665 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
@@ -83,6 +83,9 @@ enum intel_submission_method {
struct gt_defaults {
u32 min_freq;
u32 max_freq;
+
+ u8 rps_up_threshold;
+ u8 rps_down_threshold;
};
enum intel_gt_type {
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 05ce71ec5add..343a50188c5e 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -2015,7 +2015,9 @@ void intel_rps_init(struct intel_rps *rps)
/* Set default thresholds in % */
rps->power.up_threshold = 95;
+ rps_to_gt(rps)->defaults.rps_up_threshold = rps->power.up_threshold;
rps->power.down_threshold = 85;
+ rps_to_gt(rps)->defaults.rps_down_threshold = rps->power.down_threshold;
/* Finally allow us to boost to max by default */
rps->boost_freq = rps->max_freq;
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] [RFC 3/4] drm/i915: Add helpers for managing rps thresholds
2023-04-27 12:45 [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 2/4] drm/i915: Record default rps threshold values Tvrtko Ursulin
@ 2023-04-27 12:45 ` Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 4/4] drm/i915: Expose RPS thresholds in sysfs Tvrtko Ursulin
2023-04-27 16:14 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
4 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2023-04-27 12:45 UTC (permalink / raw)
To: Intel-gfx, dri-devel
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
In preparation for exposing via sysfs add helpers for managing rps
thresholds.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/gt/intel_rps.c | 36 +++++++++++++++++++++++++++++
drivers/gpu/drm/i915/gt/intel_rps.h | 4 ++++
2 files changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 343a50188c5e..c02b7104d11e 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -2573,6 +2573,42 @@ int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val)
return set_min_freq(rps, val);
}
+u8 intel_rps_get_up_threshold(struct intel_rps *rps)
+{
+ return rps->power.up_threshold;
+}
+
+static int rps_set_threshold(struct intel_rps *rps, u8 *threshold, u8 val)
+{
+ int ret;
+
+ if (val > 100)
+ return -EINVAL;
+
+ ret = mutex_lock_interruptible(&rps->lock);
+ if (ret)
+ return ret;
+ *threshold = val;
+ mutex_unlock(&rps->lock);
+
+ return 0;
+}
+
+int intel_rps_set_up_threshold(struct intel_rps *rps, u8 threshold)
+{
+ return rps_set_threshold(rps, &rps->power.up_threshold, threshold);
+}
+
+u8 intel_rps_get_down_threshold(struct intel_rps *rps)
+{
+ return rps->power.down_threshold;
+}
+
+int intel_rps_set_down_threshold(struct intel_rps *rps, u8 threshold)
+{
+ return rps_set_threshold(rps, &rps->power.down_threshold, threshold);
+}
+
static void intel_rps_set_manual(struct intel_rps *rps, bool enable)
{
struct intel_uncore *uncore = rps_to_uncore(rps);
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
index a3fa987aa91f..92fb01f5a452 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.h
+++ b/drivers/gpu/drm/i915/gt/intel_rps.h
@@ -37,6 +37,10 @@ void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive);
int intel_gpu_freq(struct intel_rps *rps, int val);
int intel_freq_opcode(struct intel_rps *rps, int val);
+u8 intel_rps_get_up_threshold(struct intel_rps *rps);
+int intel_rps_set_up_threshold(struct intel_rps *rps, u8 threshold);
+u8 intel_rps_get_down_threshold(struct intel_rps *rps);
+int intel_rps_set_down_threshold(struct intel_rps *rps, u8 threshold);
u32 intel_rps_read_actual_frequency(struct intel_rps *rps);
u32 intel_rps_read_actual_frequency_fw(struct intel_rps *rps);
u32 intel_rps_get_requested_frequency(struct intel_rps *rps);
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] [RFC 4/4] drm/i915: Expose RPS thresholds in sysfs
2023-04-27 12:45 [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs Tvrtko Ursulin
` (2 preceding siblings ...)
2023-04-27 12:45 ` [Intel-gfx] [RFC 3/4] drm/i915: Add helpers for managing rps thresholds Tvrtko Ursulin
@ 2023-04-27 12:45 ` Tvrtko Ursulin
2023-04-27 16:14 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
4 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2023-04-27 12:45 UTC (permalink / raw)
To: Intel-gfx, dri-devel
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
User feedback indicates significant performance gains are possible in
specific games with non default RPS up/down thresholds.
Expose these tunables via sysfs which will allow users to achieve best
performance when running games and best power efficiency elsewhere.
Note this patch supports non GuC based platforms only.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
References: https://gitlab.freedesktop.org/drm/intel/-/issues/8389
---
drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 104 ++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
index 28f27091cd3b..df1f9ef08475 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
@@ -671,6 +671,76 @@ static const struct attribute *media_perf_power_attrs[] = {
NULL
};
+static ssize_t
+rps_up_threshold_pct_show(struct kobject *kobj, struct kobj_attribute *attr,
+ char *buf)
+{
+ struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
+ struct intel_rps *rps = >->rps;
+
+ return sysfs_emit(buf, "%u\n", intel_rps_get_up_threshold(rps));
+}
+
+static ssize_t
+rps_up_threshold_pct_store(struct kobject *kobj, struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
+ struct intel_rps *rps = >->rps;
+ int ret;
+ u8 val;
+
+ ret = kstrtou8(buf, 10, &val);
+ if (ret)
+ return ret;
+
+ ret = intel_rps_set_up_threshold(rps, val);
+
+ return ret == 0 ? count : ret;
+}
+
+static struct kobj_attribute rps_up_threshold_pct =
+__ATTR(rps_up_threshold_pct, 0664,
+ rps_up_threshold_pct_show, rps_up_threshold_pct_store);
+
+static ssize_t
+rps_down_threshold_pct_show(struct kobject *kobj, struct kobj_attribute *attr,
+ char *buf)
+{
+ struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
+ struct intel_rps *rps = >->rps;
+
+ return sysfs_emit(buf, "%u\n", intel_rps_get_down_threshold(rps));
+}
+
+static ssize_t
+rps_down_threshold_pct_store(struct kobject *kobj, struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
+ struct intel_rps *rps = >->rps;
+ int ret;
+ u8 val;
+
+ ret = kstrtou8(buf, 10, &val);
+ if (ret)
+ return ret;
+
+ ret = intel_rps_set_down_threshold(rps, val);
+
+ return ret == 0 ? count : ret;
+}
+
+static struct kobj_attribute rps_down_threshold_pct =
+__ATTR(rps_down_threshold_pct, 0664,
+ rps_down_threshold_pct_show, rps_down_threshold_pct_store);
+
+static const struct attribute * const gen6_gt_rps_attrs[] = {
+ &rps_up_threshold_pct.attr,
+ &rps_down_threshold_pct.attr,
+ NULL
+};
+
static ssize_t
default_min_freq_mhz_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
@@ -693,9 +763,37 @@ default_max_freq_mhz_show(struct kobject *kobj, struct kobj_attribute *attr, cha
static struct kobj_attribute default_max_freq_mhz =
__ATTR(rps_max_freq_mhz, 0444, default_max_freq_mhz_show, NULL);
+static ssize_t
+default_rps_up_threshold_pct_show(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ char *buf)
+{
+ struct intel_gt *gt = kobj_to_gt(kobj->parent);
+
+ return sysfs_emit(buf, "%u\n", gt->defaults.rps_up_threshold);
+}
+
+static struct kobj_attribute default_rps_up_threshold_pct =
+__ATTR(rps_up_threshold_pct, 0444, default_rps_up_threshold_pct_show, NULL);
+
+static ssize_t
+default_rps_down_threshold_pct_show(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ char *buf)
+{
+ struct intel_gt *gt = kobj_to_gt(kobj->parent);
+
+ return sysfs_emit(buf, "%u\n", gt->defaults.rps_down_threshold);
+}
+
+static struct kobj_attribute default_rps_down_threshold_pct =
+__ATTR(rps_down_threshold_pct, 0444, default_rps_down_threshold_pct_show, NULL);
+
static const struct attribute * const rps_defaults_attrs[] = {
&default_min_freq_mhz.attr,
&default_max_freq_mhz.attr,
+ &default_rps_up_threshold_pct.attr,
+ &default_rps_down_threshold_pct.attr,
NULL
};
@@ -723,6 +821,12 @@ static int intel_sysfs_rps_init(struct intel_gt *gt, struct kobject *kobj)
if (IS_VALLEYVIEW(gt->i915) || IS_CHERRYVIEW(gt->i915))
ret = sysfs_create_file(kobj, vlv_attr);
+ if (is_object_gt(kobj) && !intel_uc_uses_guc_slpc(>->uc)) {
+ ret = sysfs_create_files(kobj, gen6_gt_rps_attrs);
+ if (ret)
+ return ret;
+ }
+
return ret;
}
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BUILD: failure for Expose RPS thresholds in sysfs
2023-04-27 12:45 [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs Tvrtko Ursulin
` (3 preceding siblings ...)
2023-04-27 12:45 ` [Intel-gfx] [RFC 4/4] drm/i915: Expose RPS thresholds in sysfs Tvrtko Ursulin
@ 2023-04-27 16:14 ` Patchwork
4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2023-04-27 16:14 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: intel-gfx
== Series Details ==
Series: Expose RPS thresholds in sysfs
URL : https://patchwork.freedesktop.org/series/117054/
State : failure
== Summary ==
Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] drivers/gpu/drm/i915/gt/intel_rps.o
In file included from ./include/linux/interrupt.h:6,
from ./include/drm/drm_util.h:35,
from ./drivers/gpu/drm/i915/display/intel_display.h:28,
from drivers/gpu/drm/i915/gt/intel_rps.c:10:
drivers/gpu/drm/i915/gt/intel_rps.c: In function ‘intel_rps_enable’:
drivers/gpu/drm/i915/gt/intel_rps.c:1562:14: error: ‘struct <anonymous>’ has no member named ‘threshold_up’
1562 | rps->power.threshold_up,
| ^
./include/linux/kernel.h:337:40: note: in definition of macro ‘__trace_printk_check_format’
337 | ____trace_printk_check_format(fmt, ##args); \
| ^~~~
./include/linux/kernel.h:374:3: note: in expansion of macro ‘do_trace_printk’
374 | do_trace_printk(fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_gem.h:119:24: note: in expansion of macro ‘trace_printk’
119 | #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.h:18:2: note: in expansion of macro ‘GEM_TRACE’
18 | GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
| ^~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1557:2: note: in expansion of macro ‘GT_TRACE’
1557 | GT_TRACE(rps_to_gt(rps),
| ^~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1563:14: error: ‘struct <anonymous>’ has no member named ‘threshold_down’
1563 | rps->power.threshold_down);
| ^
./include/linux/kernel.h:337:40: note: in definition of macro ‘__trace_printk_check_format’
337 | ____trace_printk_check_format(fmt, ##args); \
| ^~~~
./include/linux/kernel.h:374:3: note: in expansion of macro ‘do_trace_printk’
374 | do_trace_printk(fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_gem.h:119:24: note: in expansion of macro ‘trace_printk’
119 | #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.h:18:2: note: in expansion of macro ‘GEM_TRACE’
18 | GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
| ^~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1557:2: note: in expansion of macro ‘GT_TRACE’
1557 | GT_TRACE(rps_to_gt(rps),
| ^~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1562:14: error: ‘struct <anonymous>’ has no member named ‘threshold_up’
1562 | rps->power.threshold_up,
| ^
./include/linux/kernel.h:388:50: note: in definition of macro ‘do_trace_printk’
388 | __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
| ^~~~
./drivers/gpu/drm/i915/i915_gem.h:119:24: note: in expansion of macro ‘trace_printk’
119 | #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.h:18:2: note: in expansion of macro ‘GEM_TRACE’
18 | GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
| ^~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1557:2: note: in expansion of macro ‘GT_TRACE’
1557 | GT_TRACE(rps_to_gt(rps),
| ^~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1563:14: error: ‘struct <anonymous>’ has no member named ‘threshold_down’
1563 | rps->power.threshold_down);
| ^
./include/linux/kernel.h:388:50: note: in definition of macro ‘do_trace_printk’
388 | __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
| ^~~~
./drivers/gpu/drm/i915/i915_gem.h:119:24: note: in expansion of macro ‘trace_printk’
119 | #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.h:18:2: note: in expansion of macro ‘GEM_TRACE’
18 | GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
| ^~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1557:2: note: in expansion of macro ‘GT_TRACE’
1557 | GT_TRACE(rps_to_gt(rps),
| ^~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1562:14: error: ‘struct <anonymous>’ has no member named ‘threshold_up’
1562 | rps->power.threshold_up,
| ^
./include/linux/kernel.h:390:36: note: in definition of macro ‘do_trace_printk’
390 | __trace_printk(_THIS_IP_, fmt, ##args); \
| ^~~~
./drivers/gpu/drm/i915/i915_gem.h:119:24: note: in expansion of macro ‘trace_printk’
119 | #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.h:18:2: note: in expansion of macro ‘GEM_TRACE’
18 | GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
| ^~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1557:2: note: in expansion of macro ‘GT_TRACE’
1557 | GT_TRACE(rps_to_gt(rps),
| ^~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1563:14: error: ‘struct <anonymous>’ has no member named ‘threshold_down’
1563 | rps->power.threshold_down);
| ^
./include/linux/kernel.h:390:36: note: in definition of macro ‘do_trace_printk’
390 | __trace_printk(_THIS_IP_, fmt, ##args); \
| ^~~~
./drivers/gpu/drm/i915/i915_gem.h:119:24: note: in expansion of macro ‘trace_printk’
119 | #define GEM_TRACE(...) trace_printk(__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/i915/gt/intel_gt.h:18:2: note: in expansion of macro ‘GEM_TRACE’
18 | GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
| ^~~~~~~~~
drivers/gpu/drm/i915/gt/intel_rps.c:1557:2: note: in expansion of macro ‘GT_TRACE’
1557 | GT_TRACE(rps_to_gt(rps),
| ^~~~~~~~
make[5]: *** [scripts/Makefile.build:252: drivers/gpu/drm/i915/gt/intel_rps.o] Error 1
make[4]: *** [scripts/Makefile.build:494: drivers/gpu/drm/i915] Error 2
make[3]: *** [scripts/Makefile.build:494: drivers/gpu/drm] Error 2
make[2]: *** [scripts/Makefile.build:494: drivers/gpu] Error 2
make[1]: *** [scripts/Makefile.build:494: drivers] Error 2
make: *** [Makefile:2025: .] Error 2
Build failed, no error log produced
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init
2023-04-28 8:14 [Intel-gfx] [RFC v2 0/4] " Tvrtko Ursulin
@ 2023-04-28 8:14 ` Tvrtko Ursulin
0 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2023-04-28 8:14 UTC (permalink / raw)
To: Intel-gfx, dri-devel
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Since 36d516be867c ("drm/i915/gt: Switch to manual evaluation of RPS")
thresholds are invariant so lets move their setting to init time.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/gt/intel_rps.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 80968e49e2c3..d78699e2b13b 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -670,7 +670,6 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
{
struct intel_gt *gt = rps_to_gt(rps);
struct intel_uncore *uncore = gt->uncore;
- u32 threshold_up = 0, threshold_down = 0; /* in % */
u32 ei_up = 0, ei_down = 0;
lockdep_assert_held(&rps->power.mutex);
@@ -678,9 +677,6 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
if (new_power == rps->power.mode)
return;
- threshold_up = 95;
- threshold_down = 85;
-
/* Note the units here are not exactly 1us, but 1280ns. */
switch (new_power) {
case LOW_POWER:
@@ -707,17 +703,22 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
GT_TRACE(gt,
"changing power mode [%d], up %d%% @ %dus, down %d%% @ %dus\n",
- new_power, threshold_up, ei_up, threshold_down, ei_down);
+ new_power,
+ rps->power.up_threshold, ei_up,
+ rps->power.down_threshold, ei_down);
set(uncore, GEN6_RP_UP_EI,
intel_gt_ns_to_pm_interval(gt, ei_up * 1000));
set(uncore, GEN6_RP_UP_THRESHOLD,
- intel_gt_ns_to_pm_interval(gt, ei_up * threshold_up * 10));
+ intel_gt_ns_to_pm_interval(gt,
+ ei_up * rps->power.up_threshold * 10));
set(uncore, GEN6_RP_DOWN_EI,
intel_gt_ns_to_pm_interval(gt, ei_down * 1000));
set(uncore, GEN6_RP_DOWN_THRESHOLD,
- intel_gt_ns_to_pm_interval(gt, ei_down * threshold_down * 10));
+ intel_gt_ns_to_pm_interval(gt,
+ ei_down *
+ rps->power.down_threshold * 10));
set(uncore, GEN6_RP_CONTROL,
(GRAPHICS_VER(gt->i915) > 9 ? 0 : GEN6_RP_MEDIA_TURBO) |
@@ -729,8 +730,6 @@ static void rps_set_power(struct intel_rps *rps, int new_power)
skip_hw_write:
rps->power.mode = new_power;
- rps->power.up_threshold = threshold_up;
- rps->power.down_threshold = threshold_down;
}
static void gen6_rps_set_thresholds(struct intel_rps *rps, u8 val)
@@ -1556,10 +1555,12 @@ void intel_rps_enable(struct intel_rps *rps)
return;
GT_TRACE(rps_to_gt(rps),
- "min:%x, max:%x, freq:[%d, %d]\n",
+ "min:%x, max:%x, freq:[%d, %d], thresholds:[%u, %u]\n",
rps->min_freq, rps->max_freq,
intel_gpu_freq(rps, rps->min_freq),
- intel_gpu_freq(rps, rps->max_freq));
+ intel_gpu_freq(rps, rps->max_freq),
+ rps->power.up_threshold,
+ rps->power.down_threshold);
GEM_BUG_ON(rps->max_freq < rps->min_freq);
GEM_BUG_ON(rps->idle_freq > rps->max_freq);
@@ -2012,6 +2013,10 @@ void intel_rps_init(struct intel_rps *rps)
}
}
+ /* Set default thresholds in % */
+ rps->power.up_threshold = 95;
+ rps->power.down_threshold = 85;
+
/* Finally allow us to boost to max by default */
rps->boost_freq = rps->max_freq;
rps->idle_freq = rps->min_freq;
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-28 8:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-27 12:45 [Intel-gfx] [RFC 0/4] Expose RPS thresholds in sysfs Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 2/4] drm/i915: Record default rps threshold values Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 3/4] drm/i915: Add helpers for managing rps thresholds Tvrtko Ursulin
2023-04-27 12:45 ` [Intel-gfx] [RFC 4/4] drm/i915: Expose RPS thresholds in sysfs Tvrtko Ursulin
2023-04-27 16:14 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-04-28 8:14 [Intel-gfx] [RFC v2 0/4] " Tvrtko Ursulin
2023-04-28 8:14 ` [Intel-gfx] [RFC 1/4] drm/i915: Move setting of rps thresholds to init Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox