Skip to contentSkip to conversation

drm/i915: Misc improvements around module params

PATCH Superseded Michal Wajdeczko 4 participants 7 messages Jun 9, 2017 – Jun 22, 2017

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover drm/i915: Misc improvements around module params

Earlier RFC proposed to extend param macros with default values. This series goes step further.

v2: rename modparam instead of i915_params field

Michal Wajdeczko (3):
drm/i915: Rename lvds_use_ssc modparam to panel_use_ssc drm/i915: Extend PARAMS_FOR_EACH macro with more data drm/i915/debugfs: Highlight modified i915 params

 drivers/gpu/drm/i915/i915_debugfs.c   |  52 ++++++--
 drivers/gpu/drm/i915/i915_gpu_error.c |  10 +-
 drivers/gpu/drm/i915/i915_params.c    | 234 ++--------------------------------
 drivers/gpu/drm/i915/i915_params.h    | 183 +++++++++++++++++++-------
 4 files changed, 195 insertions(+), 284 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 1/3 drm/i915: Rename lvds_use_ssc modparam to panel_use_ssc

This modparam affects not only LVDS but also eDP panels. Additionally with this rename we will keep modparam and i915_params field name in sync. Finally this patch will unblock us with further improvements around params defs.

---
 drivers/gpu/drm/i915/i915_params.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_params.c +2 -2
index b6a7e36..6c27d33 100644
@@ -105,8 +105,8 @@ MODULE_PARM_DESC(lvds_channel_mode,
 	 "Specify LVDS channel mode "
 	 "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)");
 
-module_param_named_unsafe(lvds_use_ssc, i915.panel_use_ssc, int, 0600);
-MODULE_PARM_DESC(lvds_use_ssc,
+module_param_named_unsafe(panel_use_ssc, i915.panel_use_ssc, int, 0600);
+MODULE_PARM_DESC(panel_use_ssc,
 	"Use Spread Spectrum Clock with panels [LVDS/eDP] "
 	"(default: auto from VBT)");
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 2/3 drm/i915: Extend PARAMS_FOR_EACH macro with more data

In reply to Michal Wajdeczko

Currently our PARAMS_FOR_EACH macro contains only param type and name. We use this macro to define struct members, but later on we initialize this struct using handcrafted code, which leads in some cases to use mismatched value vs. type. Let's extend our root macro with param default value to keep them in sync. Also drop ; from the macro to allow more flexible usages.

v2: Add unsafe tag (Chris)
Add all other data to allow complete automation (Michal)

As we now have all data in the param macro, we can automatically add 'default' info to the description and avoid any mismatches.

v3: Fix printing default value in the description (Michal)

---
 drivers/gpu/drm/i915/i915_debugfs.c   |   6 +-
 drivers/gpu/drm/i915/i915_gpu_error.c |  10 +-
 drivers/gpu/drm/i915/i915_params.c    | 234 ++--------------------------------
 drivers/gpu/drm/i915/i915_params.h    | 183 +++++++++++++++++++-------
 4 files changed, 158 insertions(+), 275 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -3
index a6ba210..7a2f0b8 100644
@@ -44,9 +44,9 @@ static __always_inline void seq_print_param(struct seq_file *m,
 		seq_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x));
 	else if (!__builtin_strcmp(type, "int"))
 		seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
-	else if (!__builtin_strcmp(type, "unsigned int"))
+	else if (!__builtin_strcmp(type, "uint"))
 		seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
-	else if (!__builtin_strcmp(type, "char *"))
+	else if (!__builtin_strcmp(type, "charp"))
 		seq_printf(m, "i915.%s=%s\n", name, *(const char **)x);
 	else
 		BUILD_BUG();
@@ -66,7 +66,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 #undef PRINT_FLAG
 
 	kernel_param_lock(THIS_MODULE);
-#define PRINT_PARAM(T, x) seq_print_param(m, #x, #T, &i915.x);
+#define PRINT_PARAM(T, X, V, M, S, B, D) seq_print_param(m, #X, #T, &i915.X);
 	I915_PARAMS_FOR_EACH(PRINT_PARAM);
 #undef PRINT_PARAM
 	kernel_param_unlock(THIS_MODULE);
drivers/gpu/drm/i915/i915_gpu_error.c +5 -5
index e18f350..ea6c0b1 100644
@@ -555,9 +555,9 @@ static __always_inline void err_print_param(struct drm_i915_error_state_buf *m,
 		err_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x));
 	else if (!__builtin_strcmp(type, "int"))
 		err_printf(m, "i915.%s=%d\n", name, *(const int *)x);
-	else if (!__builtin_strcmp(type, "unsigned int"))
+	else if (!__builtin_strcmp(type, "uint"))
 		err_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
-	else if (!__builtin_strcmp(type, "char *"))
+	else if (!__builtin_strcmp(type, "charp"))
 		err_printf(m, "i915.%s=%s\n", name, *(const char **)x);
 	else
 		BUILD_BUG();
@@ -566,7 +566,7 @@ static __always_inline void err_print_param(struct drm_i915_error_state_buf *m,
 static void err_print_params(struct drm_i915_error_state_buf *m,
 			     const struct i915_params *p)
 {
-#define PRINT(T, x) err_print_param(m, #x, #T, &p->x);
+#define PRINT(T, X, V, M, S, B, D) err_print_param(m, #X, #T, &p->X);
 	I915_PARAMS_FOR_EACH(PRINT);
 #undef PRINT
 }
@@ -860,7 +860,7 @@ void __i915_gpu_state_free(struct kref *error_ref)
 	kfree(error->overlay);
 	kfree(error->display);
 
-#define FREE(T, x) free_param(#T, &error->params.x);
+#define FREE(T, X, V, M, S, B, D) free_param(#T, &error->params.X);
 	I915_PARAMS_FOR_EACH(FREE);
 #undef FREE
 
@@ -1694,7 +1694,7 @@ static int capture(void *data)
 					   error->i915->gt.last_init_time));
 
 	error->params = i915;
-#define DUP(T, x) dup_param(#T, &error->params.x);
+#define DUP(T, X, V, M, S, B, D) dup_param(#T, &error->params.X);
 	I915_PARAMS_FOR_EACH(DUP);
 #undef DUP
 
drivers/gpu/drm/i915/i915_params.c +10 -224

240 lines not on this page · raw message

drivers/gpu/drm/i915/i915_params.h +140 -43

195 lines not on this page · raw message

Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v2 3/3 drm/i915/debugfs: Highlight modified i915 params

In reply to Michal Wajdeczko

We know default values for all params and we know which params are safe to change. Mark params that were changed when dumping them in debugfs.

v2: simplify is_default calculation for strings (Chris)

---
 drivers/gpu/drm/i915/i915_debugfs.c | 52 ++++++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +40 -12
index 7a2f0b8..03381a1 100644
@@ -35,20 +35,41 @@ static inline struct drm_i915_private *node_to_i915(struct drm_info_node *node)
 	return to_i915(node->minor->dev);
 }
 
+static inline const char *param_diagnostic(bool is_default, bool is_unsafe)
+{
+	if (is_default)
+		return "";
+	if (is_unsafe)
+		return " [modified *unsafe*]";
+	return " [modified]";
+}
+
 static __always_inline void seq_print_param(struct seq_file *m,
 					    const char *name,
 					    const char *type,
-					    const void *x)
-{
-	if (!__builtin_strcmp(type, "bool"))
-		seq_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x));
-	else if (!__builtin_strcmp(type, "int"))
-		seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
-	else if (!__builtin_strcmp(type, "uint"))
-		seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
-	else if (!__builtin_strcmp(type, "charp"))
-		seq_printf(m, "i915.%s=%s\n", name, *(const char **)x);
-	else
+					    const void *x,
+					    const void *v,
+					    bool is_unsafe)
+{
+	if (!__builtin_strcmp(type, "bool")) {
+		bool is_default = *(const bool *)x == *(const bool *)v;
+		seq_printf(m, "i915.%s=%s%s\n", name, yesno(*(const bool *)x),
+			   param_diagnostic(is_default, is_unsafe));
+	} else if (!__builtin_strcmp(type, "int")) {
+		bool is_default = *(const int *)x == *(const int *)v;
+		seq_printf(m, "i915.%s=%d%s\n", name, *(const int *)x,
+			   param_diagnostic(is_default, is_unsafe));
+	} else if (!__builtin_strcmp(type, "uint")) {
+		bool is_default = *(const uint *)x == *(const uint *)v;
+		seq_printf(m, "i915.%s=%u%s\n", name, *(const unsigned int *)x,
+			   param_diagnostic(is_default, is_unsafe));
+	} else if (!__builtin_strcmp(type, "charp")) {
+		const char *new = *(const char **)x;
+		const char *old = *(const char **)v;
+		bool is_default = old && new ? !strcmp(old, new) : old == new;
+		seq_printf(m, "i915.%s=%s%s\n", name, *(const char **)x,
+			   param_diagnostic(is_default, is_unsafe));
+	} else
 		BUILD_BUG();
 }
 
@@ -66,9 +87,16 @@ static int i915_capabilities(struct seq_file *m, void *data)
 #undef PRINT_FLAG
 
 	kernel_param_lock(THIS_MODULE);
-#define PRINT_PARAM(T, X, V, M, S, B, D) seq_print_param(m, #X, #T, &i915.X);
+#define FLAG false
+#define FLAG_unsafe true
+#define PRINT_PARAM(T, X, V, M, S, B, D) do { \
+		typeof(i915.X) __v = V; \
+		seq_print_param(m, #X, #T, &i915.X, &__v, FLAG##S); \
+	} while(0);
 	I915_PARAMS_FOR_EACH(PRINT_PARAM);
 #undef PRINT_PARAM
+#undef FLAG
+#undef FLAG_unsafe
 	kernel_param_unlock(THIS_MODULE);
 
 	return 0;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 3/3
#4 lore raw

Re: [PATCH v2 3/3] drm/i915/debugfs: Highlight modified i915 params

Quoted 10 lines · Michal Wajdeczko

We know default values for all params and we know which params are safe
to change. Mark params that were changed when dumping them in debugfs.

v2: simplify is_default calculation for strings (Chris)

-Lukasz

Quoted 4 lines

---
 drivers/gpu/drm/i915/i915_debugfs.c | 52
++++++++++++++++++++++++++++---------

 1 file changed, 40 insertions(+), 12 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✓ Fi.CI.BAT: success for drm/i915: Misc improvements around module params (rev2)

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: drm/i915: Misc improvements around module params (rev2)
URL : https://patchwork.freedesktop.org/series/25482/
State : success

== Summary ==

Series 25482v2 drm/i915: Misc improvements around module params
https://patchwork.freedesktop.org/api/1.0/series/25482/revisions/2/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125
Test kms_busy:
        Subgroup basic-flip-default-a:
                dmesg-warn -> PASS       (fi-skl-6700hq) fdo#101144 +2
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                skip       -> PASS       (fi-skl-6700hq)
        Subgroup basic-flip-vs-wf_vblank:
                skip       -> PASS       (fi-skl-6700hq) fdo#99739
        Subgroup basic-plain-flip:
                skip       -> PASS       (fi-skl-6700hq)
Test kms_frontbuffer_tracking:
        Subgroup basic:
                skip       -> PASS       (fi-skl-6700hq)
Test prime_vgem:
        Subgroup basic-fence-flip:
                skip       -> PASS       (fi-skl-6700hq)

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fdo#99739 https://bugs.freedesktop.org/show_bug.cgi?id=99739

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:445s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:431s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:577s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:512s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:494s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:479s
fi-glk-2a        total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:588s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:431s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:420s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:493s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:464s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:468s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:572s
fi-kbl-r         total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time:579s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:463s
fi-skl-6700hq    total:278  pass:235  dwarn:1   dfail:0   fail:26  skip:16  time:499s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:461s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:480s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:434s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:530s
fi-snb-2600      total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  time:404s

5b363842b49a66879d4c67d652923fb04e44b271 drm-tip: 2017y-06m-08d-20h-34m-37s UTC integration manifest 67f59dd drm/i915/debugfs: Highlight modified i915 params
3bdacfa drm/i915: Extend PARAMS_FOR_EACH macro with more data
0e51421 drm/i915: Rename lvds_use_ssc modparam to panel_use_ssc

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4924/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on the v2 series
#6 lore raw
In reply to Michal Wajdeczko

Quoting Michal Wajdeczko (2017-06-09 11:27:54)

Quoted 9 lines

Earlier RFC proposed to extend param macros with default values. This series goes step further.

v2: rename modparam instead of i915_params field

Michal Wajdeczko (3):
drm/i915: Rename lvds_use_ssc modparam to panel_use_ssc drm/i915: Extend PARAMS_FOR_EACH macro with more data drm/i915/debugfs: Highlight modified i915 params

Whilst having it as a single large macro is unwieldy, it is just pulling together the modparam macros into one large block. I was pondering if we could use the modparam .section to decode the parameters later, but the features added and the code consolidation here is worth the larger macro.

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx