Skip to contentSkip to conversation

drm/i915: Debugfs disable RPS boost and idle

PATCH Superseded Daisy Sun 4 participants 4 messages Apr 28, 2014 – Apr 29, 2014

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Daisy Sun

author
#0 lore raw

PATCH v2 1/1 drm/i915: Debugfs disable RPS boost and idle

RP frequency request is affected by 2 modules: normal turbo algorithm and RPS boost algorithm. By adding RPS boost algorithm to the mix, the final frequency becomes relatively unpredictable. Add a switch to enable/disable RPS boost functionality. When disabled, RP frequency will follow the normal turbo algorithm only.

Intention: when boost and idle are disabled, we have a clear vision of turbo algorithm. It‘s very helpful to verify if the turbo algorithm is working as expected.
Without debugfs hooks, the RPS boost or idle may kicks in at anytime and any circumstances.

V1->V2: Follow Daniel's comment to explain the intention.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 40 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_pm.c     |  8 ++++++--
 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +40 -0
index 1e83ae4..ff71214 100644
@@ -3486,6 +3486,45 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops,
 			i915_drop_caches_get, i915_drop_caches_set,
 			"0x%08llx\n");
 
+static int i915_rps_disable_boost_get(void *data, u64 *val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (INTEL_INFO(dev)->gen < 6)
+		return -ENODEV;
+
+	*val = dev_priv->rps.debugfs_disable_boost;
+
+	return 0;
+}
+
+static int i915_rps_disable_boost_set(void *data, u64 val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret;
+
+	flush_delayed_work(&dev_priv->rps.delayed_resume_work);
+
+	DRM_DEBUG_DRIVER("Setting RPS disable Boost-Idle mode to %s\n",
+				 val ? "on" : "off");
+
+	ret = mutex_lock_interruptible(&dev_priv->rps.hw_lock);
+	if (ret)
+		return ret;
+
+	dev_priv->rps.debugfs_disable_boost = val;
+
+	mutex_unlock(&dev_priv->rps.hw_lock);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(i915_rps_disable_boost_fops,
+		i915_rps_disable_boost_get, i915_rps_disable_boost_set,
+			"%llu\n");
+
 static int
 i915_max_freq_get(void *data, u64 *val)
 {
@@ -3821,6 +3860,7 @@ static const struct i915_debugfs_files {
 	{"i915_wedged", &i915_wedged_fops},
 	{"i915_max_freq", &i915_max_freq_fops},
 	{"i915_min_freq", &i915_min_freq_fops},
+	{"i915_rps_disable_boost", &i915_rps_disable_boost_fops},
 	{"i915_cache_sharing", &i915_cache_sharing_fops},
 	{"i915_ring_stop", &i915_ring_stop_fops},
 	{"i915_ring_missed_irq", &i915_ring_missed_irq_fops},
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 272aa7a..9c427da 100644
@@ -847,6 +847,7 @@ struct intel_gen6_power_mgmt {
 	int last_adj;
 	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
 
+	bool debugfs_disable_boost;
 	bool enabled;
 	struct delayed_work delayed_resume_work;
 
drivers/gpu/drm/i915/intel_pm.c +6 -2
index 75c1c76..6acac14 100644
@@ -3163,7 +3163,9 @@ void gen6_rps_idle(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 
 	mutex_lock(&dev_priv->rps.hw_lock);
-	if (dev_priv->rps.enabled) {
+
+	if (dev_priv->rps.enabled
+		&& !dev_priv->rps.debugfs_disable_boost) {
 		if (IS_VALLEYVIEW(dev))
 			vlv_set_rps_idle(dev_priv);
 		else
@@ -3178,7 +3180,9 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 
 	mutex_lock(&dev_priv->rps.hw_lock);
-	if (dev_priv->rps.enabled) {
+
+	if (dev_priv->rps.enabled
+		&& !dev_priv->rps.debugfs_disable_boost) {
 		if (IS_VALLEYVIEW(dev))
 			valleyview_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
 		else
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 39 lines · Daisy Sun

RP frequency request is affected by 2 modules: normal turbo algorithm and RPS boost algorithm. By adding RPS boost algorithm to the mix, the final frequency becomes relatively unpredictable. Add a switch to enable/disable RPS boost functionality. When disabled, RP frequency will follow the normal turbo algorithm only.

Intention: when boost and idle are disabled, we have a clear vision of turbo algorithm. It‘s very helpful to verify if the turbo algorithm is working as expected.
Without debugfs hooks, the RPS boost or idle may kicks in at anytime and any circumstances.

V1->V2: Follow Daniel's comment to explain the intention.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 40 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_pm.c     |  8 ++++++--
 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
index 1e83ae4..ff71214 100644
@@ -3486,6 +3486,45 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops,
 			i915_drop_caches_get, i915_drop_caches_set,
 			"0x%08llx\n");
 
+static int i915_rps_disable_boost_get(void *data, u64 *val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (INTEL_INFO(dev)->gen < 6)
+		return -ENODEV;
+
+	*val = dev_priv->rps.debugfs_disable_boost;
+

drivers/gpu/drm/i915/i915_debugfs.c DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops, · line 3508

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+	return 0;
+}
+
+static int i915_rps_disable_boost_set(void *data, u64 val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret;
+
+	flush_delayed_work(&dev_priv->rps.delayed_resume_work);

I'm not really sure why you feel it's necessary to flush the wq here. Note that you have no real safety since you cannot acquire the lock, and another event can get queued up after the flush. In other words, whatever you're trying to do probably can fail.

Also note that without this, a simple atomic_t would suffice for debugfs_disable_boost.

Quoted 75 lines
drivers/gpu/drm/i915/i915_debugfs.c +20 -0
+
+	DRM_DEBUG_DRIVER("Setting RPS disable Boost-Idle mode to %s\n",
+				 val ? "on" : "off");
+
+	ret = mutex_lock_interruptible(&dev_priv->rps.hw_lock);
+	if (ret)
+		return ret;
+
+	dev_priv->rps.debugfs_disable_boost = val;
+
+	mutex_unlock(&dev_priv->rps.hw_lock);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(i915_rps_disable_boost_fops,
+		i915_rps_disable_boost_get, i915_rps_disable_boost_set,
+			"%llu\n");
+
 static int
 i915_max_freq_get(void *data, u64 *val)
 {
@@ -3821,6 +3860,7 @@ static const struct i915_debugfs_files {
 	{"i915_wedged", &i915_wedged_fops},
 	{"i915_max_freq", &i915_max_freq_fops},
 	{"i915_min_freq", &i915_min_freq_fops},
+	{"i915_rps_disable_boost", &i915_rps_disable_boost_fops},
 	{"i915_cache_sharing", &i915_cache_sharing_fops},
 	{"i915_ring_stop", &i915_ring_stop_fops},
 	{"i915_ring_missed_irq", &i915_ring_missed_irq_fops},
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 272aa7a..9c427da 100644
@@ -847,6 +847,7 @@ struct intel_gen6_power_mgmt {
 	int last_adj;
 	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
 
+	bool debugfs_disable_boost;
 	bool enabled;
 	struct delayed_work delayed_resume_work;
 
drivers/gpu/drm/i915/intel_pm.c +6 -2
index 75c1c76..6acac14 100644
@@ -3163,7 +3163,9 @@ void gen6_rps_idle(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 
 	mutex_lock(&dev_priv->rps.hw_lock);
-	if (dev_priv->rps.enabled) {
+
+	if (dev_priv->rps.enabled
+		&& !dev_priv->rps.debugfs_disable_boost) {
 		if (IS_VALLEYVIEW(dev))
 			vlv_set_rps_idle(dev_priv);
 		else
@@ -3178,7 +3180,9 @@ void gen6_rps_boost(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 
 	mutex_lock(&dev_priv->rps.hw_lock);
-	if (dev_priv->rps.enabled) {
+
+	if (dev_priv->rps.enabled
+		&& !dev_priv->rps.debugfs_disable_boost) {
 		if (IS_VALLEYVIEW(dev))
 			valleyview_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
 		else
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 56 lines · Ben Widawsky
Quoted 39 lines · Daisy Sun

RP frequency request is affected by 2 modules: normal turbo algorithm and RPS boost algorithm. By adding RPS boost algorithm to the mix, the final frequency becomes relatively unpredictable. Add a switch to enable/disable RPS boost functionality. When disabled, RP frequency will follow the normal turbo algorithm only.

Intention: when boost and idle are disabled, we have a clear vision of turbo algorithm. It‘s very helpful to verify if the turbo algorithm is working as expected.
Without debugfs hooks, the RPS boost or idle may kicks in at anytime and any circumstances.

V1->V2: Follow Daniel's comment to explain the intention.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 40 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_pm.c     |  8 ++++++--
 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
index 1e83ae4..ff71214 100644
@@ -3486,6 +3486,45 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops,
 			i915_drop_caches_get, i915_drop_caches_set,
 			"0x%08llx\n");
 
+static int i915_rps_disable_boost_get(void *data, u64 *val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (INTEL_INFO(dev)->gen < 6)
+		return -ENODEV;
+
+	*val = dev_priv->rps.debugfs_disable_boost;
+

drivers/gpu/drm/i915/i915_debugfs.c DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops, · line 3508

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+	return 0;
+}
+
+static int i915_rps_disable_boost_set(void *data, u64 val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret;
+
+	flush_delayed_work(&dev_priv->rps.delayed_resume_work);

I'm not really sure why you feel it's necessary to flush the wq here. Note that you have no real safety since you cannot acquire the lock, and another event can get queued up after the flush. In other words, whatever you're trying to do probably can fail.

Quoted 2 lines

Also note that without this, a simple atomic_t would suffice for debugfs_disable_boost.

Simple? That puts another locked instruction on the common side as opposed to taking the mutex inside debugfs. Personally I'd complain much more about the lack of CODING_STYLE and good naming.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 57 lines · Chris Wilson
Quoted 56 lines · Ben Widawsky
Quoted 39 lines · Daisy Sun

RP frequency request is affected by 2 modules: normal turbo algorithm and RPS boost algorithm. By adding RPS boost algorithm to the mix, the final frequency becomes relatively unpredictable. Add a switch to enable/disable RPS boost functionality. When disabled, RP frequency will follow the normal turbo algorithm only.

Intention: when boost and idle are disabled, we have a clear vision of turbo algorithm. It‘s very helpful to verify if the turbo algorithm is working as expected.
Without debugfs hooks, the RPS boost or idle may kicks in at anytime and any circumstances.

V1->V2: Follow Daniel's comment to explain the intention.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 40 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_pm.c     |  8 ++++++--
 3 files changed, 47 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
index 1e83ae4..ff71214 100644
@@ -3486,6 +3486,45 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops,
 			i915_drop_caches_get, i915_drop_caches_set,
 			"0x%08llx\n");
 
+static int i915_rps_disable_boost_get(void *data, u64 *val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (INTEL_INFO(dev)->gen < 6)
+		return -ENODEV;
+
+	*val = dev_priv->rps.debugfs_disable_boost;
+

drivers/gpu/drm/i915/i915_debugfs.c DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops, · line 3508

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+	return 0;
+}
+
+static int i915_rps_disable_boost_set(void *data, u64 val)
+{
+	struct drm_device *dev = data;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret;
+
+	flush_delayed_work(&dev_priv->rps.delayed_resume_work);

I'm not really sure why you feel it's necessary to flush the wq here. Note that you have no real safety since you cannot acquire the lock, and another event can get queued up after the flush. In other words, whatever you're trying to do probably can fail.

Quoted 6 lines
Quoted 2 lines

Also note that without this, a simple atomic_t would suffice for debugfs_disable_boost.

Simple? That puts another locked instruction on the common side as opposed to taking the mutex inside debugfs. Personally I'd complain much more about the lack of CODING_STYLE and good naming.

Also it's just a single bool and it doesn't matter if the value changes while someone is holding struct_mutex, so no atomic_t or struct_mutex necessary here.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx