drm/i915: Misc improvements around module params
Subsystems (2)
v4 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
v3: refactor master macro and debugfs/error printers
v4: use lowercase names in macro + more reviewers
Michal Wajdeczko (4):
drm/i915: Rename lvds_use_ssc modparam to panel_use_ssc drm/i915: Extend PARAMS_FOR_EACH macro with more data drm/i915: Highlight modified i915 params in gpu error state drm/i915/debugfs: Highlight modified i915 params
drivers/gpu/drm/i915/i915_debugfs.c | 38 +++--- drivers/gpu/drm/i915/i915_drv.h | 20 +++ drivers/gpu/drm/i915/i915_gpu_error.c | 34 +++-- drivers/gpu/drm/i915/i915_params.c | 236 ++-------------------------------- drivers/gpu/drm/i915/i915_params.h | 182 +++++++++++++++++++------- 5 files changed, 208 insertions(+), 302 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 1/4 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
@@ -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
PATCH v4 2/4 drm/i915: Extend PARAMS_FOR_EACH macro with more data
In reply to Michal WajdeczkoCurrently 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)
v4: s/func/param and reorder items (Chris)
v5: Use lowercase names in macro (Jani)
--- drivers/gpu/drm/i915/i915_debugfs.c | 6 +- drivers/gpu/drm/i915/i915_gpu_error.c | 10 +- drivers/gpu/drm/i915/i915_params.c | 236 ++-------------------------------- drivers/gpu/drm/i915/i915_params.h | 182 +++++++++++++++++++------- 4 files changed, 158 insertions(+), 276 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -3
@@ -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); elseBUILD_BUG ();
@@ -66,7 +66,7 @@ static int i915_capabilities(struct seq_file *m, void *data)#undef PRINT_FLAGkernel_param_lock (THIS_MODULE ); -#define PRINT_PARAM (T , x) seq_print_param(m, #x, #T, &i915.x); +#define PRINT_PARAM (X ,T ,V ,U ,M ,B ,D ) seq_print_param(m, #X, #T, &i915.X);I915_PARAMS_FOR_EACH (PRINT_PARAM );#undef PRINT_PARAMkernel_param_unlock (THIS_MODULE );
drivers/gpu/drm/i915/i915_gpu_error.c +5 -5
@@ -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); elseBUILD_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 T , x) err_print_param(m, #x, #T, &p->x); +#define X ,T ,V ,U ,M ,B ,D ) err_print_param(m, #X, #T, &p->X);I915_PARAMS_FOR_EACH (#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 (X ,T ,V ,U ,M ,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 (X ,T ,V ,U ,M ,B ,D ) dup_param(#T, &error->params.X);I915_PARAMS_FOR_EACH (DUP );#undef DUP
drivers/gpu/drm/i915/i915_params.c +11 -225
241 lines not on this page · raw message
drivers/gpu/drm/i915/i915_params.h +139 -43
194 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
PATCH v4 3/4 drm/i915: Highlight modified i915 params in gpu error state
In reply to Michal WajdeczkoWe now know types and default values for all params. Use dedicated err_print macros to dump them in gpu error state and flag any that was modified.
--- drivers/gpu/drm/i915/i915_drv.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/i915_gpu_error.c | 30 ++++++++++++++---------------- 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +20 -0
@@ -252,6 +252,26 @@ static inline const char *enableddisabled(bool v)return v ?"enabled" :"disabled" ; } +static inline bool is_equal_int (int a,int b) +{ +return a == b; +} + +static inline bool is_equal_uint (unsigned int a,unsigned int b) +{ +return a == b; +} + +static inline bool is_equal_bool (bool a,bool b) +{ +return a == b; +} + +static inline bool is_equal_charp (const char *a,const char *b) +{ +return a && b ? !strcmp (a, b) : a == b; +} +enum pipe {INVALID_PIPE =-1 ,PIPE_A =0 ,
drivers/gpu/drm/i915/i915_gpu_error.c +14 -16
@@ -546,27 +546,25 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,#undef PRINT_FLAG } -static __always_inline void err_print_param(struct drm_i915_error_state_buf *m, -const char *name, -const char *type, -const void *x) -{ -if (!__builtin_strcmp (type,"bool" )) -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,"uint" )) -err_printf (m,"i915.%s=%u\n" , name, *(const unsigned int *)x); -else if (!__builtin_strcmp (type,"charp" )) -err_printf (m,"i915.%s=%s\n" , name, *(const char **)x); -else -BUILD_BUG (); +#define err_print_param_int (m, name, x, flag) \ + err_printf(m, "i915.%s=%d%s\n", name, x, flag); +#define err_print_param_uint (m, name, x, flag) \ + err_printf(m, "i915.%s=%u%s\n", name, x, flag); +#define err_print_param_bool (m, name, x, flag) \ + err_printf(m, "i915.%s=%s%s\n", name, yesno(x), flag); +#define err_print_param_charp (m, name, x, flag) \ + err_printf(m, "i915.%s=%s%s\n", name, x, flag); + +static inline const char *param_flag (bool modified) +{ +return modified ?" [modified]" :"" ; }static void err_print_params (struct drm_i915_error_state_buf *m,const struct i915_params *p) { -#define X ,T ,V ,U ,M ,B ,D ) err_print_param(m, #X, #T, &p->X); +#define X ,T ,V ,U ,M ,B ,D ) \ + err_print_param_##T(m, #X, p->X, param_flag(!is_equal_##T(V, p->X)));I915_PARAMS_FOR_EACH (#undef PRINT }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 4/4 drm/i915/debugfs: Highlight modified i915 params
In reply to Michal WajdeczkoWe 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)
v3: rebased and switched into custom seq_print macros (Michal)
--- drivers/gpu/drm/i915/i915_debugfs.c | 38 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +22 -16
@@ -35,21 +35,21 @@ static inline struct drm_i915_private *node_to_i915(struct drm_info_node *node)return to_i915 (node->minor->dev); } -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 -BUILD_BUG (); +#define seq_print_param_bool (m, name, x, tags) \ + seq_printf(m, "i915.%s=%s%s\n", name, yesno(x), tags) +#define seq_print_param_int (m, name, x, tags) \ + seq_printf(m, "i915.%s=%d%s\n", name, x, tags) +#define seq_print_param_uint (m, name, x, tags) \ + seq_printf(m, "i915.%s=%u%s\n", name, x, tags) +#define seq_print_param_charp (m, name, x, tags) \ + seq_printf(m, "i915.%s=%s%s\n", name, x, tags) + +static inline const char *param_tags (bool is_default,bool is_unsafe) +{ +if (is_default) +return "" ; + +return is_unsafe ?" [modified *unsafe*]" :" [modified]" ; }static int i915_capabilities (struct seq_file *m,void *data)
@@ -66,9 +66,15 @@ static int i915_capabilities(struct seq_file *m, void *data)#undef PRINT_FLAGkernel_param_lock (THIS_MODULE ); -#define PRINT_PARAM (X ,T ,V ,U ,M ,B ,D ) seq_print_param(m, #X, #T, &i915.X); +#define FLAG false +#define FLAG_unsafe true +#define PRINT_PARAM (X ,T ,V ,U ,M ,B ,D ) \ + seq_print_param_##T(m, #X, i915.X, \ + param_tags(is_equal_##T(i915.X, V), FLAG##U));I915_PARAMS_FOR_EACH (PRINT_PARAM );#undef PRINT_PARAM +#undef FLAG +#undef FLAG_unsafekernel_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
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Misc improvements around module params (rev4)
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: drm/i915: Misc improvements around module params (rev4)
URL : https://patchwork.freedesktop.org/series/25482/
State : success
== Summary ==
Series 25482v4 drm/i915: Misc improvements around module params
https://patchwork.freedesktop.org/api/1.0/series/25482/revisions/4/mbox/
Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass -> DMESG-WARN (fi-kbl-7560u) fdo#100125fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:470s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:495s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:576s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:555s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:485s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:489s fi-glk-2a total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:589s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:434s fi-hsw-4770r total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:16 time:419s fi-ilk-650 total:278 pass:227 dwarn:0 dfail:0 fail:0 skip:50 time:465s fi-ivb-3520m total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:18 time:494s fi-ivb-3770 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:18 time:517s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:477s 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:581s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:482s fi-skl-6700hq total:278 pass:228 dwarn:1 dfail:0 fail:27 skip:22 time:449s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:518s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:504s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:512s fi-snb-2520m total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:28 time:624s fi-snb-2600 total:278 pass:247 dwarn:0 dfail:0 fail:1 skip:29 time:406s
8d8ba40466f9442b52349da887fb7f03040bc116 drm-tip: 2017y-06m-16d-13h-56m-34s UTC integration manifest 2db53f2 drm/i915/debugfs: Highlight modified i915 params
002dda3 drm/i915: Highlight modified i915 params in gpu error state
c71e600 drm/i915: Extend PARAMS_FOR_EACH macro with more data
b3a8f6a drm/i915: Rename lvds_use_ssc modparam to panel_use_ssc
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4971/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx