diff mbox

[1/2] drm/i915: add module parameter compiler hints

Message ID 1309990493-27160-1-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky July 6, 2011, 10:14 p.m. UTC
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.c |   24 ++++++++++++------------
 drivers/gpu/drm/i915/i915_drv.h |   20 ++++++++++----------
 2 files changed, 22 insertions(+), 22 deletions(-)

Comments

Keith Packard July 6, 2011, 11:03 p.m. UTC | #1
On Wed,  6 Jul 2011 15:14:52 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:


> -static int i915_modeset = -1;
> +static int i915_modeset __read_mostly = -1;

What effect does this have? Performance? Code size? More warnings?
Ben Widawsky July 6, 2011, 11:16 p.m. UTC | #2
On Wed, Jul 06, 2011 at 04:03:14PM -0700, Keith Packard wrote:
> On Wed,  6 Jul 2011 15:14:52 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> 
> 
> > -static int i915_modeset = -1;
> > +static int i915_modeset __read_mostly = -1;
> 
> What effect does this have? Performance? Code size? More warnings?

__read_mostly attempts to put variables in a cachelines to make it more
SMP friendly. I'm not sure if there is a performance impact as a result,
but made this patch based on feedback from Chris. I've seen no
regressions on Nexuiz.

The __always_unused I don't think has any real use other than
documentation. Potentially GCC could do something useful with it, but I
don't think it's enabled anywhere important.

Ben
Keith Packard July 7, 2011, 12:37 a.m. UTC | #3
On Wed, 6 Jul 2011 16:16:01 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
Non-text part: multipart/signed

> I've seen no regressions on Nexuiz.

'this doesn't seem to hurt any' is hardly a strong recommendation...
Ted Phelps July 7, 2011, 12:48 a.m. UTC | #4
Ben Widawsky writes:
> On Wed, Jul 06, 2011 at 04:03:14PM -0700, Keith Packard wrote:
> > On Wed,  6 Jul 2011 15:14:52 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> >
> > > -static int i915_modeset =3D -1;
> > > +static int i915_modeset __read_mostly =3D -1;
> >
> > What effect does this have? Performance? Code size? More warnings?
> 
> __read_mostly attempts to put variables in a cachelines to make it more
> SMP friendly. I'm not sure if there is a performance impact as a result,
> but made this patch based on feedback from Chris. I've seen no
> regressions on Nexuiz.

A link to an informative LKML discussion on this topic is here:

    http://lkml.org/lkml/2007/12/17/43

-Ted
Chris Wilson July 7, 2011, 5:52 a.m. UTC | #5
On Wed,  6 Jul 2011 15:14:52 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:

And programmer hints too. They serve as useful documentation on the
expected usage of the variable as well. But maybe that's just me...
-Chris
Keith Packard July 13, 2011, 6:16 p.m. UTC | #6
On Wed,  6 Jul 2011 15:14:52 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

This patch series doesn't apply to -next anymore; care to clean it up so
I can merge it in?

(too many -fixes applied for 3.0, I fear)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 649278f..f5ef954 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -37,40 +37,40 @@ 
 #include <linux/console.h>
 #include "drm_crtc_helper.h"
 
-static int i915_modeset = -1;
+static int i915_modeset __read_mostly = -1;
 module_param_named(modeset, i915_modeset, int, 0400);
 
-unsigned int i915_fbpercrtc = 0;
+unsigned int i915_fbpercrtc __always_unused = 0;
 module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400);
 
-int i915_panel_ignore_lid = 0;
+int i915_panel_ignore_lid __read_mostly = 0;
 module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600);
 
-unsigned int i915_powersave = 1;
+unsigned int i915_powersave __read_mostly = 1;
 module_param_named(powersave, i915_powersave, int, 0600);
 
-unsigned int i915_semaphores = 0;
+unsigned int i915_semaphores __read_mostly = 0;
 module_param_named(semaphores, i915_semaphores, int, 0600);
 
-unsigned int i915_enable_rc6 = 1;
+unsigned int i915_enable_rc6 __read_mostly = 1;
 module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
 
-unsigned int i915_enable_fbc = 0;
+unsigned int i915_enable_fbc __read_mostly = 0;
 module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600);
 
-unsigned int i915_lvds_downclock = 0;
+unsigned int i915_lvds_downclock __read_mostly = 0;
 module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
 
-unsigned int i915_panel_use_ssc = 1;
+unsigned int i915_panel_use_ssc __read_mostly = 1;
 module_param_named(lvds_use_ssc, i915_panel_use_ssc, int, 0600);
 
-int i915_vbt_sdvo_panel_type = -1;
+int i915_vbt_sdvo_panel_type __read_mostly = -1;
 module_param_named(vbt_sdvo_panel_type, i915_vbt_sdvo_panel_type, int, 0600);
 
-static bool i915_try_reset = true;
+static bool i915_try_reset __read_mostly = true;
 module_param_named(reset, i915_try_reset, bool, 0600);
 
-bool i915_enable_hangcheck = true;
+bool i915_enable_hangcheck __read_mostly = true;
 module_param_named(enable_hangcheck, i915_enable_hangcheck, bool, 0644);
 
 static struct drm_driver driver;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4958ce0..7f253b3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -985,16 +985,16 @@  struct drm_i915_file_private {
 
 extern struct drm_ioctl_desc i915_ioctls[];
 extern int i915_max_ioctl;
-extern unsigned int i915_fbpercrtc;
-extern int i915_panel_ignore_lid;
-extern unsigned int i915_powersave;
-extern unsigned int i915_semaphores;
-extern unsigned int i915_lvds_downclock;
-extern unsigned int i915_panel_use_ssc;
-extern int i915_vbt_sdvo_panel_type;
-extern unsigned int i915_enable_rc6;
-extern unsigned int i915_enable_fbc;
-extern bool i915_enable_hangcheck;
+extern unsigned int i915_fbpercrtc __always_unused;
+extern int i915_panel_ignore_lid __read_mostly;
+extern unsigned int i915_powersave __read_mostly;
+extern unsigned int i915_semaphores __read_mostly;
+extern unsigned int i915_lvds_downclock __read_mostly;
+extern unsigned int i915_panel_use_ssc __read_mostly;
+extern int i915_vbt_sdvo_panel_type __read_mostly;
+extern unsigned int i915_enable_rc6 __read_mostly;
+extern unsigned int i915_enable_fbc __read_mostly;
+extern bool i915_enable_hangcheck __read_mostly;
 
 extern int i915_suspend(struct drm_device *dev, pm_message_t state);
 extern int i915_resume(struct drm_device *dev);