diff mbox

[v3] drm/i915: Debugfs disable RPS boost and idle

Message ID 1399326627-30890-1-git-send-email-daisy.sun@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daisy Sun May 5, 2014, 9:50 p.m. UTC
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 kick in at
anytime and any circumstances.

V1->V2: Follow Daniel's comment to explain the intention.
V2->V3: Abandon flush_delayed work, abandon lock of rps.hw_lock
during get/set of rps.debugfs_disable_boost

Signed-off-by: Daisy Sun <daisy.sun@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 29 +++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_pm.c     |  8 ++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)

Comments

Chris Wilson May 6, 2014, 5:51 a.m. UTC | #1
On Mon, May 05, 2014 at 02:50:27PM -0700, Daisy Sun wrote:
> 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 kick in at
> anytime and any circumstances.

The algorithm is still not the same as you "intended". So can you not
tracepoints to give EI results for up/down signals and filter out the
noise?
-Chris
Daisy Sun May 7, 2014, 1:50 a.m. UTC | #2
"So can you not tracepoints to give EI results for up/down signals and 
filter out the noise? ", Do you mean I don't need the debugfs at all?
For developer, he/she is able to trace anything including the point of 
Turbo algorithm adjustment(+n/-n).
But as a black box, validation will not see the cause but only the result.

Boost / Idle function will set RP frequency to Max / Min, turbo 
algorithm will +n / -n depends on our implementation.
My intention is to block the disturbance of Boost /Idle, then the RPS 
frequency change can only cause bye Turbo algorithm.
- Daisy

On 5/5/2014 10:51 PM, Chris Wilson wrote:
> On Mon, May 05, 2014 at 02:50:27PM -0700, Daisy Sun wrote:
>> 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 kick in at
>> anytime and any circumstances.
> The algorithm is still not the same as you "intended". So can you not
> tracepoints to give EI results for up/down signals and filter out the
> noise?
> -Chris
>
deepak.s@linux.intel.com May 10, 2014, 5:07 a.m. UTC | #3
On Tuesday 06 May 2014 03:20 AM, Daisy Sun wrote:
> 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 kick in at
> anytime and any circumstances.
>
> V1->V2: Follow Daniel's comment to explain the intention.
> V2->V3: Abandon flush_delayed work, abandon lock of rps.hw_lock
> during get/set of rps.debugfs_disable_boost
>
> Signed-off-by: Daisy Sun <daisy.sun@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_debugfs.c | 29 +++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/i915_drv.h     |  1 +
>   drivers/gpu/drm/i915/intel_pm.c     |  8 ++++++--
>   3 files changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 1e83ae4..685f7e5 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3486,6 +3486,34 @@ 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;
> +
> +	*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;
> +
> +	DRM_DEBUG_DRIVER("%s RPS Boost-Idle mode\n",
> +				 val ? "Disable" : "Enable");
> +
> +	dev_priv->rps.debugfs_disable_boost = val;
> +
> +	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 +3849,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},
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 272aa7a..9c427da 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -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;
>   
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 75c1c76..6acac14 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -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) {

On VLV, when system is idle we wont get  down threshold interrupts. So disabling this will not help you to test the algorithm. I think we need to retain gen6_rps_idle


>   		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
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 1e83ae4..685f7e5 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3486,6 +3486,34 @@  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;
+
+	*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;
+
+	DRM_DEBUG_DRIVER("%s RPS Boost-Idle mode\n",
+				 val ? "Disable" : "Enable");
+
+	dev_priv->rps.debugfs_disable_boost = val;
+
+	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 +3849,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},
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 272aa7a..9c427da 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -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;
 
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 75c1c76..6acac14 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -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