Skip to contentSkip to conversation

drm/i915: Introduce sw_turbo parameter.

PATCH In review Rodrigo Vivi 6 participants 8 messages Sep 25, 2014 – Sep 30, 2014

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: Introduce sw_turbo parameter.

bdw_sw_turbo is been enabled unconditionally and it is causing gpu to be busted. GT freq stays on max value even when it is on idle or with screen off.

And if this isn't actually the case it is at least breaking the current rps API. So let's let it disabled by default for now until it is properly adressing the tests.

References: https://bugs.freedesktop.org/show_bug.cgi?id=77869

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 6 ++++++
 drivers/gpu/drm/i915/intel_pm.c    | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e845a81..159ddd8 100644
@@ -2215,6 +2215,7 @@ struct i915_params {
 	int lvds_channel_mode;
 	int panel_use_ssc;
 	int vbt_sdvo_panel_type;
+	int sw_turbo;
 	int enable_rc6;
 	int enable_fbc;
 	int enable_ppgtt;
drivers/gpu/drm/i915/i915_params.c +6 -0
index 139f490..1cd587c 100644
@@ -33,6 +33,7 @@ struct i915_params i915 __read_mostly = {
 	.lvds_channel_mode = 0,
 	.panel_use_ssc = -1,
 	.vbt_sdvo_panel_type = -1,
+	.sw_turbo = 0,
 	.enable_rc6 = -1,
 	.enable_fbc = -1,
 	.enable_execlists = 0,
@@ -72,6 +73,11 @@ MODULE_PARM_DESC(semaphores,
 	"Use semaphores for inter-ring sync "
 	"(default: -1 (use per-chip defaults))");
 
+module_param_named(sw_turbo, i915.sw_turbo, int, 0400);
+MODULE_PARM_DESC(sw_turbo,
+	"Use SW Turbo. Currently available only on Broadwell"
+	"(default: 0 (disabled))");
+
 module_param_named(enable_rc6, i915.enable_rc6, int, 0400);
 MODULE_PARM_DESC(enable_rc6,
 	"Enable power-saving render C-state 6. "
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 49af81f..d51b17d 100644
@@ -3789,7 +3789,7 @@ static void gen8_enable_rps(struct drm_device *dev)
 	int unused;
 
 	/* Use software Turbo for BDW */
-	dev_priv->rps.is_bdw_sw_turbo = IS_BROADWELL(dev);
+	dev_priv->rps.is_bdw_sw_turbo = IS_BROADWELL(dev) && i915.sw_turbo;
 
 	/* 1a: Software RC state - RC0 */
 	I915_WRITE(GEN6_RC_STATE, 0);
Signature · 1 line
1.9.3
#1 lore raw
Quoted 9 lines · Rodrigo Vivi

bdw_sw_turbo is been enabled unconditionally and it is causing gpu to be busted. GT freq stays on max value even when it is on idle or with screen off.

And if this isn't actually the case it is at least breaking the current rps API. So let's let it disabled by default for now until it is properly adressing the tests.

References: https://bugs.freedesktop.org/show_bug.cgi?id=77869

Given Chris' feedback on that patch I guess I'll just revert it.

Aside: When fixing up patches _always_ cite the offending commit.

Thanks, Daniel

Quoted 62 lines
---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 6 ++++++
 drivers/gpu/drm/i915/intel_pm.c    | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e845a81..159ddd8 100644
@@ -2215,6 +2215,7 @@ struct i915_params {
 	int lvds_channel_mode;
 	int panel_use_ssc;
 	int vbt_sdvo_panel_type;
+	int sw_turbo;
 	int enable_rc6;
 	int enable_fbc;
 	int enable_ppgtt;
drivers/gpu/drm/i915/i915_params.c +6 -0
index 139f490..1cd587c 100644
@@ -33,6 +33,7 @@ struct i915_params i915 __read_mostly = {
 	.lvds_channel_mode = 0,
 	.panel_use_ssc = -1,
 	.vbt_sdvo_panel_type = -1,
+	.sw_turbo = 0,
 	.enable_rc6 = -1,
 	.enable_fbc = -1,
 	.enable_execlists = 0,
@@ -72,6 +73,11 @@ MODULE_PARM_DESC(semaphores,
 	"Use semaphores for inter-ring sync "
 	"(default: -1 (use per-chip defaults))");
 
+module_param_named(sw_turbo, i915.sw_turbo, int, 0400);
+MODULE_PARM_DESC(sw_turbo,
+	"Use SW Turbo. Currently available only on Broadwell"
+	"(default: 0 (disabled))");
+
 module_param_named(enable_rc6, i915.enable_rc6, int, 0400);
 MODULE_PARM_DESC(enable_rc6,
 	"Enable power-saving render C-state 6. "
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 49af81f..d51b17d 100644
@@ -3789,7 +3789,7 @@ static void gen8_enable_rps(struct drm_device *dev)
 	int unused;
 
 	/* Use software Turbo for BDW */
-	dev_priv->rps.is_bdw_sw_turbo = IS_BROADWELL(dev);
+	dev_priv->rps.is_bdw_sw_turbo = IS_BROADWELL(dev) && i915.sw_turbo;
 
 	/* 1a: Software RC state - RC0 */
 	I915_WRITE(GEN6_RC_STATE, 0);
Signature · 6 lines
1.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw

PATCH 1/1 Revert "drm/i915/bdw: BDW Software Turbo"

In reply to Rodrigo Vivi

This reverts commit c76bb61a71083b2d90504cc6d0dda2047c5d63ca.

It's apparently too broken so that Rodrigo submitted a patch to add a config option for it. Given that the design is also ... suboptimal and that I've only merged this to get lead engineers and managers off my back for one second let's just revert this.

/me puts on combat gear again

It was worth a shot ...

References: http://mid.mail-archive.com/[email protected]

Cc Jesse Barnes <[email protected]>
Cc Daisy Sun <[email protected]>
Cc Jesse Barnes <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h      |  22 ----
 drivers/gpu/drm/i915/i915_irq.c      |  21 ----
 drivers/gpu/drm/i915/i915_reg.h      |   4 -
 drivers/gpu/drm/i915/intel_display.c |   3 -
 drivers/gpu/drm/i915/intel_pm.c      | 230 ++++++-----------------------------
 5 files changed, 39 insertions(+), 241 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -22
index 17dfce0f4e68..32180ac92770 100644
@@ -945,23 +945,6 @@ struct intel_rps_ei {
 	u32 media_c0;
 };
 
-struct intel_rps_bdw_cal {
-	u32 it_threshold_pct; /* interrupt, in percentage */
-	u32 eval_interval; /* evaluation interval, in us */
-	u32 last_ts;
-	u32 last_c0;
-	bool is_up;
-};
-
-struct intel_rps_bdw_turbo {
-	struct intel_rps_bdw_cal up;
-	struct intel_rps_bdw_cal down;
-	struct timer_list flip_timer;
-	u32 timeout;
-	atomic_t flip_received;
-	struct work_struct work_max_freq;
-};
-
 struct intel_gen6_power_mgmt {
 	/* work and pm_iir are protected by dev_priv->irq_lock */
 	struct work_struct work;
@@ -995,9 +978,6 @@ struct intel_gen6_power_mgmt {
 	bool enabled;
 	struct delayed_work delayed_resume_work;
 
-	bool is_bdw_sw_turbo;	/* Switch of BDW software turbo */
-	struct intel_rps_bdw_turbo sw_turbo; /* Calculate RP interrupt timing */
-
 	/* manual wa residency calculations */
 	struct intel_rps_ei up_ei, down_ei;
 
@@ -2828,8 +2808,6 @@ extern void intel_disable_fbc(struct drm_device *dev);
 extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
 extern void intel_init_pch_refclk(struct drm_device *dev);
 extern void gen6_set_rps(struct drm_device *dev, u8 val);
-extern void bdw_software_turbo(struct drm_device *dev);
-extern void gen8_flip_interrupt(struct drm_device *dev);
 extern void valleyview_set_rps(struct drm_device *dev, u8 val);
 extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv,
 				  bool enable);
drivers/gpu/drm/i915/i915_irq.c +0 -21
index c96ddc953531..3201986bf25e 100644
@@ -1979,27 +1979,6 @@ static void i9xx_pipe_crc_irq_handler(struct drm_device *dev, enum pipe pipe)
 				     res1, res2);
 }
 
-void gen8_flip_interrupt(struct drm_device *dev)
-{
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	if (!dev_priv->rps.is_bdw_sw_turbo)
-		return;
-
-	if(atomic_read(&dev_priv->rps.sw_turbo.flip_received)) {
-		mod_timer(&dev_priv->rps.sw_turbo.flip_timer,
-				usecs_to_jiffies(dev_priv->rps.sw_turbo.timeout) + jiffies);
-	}
-	else {
-		dev_priv->rps.sw_turbo.flip_timer.expires =
-				usecs_to_jiffies(dev_priv->rps.sw_turbo.timeout) + jiffies;
-		add_timer(&dev_priv->rps.sw_turbo.flip_timer);
-		atomic_set(&dev_priv->rps.sw_turbo.flip_received, true);
-	}
-
-	bdw_software_turbo(dev);
-}
-
 /* The RPS events need forcewake, so we add them to a work queue and mask their
  * IMR bits until the work is done. Other interrupts can be processed without
  * the work queue. */
drivers/gpu/drm/i915/i915_reg.h +0 -4
index ad8179b40d19..e887d4c13ca1 100644
@@ -5585,10 +5585,6 @@ enum punit_power_well {
 #define GEN8_UCGCTL6				0x9430
 #define   GEN8_SDEUNIT_CLOCK_GATE_DISABLE	(1<<14)
 
-#define TIMESTAMP_CTR		0x44070
-#define FREQ_1_28_US(us)	(((us) * 100) >> 7)
-#define MCHBAR_PCU_C0		(MCHBAR_MIRROR_BASE_SNB + 0x5960)
-
 #define GEN6_GFXPAUSE				0xA000
 #define GEN6_RPNSWREQ				0xA008
 #define   GEN6_TURBO_DISABLE			(1<<31)
drivers/gpu/drm/i915/intel_display.c +0 -3
index c5079f2c49f3..2d4258038ef2 100644
@@ -9926,9 +9926,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	unsigned long flags;
 	int ret;
 
-	//trigger software GT busyness calculation
-	gen8_flip_interrupt(dev);
-
 	/*
 	 * drm_mode_page_flip_ioctl() should already catch this, but double
 	 * check to be safe.  In the future we may enable pageflipping from
drivers/gpu/drm/i915/intel_pm.c +39 -191

295 lines not on this page · raw message

Signature · 1 line
2.1.1
#3 lore raw

Re: [PATCH] Revert "drm/i915/bdw: BDW Software Turbo"

Quoted 10 lines · On Mon, 29 Sep 2014 15:11:51 +0200 Daniel Vetter <[email protected]> wrote:

This reverts commit c76bb61a71083b2d90504cc6d0dda2047c5d63ca.

It's apparently too broken so that Rodrigo submitted a patch to add a config option for it. Given that the design is also ... suboptimal and that I've only merged this to get lead engineers and managers off my back for one second let's just revert this.

/me puts on combat gear again

It was worth a shot ...

I thought we had a fix for the runtime PM issue this created? And Rodrigo's fix is just a simple "only BDW needs this" patch, so I guess I don't see the big issue?

Or is there another bug you didn't mention in the s-o-b section you're worried about?

Jesse

#4 lore raw

Re: [PATCH] Revert "drm/i915/bdw: BDW Software Turbo"

Quoted 12 lines · Jesse Barnes
Quoted 9 lines · On Mon, 29 Sep 2014 15:11:51 +0200 Daniel Vetter <[email protected]> wrote:

This reverts commit c76bb61a71083b2d90504cc6d0dda2047c5d63ca.

It's apparently too broken so that Rodrigo submitted a patch to add a config option for it. Given that the design is also ... suboptimal and that I've only merged this to get lead engineers and managers off my back for one second let's just revert this.

/me puts on combat gear again

Quoted 8 lines
Quoted 1 line

It was worth a shot ...

I thought we had a fix for the runtime PM issue this created? And Rodrigo's fix is just a simple "only BDW needs this" patch, so I guess I don't see the big issue?

Or is there another bug you didn't mention in the s-o-b section you're worried about?

Rodrigo's patch seems to set the new sw_turbo module option to 0 by default, everywhere. So I've figured given Chris' very clear Nack on the original patch it's kinda past the point where I can still sugar-coat things with a straight enough face.

Or maybe I've totally missing again what's going on. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw

Re: [PATCH] Revert "drm/i915/bdw: BDW Software Turbo"

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Jesse Barnes
Quoted 7 lines · On Mon, 29 Sep 2014 15:11:51 +0200 Daniel Vetter <[email protected]> wrote:

This reverts commit c76bb61a71083b2d90504cc6d0dda2047c5d63ca.

It's apparently too broken so that Rodrigo submitted a patch to add a config option for it. Given that the design is also ... suboptimal and that I've only merged this to get lead engineers and managers off my back for one second let's just revert this.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

/me puts on combat gear again

It was worth a shot ...

I thought we had a fix for the runtime PM issue this created? And Rodrigo's fix is just a simple "only BDW needs this" patch, so I guess I don't see the big issue?

Well, actually the issue is to stay with high busted gt frequency even on idle. Or this or an incompatibility with the actual rps interface...

So my patch was actually a protect a feture under development with parameter.

Quoted 3 lines
Quoted 3 lines

Or is there another bug you didn't mention in the s-o-b section you're worried about?

The only issue I know is:
References: https://bugs.freedesktop.org/show_bug.cgi?id=77869

Quoted 3 lines

Rodrigo's patch seems to set the new sw_turbo module option to 0 by default, everywhere.

I believe that protecting the behaviour but accepting the code merged is a better
approach to convince people to continue contributing by feeling some sense of progress instead of just blocking all and forcing the constant rebase, etc. But I won't fight for it mainly because of the original Nack you mentioned.

Quoted 5 lines

So I've figured given Chris' very clear Nack on the original patch it's kinda past the point where I can still sugar-coat things with a straight enough face.

Or maybe I've totally missing again what's going on.

No, you are right! ;)

Quoted 9 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#6 lore raw

Re: [PATCH] Revert "drm/i915/bdw: BDW Software Turbo"

Quoted 23 lines · On Mon, 29 Sep 2014 09:52:38 -0700 Rodrigo Vivi <[email protected]> wrote:
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Jesse Barnes
Quoted 7 lines · On Mon, 29 Sep 2014 15:11:51 +0200 Daniel Vetter <[email protected]> wrote:

This reverts commit c76bb61a71083b2d90504cc6d0dda2047c5d63ca.

It's apparently too broken so that Rodrigo submitted a patch to add a config option for it. Given that the design is also ... suboptimal and that I've only merged this to get lead engineers and managers off my back for one second let's just revert this.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

/me puts on combat gear again

It was worth a shot ...

I thought we had a fix for the runtime PM issue this created? And Rodrigo's fix is just a simple "only BDW needs this" patch, so I guess I don't see the big issue?

Well, actually the issue is to stay with high busted gt frequency even on idle. Or this or an incompatibility with the actual rps interface...

Quoted 8 lines

So my patch was actually a protect a feture under development with parameter.

Quoted 3 lines
Quoted 3 lines

Or is there another bug you didn't mention in the s-o-b section you're worried about?

The only issue I know is:
References: https://bugs.freedesktop.org/show_bug.cgi?id=77869

Ah yeah, misread it thinking it was accidentally being enabled on non-bdw too or something.

But yeah I expect turbo to be broken even with your patch, since we won't ramp up/down the freq (or at least not properly). The only thing Daisy's patch addresses is making sure we at least try to ramp if we're getting regular page flips. The more complete fix (which should address the test failure too) would be to peroidically poll the hw busy state and adjust the freq based on that, independent of the flip frequency. That should allow GPGPU apps, offlien media encode/decode, and these tests to work as they should, but it's a little more work. We need to make sure the timer is shut down when we go into RC6 and only fires frequently when the GPU is busy.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#7 lore raw

Re: [PATCH] Revert "drm/i915/bdw: BDW Software Turbo"

Quoted 38 lines · Jesse Barnes
Quoted 23 lines · On Mon, 29 Sep 2014 09:52:38 -0700 Rodrigo Vivi <[email protected]> wrote:
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Jesse Barnes
Quoted 7 lines · On Mon, 29 Sep 2014 15:11:51 +0200 Daniel Vetter <[email protected]> wrote:

This reverts commit c76bb61a71083b2d90504cc6d0dda2047c5d63ca.

It's apparently too broken so that Rodrigo submitted a patch to add a config option for it. Given that the design is also ... suboptimal and that I've only merged this to get lead engineers and managers off my back for one second let's just revert this.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

/me puts on combat gear again

It was worth a shot ...

I thought we had a fix for the runtime PM issue this created? And Rodrigo's fix is just a simple "only BDW needs this" patch, so I guess I don't see the big issue?

Well, actually the issue is to stay with high busted gt frequency even on idle. Or this or an incompatibility with the actual rps interface...

Quoted 8 lines

So my patch was actually a protect a feture under development with parameter.

Quoted 3 lines
Quoted 3 lines

Or is there another bug you didn't mention in the s-o-b section you're worried about?

The only issue I know is:
References: https://bugs.freedesktop.org/show_bug.cgi?id=77869

Ah yeah, misread it thinking it was accidentally being enabled on non-bdw too or something.

Quoted 11 lines

But yeah I expect turbo to be broken even with your patch, since we won't ramp up/down the freq (or at least not properly). The only thing Daisy's patch addresses is making sure we at least try to ramp if we're getting regular page flips. The more complete fix (which should address the test failure too) would be to peroidically poll the hw busy state and adjust the freq based on that, independent of the flip frequency. That should allow GPGPU apps, offlien media encode/decode, and these tests to work as they should, but it's a little more work. We need to make sure the timer is shut down when we go into RC6 and only fires frequently when the GPU is busy.

I object to reverting Daisy's "BDW Software Turbo" patch without also having an acceptable replacement.

Yes, Daisy's patch is not a complete fix. Yes, a different design may have been better. But this patch did get turbo working on BDW systems with regular flips (such as those running Android). Taking this patch out without a replacement is a step in the wrong direction.

-- Tom O'Rourke