drm/i915/guc: Redefine guc_log_level modparam values
Subsystems (2)
PATCH v2 1/2 drm/i915/guc: Redefine guc_log_level modparam values
We used value -1 to indicate "disabled" and values 0..3 to indicate "enabled", but most of our other modparams are using -1 for "auto" mode and 0 for "disable". For consistency let's change our log level values to:
-1: auto (depends on platform and Kconfig.debug settings)
0: disabled
1: enabled (severity level 0 = min)
2: enabled (severity level 1)
3: enabled (severity level 2)
4: enabled (severity level 3 = max)
v2: fix commit message (Sagar)
display sanitized modparam value (Sagar)
unify sanitize messages (Sagar/Michal)
--- drivers/gpu/drm/i915/i915_params.c | 3 +- drivers/gpu/drm/i915/intel_guc.c | 21 ++++++++----- drivers/gpu/drm/i915/intel_guc_log.c | 47 +++++++++++++--------------- drivers/gpu/drm/i915/intel_uc.c | 60 ++++++++++++++++++++++++++++++++---- 4 files changed, 92 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/i915_params.c +2 -1
@@ -155,7 +155,8 @@ struct i915_params i915_modparams __read_mostly = { "(-1=auto, 0=disable [default], 1=GuC submission, 2=HuC load)");i915_param_named (guc_log_level, int,0400 , -"GuC firmware logging level (-1:disabled (default), 0-3:enabled)" ); +"GuC firmware logging level. Requires GuC to be loaded. " +"(-1=auto [default], 0=disable, 1..4=enable with verbosity min..max)" );i915_param_named_unsafe (guc_firmware_path, charp,0400 ,"GuC firmware path to use instead of the default one" );
drivers/gpu/drm/i915/intel_guc.c +14 -7
@@ -215,6 +215,18 @@ static u32 get_core_family(struct drm_i915_private *dev_priv) } } +static u32 get_log_verbosity_flags (void ) +{ +if (i915_modparams.guc_log_level >0 ) { +u32 verbosity = i915_modparams.guc_log_level -1 ; + +GEM_BUG_ON (verbosity >GUC_LOG_VERBOSITY_MAX ); +return verbosity <<GUC_LOG_VERBOSITY_SHIFT ; + } +GEM_BUG_ON (i915_modparams.enable_guc <0 ); +return GUC_LOG_DISABLED ; +} +/* * Initialise the GuC parameter block before starting the firmware * transfer. These parameters are read by the firmware on startup
@@ -247,12 +259,7 @@ void intel_guc_init_params(struct intel_guc *guc) params[GUC_CTL_LOG_PARAMS ] = guc->log.flags; -if (i915_modparams.guc_log_level >=0 ) { - params[GUC_CTL_DEBUG ] = - i915_modparams.guc_log_level <<GUC_LOG_VERBOSITY_SHIFT ; - }else { - params[GUC_CTL_DEBUG ] =GUC_LOG_DISABLED ; - } + params[GUC_CTL_DEBUG ] =get_log_verbosity_flags ();/* If GuC submission is enabled, set up additional parameters here */ if (USES_GUC_SUBMISSION (dev_priv)) {
@@ -445,7 +452,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv)if (guc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS )return 0 ; -if (i915_modparams.guc_log_level >=0 ) +if (i915_modparams.guc_log_level)gen9_enable_guc_interrupts (dev_priv); data[0 ] =INTEL_GUC_ACTION_EXIT_S_STATE ;
drivers/gpu/drm/i915/intel_guc_log.c +22 -25
135 lines not on this page · raw message
drivers/gpu/drm/i915/intel_uc.c +54 -6
102 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/2 drm/i915/guc: Change values for i915_guc_log_control
Today we have format mismatch between read/write operations of i915_guc_log_control entry. For read we return (0, 1..4) that represents disable/verbosity levels, but for write we force user to follow internal structure format (0,1,9,11,13). Let's hide internals from the user and accept same values as we support for read and related guc_log_level modparam.
--- drivers/gpu/drm/i915/intel_guc_log.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_guc_log.c +15 -12
@@ -58,11 +58,15 @@ static int guc_log_flush(struct intel_guc *guc)return intel_guc_send (guc, action,ARRAY_SIZE (action)); } -static int guc_log_control (struct intel_guc *guc,u32 control_val) +static int guc_log_control (struct intel_guc *guc,bool enable,u32 verbosity) { +union guc_log_control control_val = { .logging_enabled = enable, + .reserved1 =0 , + .verbosity = verbosity, + .reserved2 =0 };u32 action[] = {INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING , - control_val + control_val.value };return intel_guc_send (guc, action,ARRAY_SIZE (action));
@@ -567,28 +571,27 @@ void intel_guc_log_destroy(struct intel_guc *guc)int i915_guc_log_control (struct drm_i915_private *dev_priv,u64 control_val) {struct intel_guc *guc = &dev_priv->guc; - -union guc_log_control log_param; +bool enable_logging = control_val >0 ; +u32 verbosity;int ret; - log_param.value = control_val; - -if (log_param.verbosity <GUC_LOG_VERBOSITY_MIN || - log_param.verbosity >GUC_LOG_VERBOSITY_MAX ) +BUILD_BUG_ON (GUC_LOG_VERBOSITY_MIN ); +if (control_val >1 +GUC_LOG_VERBOSITY_MAX )return -EINVAL ;/* This combination doesn't make sense & won't have any effect */ -if (!log_param.logging_enabled && !i915_modparams.guc_log_level) +if (!enable_logging && !i915_modparams.guc_log_level)return 0 ; - ret =guc_log_control (guc, log_param.value); + verbosity = enable_logging ? control_val -1 :0 ; + ret =guc_log_control (guc, enable_logging, verbosity);if (ret <0 ) {DRM_DEBUG_DRIVER ("guc_logging_control action failed %d\n" , ret);return ret; } -if (log_param.logging_enabled) { - i915_modparams.guc_log_level =1 + log_param.verbosity; +if (enable_logging) { + i915_modparams.guc_log_level =1 + verbosity;/* * If log was disabled at boot time, then the relay channel file
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/2] drm/i915/guc: Change values for i915_guc_log_control
Quoted 4 lines · Michal Wajdeczko
Today we have format mismatch between read/write operations of
i915_guc_log_controlentry. For read we return (0, 1..4) that represents disable/verbosity levels, but for write we force user to follow internal structure format (0,1,9,11,13).
0x0, 0x1, 0x11, 0x21, 0x31
Quoted 9 lines
Let's hide internals from the user and accept same values as we support for read and related
guc_log_levelmodparam.Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>
Quoted 54 lines
--- drivers/gpu/drm/i915/intel_guc_log.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/intel_guc_log.c +13
-10@@ -58,11 +58,15 @@ static int guc_log_flush(struct intel_guc *guc)return intel_guc_send (guc, action,ARRAY_SIZE (action)); } -static int guc_log_control (struct intel_guc *guc,u32 control_val) +static int guc_log_control (struct intel_guc *guc,bool enable,u32 verbosity) { +union guc_log_control control_val = { .logging_enabled = enable, + .reserved1 =0 , + .verbosity = verbosity, + .reserved2 =0 };u32 action[] = {INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING , - control_val + control_val.value };return intel_guc_send (guc, action,ARRAY_SIZE (action));@@ -567,28 +571,27 @@ void intel_guc_log_destroy(struct intel_guc *guc)int i915_guc_log_control (struct drm_i915_private *dev_priv,u64 control_val) {struct intel_guc *guc = &dev_priv->guc; - -union guc_log_control log_param; +bool enable_logging = control_val >0 ; +u32 verbosity;int ret; - log_param.value = control_val; - -if (log_param.verbosity <GUC_LOG_VERBOSITY_MIN || - log_param.verbosity >GUC_LOG_VERBOSITY_MAX ) +BUILD_BUG_ON (GUC_LOG_VERBOSITY_MIN ); +if (control_val >1 +GUC_LOG_VERBOSITY_MAX )return -EINVAL ;/* This combination doesn't make sense & won't have any effect */ -if (!log_param.logging_enabled && !i915_modparams.guc_log_level) +if (!enable_logging && !i915_modparams.guc_log_level)return 0 ; - ret =guc_log_control (guc, log_param.value); + verbosity = enable_logging ? control_val -1 :0 ; + ret =guc_log_control (guc, enable_logging, verbosity);if (ret <0 ) {DRM_DEBUG_DRIVER ("guc_logging_control action failed %d\n" , ret);
drivers/gpu/drm/i915/intel_guc_log.c void intel_guc_log_destroy(struct intel_guc *guc) · line 597
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_log.c +2
-2return ret; } -if (log_param.logging_enabled) { - i915_modparams.guc_log_level =1 + log_param.verbosity; +if (enable_logging) { + i915_modparams.guc_log_level =1 + verbosity;/* * If log was disabled at boot time, then the relay channel file
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/2] drm/i915/guc: Change values for i915_guc_log_control
Quoting Sagar Arun Kamble (2018-01-12 05:53:28)
Quoted 11 lines · Michal Wajdeczko
Quoted 4 lines
Today we have format mismatch between read/write operations of
i915_guc_log_controlentry. For read we return (0, 1..4) that represents disable/verbosity levels, but for write we force user to follow internal structure format (0,1,9,11,13).
0x0,0x1,0x11,0x21,0x31Quoted 3 lines
Let's hide internals from the user and accept same values as we support for read and related
guc_log_levelmodparam.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>Reviewed-by Sagar Arun Kamble <[email protected]>
Thanks for the patches and review, pushed.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/2] drm/i915/guc: Change values for i915_guc_log_control
Quoting Chris Wilson (2018-01-18 17:21:57)
Quoted 18 lines
Quoting Sagar Arun Kamble (2018-01-12 05:53:28)
Quoted 17 lines · Michal Wajdeczko
Quoted 4 lines
Today we have format mismatch between read/write operations of
i915_guc_log_controlentry. For read we return (0, 1..4) that represents disable/verbosity levels, but for write we force user to follow internal structure format (0,1,9,11,13).
0x0,0x1,0x11,0x21,0x31Quoted 9 lines
Let's hide internals from the user and accept same values as we support for read and related
guc_log_levelmodparam.Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>
Quoted 3 lines
Quoted 1 line
Reviewed-by Sagar Arun Kamble <[email protected]>Thanks for the patches and review, pushed.
Oh darn it,
30.062893] ======================================================
[ 30.062894] WARNING: possible circular locking dependency detected
[ 30.062895] 4.15.0-rc8-CI-CI_DRM_3648+ #1 Tainted: G U
[ 30.062896] ------------------------------------------------------
[ 30.062897] debugfs_test/1268 is trying to acquire lock:
[ 30.062898] (&dev->struct_mutex){+.+.}, at: [<00000000e4213449>] i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.062921]
but task is already holding lock:
[ 30.062921] (&mm->mmap_sem){++++}, at: [<00000000dd7adc93>] __do_page_fault+0x106/0x560
[ 30.062924]
which lock already depends on the new lock.[ 30.062925]
the existing dependency chain (in reverse order) is:
[ 30.062926]
-> #3 (&mm->mmap_sem){++++}:
[ 30.062930] _copy_to_user+0x1e/0x70
[ 30.062932] filldir+0x8c/0xf0
[ 30.062934] dcache_readdir+0xeb/0x160
[ 30.062935] iterate_dir+0xdc/0x140
[ 30.062936] SyS_getdents+0xa0/0x130
[ 30.062938] entry_SYSCALL_64_fastpath+0x22/0x8f
[ 30.062939]
-> #2 (&sb->s_type->i_mutex_key#3){++++}:
[ 30.062942] start_creating+0x59/0x110
[ 30.062944] __debugfs_create_file+0x2e/0xe0
[ 30.062946] relay_create_buf_file+0x62/0x80
[ 30.062947] relay_late_setup_files+0x84/0x250
[ 30.062967] guc_log_late_setup+0x52/0x110 [i915]
[ 30.062985] i915_guc_log_register+0x3a/0x60 [i915]
[ 30.062997] i915_driver_load+0x7b6/0x1720 [i915]
[ 30.063014] i915_pci_probe+0x2e/0x90 [i915]
[ 30.063017] pci_device_probe+0x9c/0x120
[ 30.063018] driver_probe_device+0x2a3/0x480
[ 30.063020] __driver_attach+0xd9/0xe0
[ 30.063021] bus_for_each_dev+0x57/0x90
[ 30.063022] bus_add_driver+0x168/0x260
[ 30.063023] driver_register+0x52/0xc0
[ 30.063024] do_one_initcall+0x39/0x150
[ 30.063025] do_init_module+0x56/0x1ef
[ 30.063026] load_module+0x231c/0x2d70
[ 30.063027] SyS_finit_module+0xa5/0xe0
[ 30.063028] do_syscall_64+0x59/0x1a0
[ 30.063030] return_from_SYSCALL_64+0x0/0x75
[ 30.063030]
-> #1 (relay_channels_mutex){+.+.}:
[ 30.063034] relay_open+0x12c/0x2b0
[ 30.063051] guc_log_runtime_create+0xa0/0x220 [i915]
[ 30.063067] intel_guc_log_create+0xec/0x1c0 [i915]
[ 30.063083] intel_guc_init+0x5d/0x100 [i915]
[ 30.063100] intel_uc_init+0x29/0xa0 [i915]
[ 30.063116] i915_gem_init+0x18a/0x540 [i915]
[ 30.063128] i915_driver_load+0xaa9/0x1720 [i915]
[ 30.063140] i915_pci_probe+0x2e/0x90 [i915]
[ 30.063141] pci_device_probe+0x9c/0x120
[ 30.063143] driver_probe_device+0x2a3/0x480
[ 30.063144] __driver_attach+0xd9/0xe0
[ 30.063145] bus_for_each_dev+0x57/0x90
[ 30.063146] bus_add_driver+0x168/0x260
[ 30.063147] driver_register+0x52/0xc0
[ 30.063148] do_one_initcall+0x39/0x150
[ 30.063149] do_init_module+0x56/0x1ef
[ 30.063150] load_module+0x231c/0x2d70
[ 30.063151] SyS_finit_module+0xa5/0xe0
[ 30.063152] do_syscall_64+0x59/0x1a0
[ 30.063153] return_from_SYSCALL_64+0x0/0x75
[ 30.063154]
-> #0 (&dev->struct_mutex){+.+.}:
[ 30.063156] __mutex_lock+0x81/0x9b0
[ 30.063172] i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.063187] i915_gem_fault+0x201/0x790 [i915]
[ 30.063190] __do_fault+0x15/0x70
[ 30.063191] __handle_mm_fault+0x677/0xdc0
[ 30.063193] handle_mm_fault+0x14f/0x2f0
[ 30.063194] __do_page_fault+0x2d1/0x560
[ 30.063195] page_fault+0x4c/0x60
[ 30.063196]
other info that might help us debug this:[ 30.063197] Chain exists of:
&dev->struct_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem[ 30.063200] Possible unsafe locking scenario:
[ 30.063201] CPU0 CPU1
[ 30.063201] ---- ----
[ 30.063202] lock(&mm->mmap_sem);
[ 30.063203] lock(&sb->s_type->i_mutex_key#3);
[ 30.063205] lock(&mm->mmap_sem);
[ 30.063206] lock(&dev->struct_mutex);
[ 30.063207]
*** DEADLOCK ***[ 30.063208] 1 lock held by debugfs_test/1268:
[ 30.063209] #0: (&mm->mmap_sem){++++}, at: [<00000000dd7adc93>] __do_page_fault+0x106/0x560
[ 30.063211]
stack backtrace:
[ 30.063213] CPU: 4 PID: 1268 Comm: debugfs_test Tainted: G U 4.15.0-rc8-CI-CI_DRM_3648+ #1
[ 30.063214] Hardware name: System manufacturer System Product Name/Z170 PRO GAMING, BIOS 3402 04/26/2017
[ 30.063214] Call Trace:
[ 30.063216] dump_stack+0x5f/0x86
[ 30.063219] print_circular_bug.isra.18+0x1d0/0x2c0
[ 30.063221] __lock_acquire+0x14ae/0x1b60
[ 30.063224] ? lock_acquire+0xaf/0x200
[ 30.063226] lock_acquire+0xaf/0x200
[ 30.063240] ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.063242] __mutex_lock+0x81/0x9b0
[ 30.063256] ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.063270] ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.063285] ? i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.063298] i915_mutex_lock_interruptible+0x47/0x130 [i915]
[ 30.063300] ? __pm_runtime_resume+0x4f/0x80
[ 30.063315] i915_gem_fault+0x201/0x790 [i915]
[ 30.063317] __do_fault+0x15/0x70
[ 30.063318] ? _raw_spin_unlock+0x29/0x40
[ 30.063320] __handle_mm_fault+0x677/0xdc0
[ 30.063323] handle_mm_fault+0x14f/0x2f0
[ 30.063324] __do_page_fault+0x2d1/0x560
[ 30.063326] ? page_fault+0x36/0x60
[ 30.063327] page_fault+0x4c/0x60
[ 30.063328] RIP: 0033:0x7f6675e9ae4f
[ 30.063329] RSP: 002b:00007ffc3ed48868 EFLAGS: 00010283I thought I had seen a patch for that?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/2] drm/i915/guc: Change values for i915_guc_log_control
Quoted 145 lines · Chris Wilson
Quoting Chris Wilson (2018-01-18 17:21:57)
Quoted 11 lines
Quoting Sagar Arun Kamble (2018-01-12 05:53:28)
Quoted 10 lines · Michal Wajdeczko
Quoted 4 lines
Today we have format mismatch between read/write operations of
i915_guc_log_controlentry. For read we return (0, 1..4) that represents disable/verbosity levels, but for write we force user to follow internal structure format (0,1,9,11,13).
0x0,0x1,0x11,0x21,0x31Quoted 3 lines
Let's hide internals from the user and accept same values as we support for read and related
guc_log_levelmodparam.Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>Reviewed-by Sagar Arun Kamble <[email protected]>Thanks for the patches and review, pushed.
Oh darn it,
30.062893] ====================================================== [ 30.062894] WARNING: possible circular locking dependency detected [ 30.062895] 4.15.0-rc8-CI-CI_DRM_3648+ #1 Tainted: G U [ 30.062896] ------------------------------------------------------ [ 30.062897] debugfs_test/1268 is trying to acquire lock: [ 30.062898] (&dev->struct_mutex){+.+.}, at: [<00000000e4213449>] i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.062921] but task is already holding lock: [ 30.062921] (&mm->mmap_sem){++++}, at: [<00000000dd7adc93>] __do_page_fault+0x106/0x560 [ 30.062924] which lock already depends on the new lock.[ 30.062925] the existing dependency chain (in reverse order) is: [ 30.062926] -> #3 (&mm->mmap_sem){++++}: [ 30.062930] _copy_to_user+0x1e/0x70 [ 30.062932] filldir+0x8c/0xf0 [ 30.062934] dcache_readdir+0xeb/0x160 [ 30.062935] iterate_dir+0xdc/0x140 [ 30.062936] SyS_getdents+0xa0/0x130 [ 30.062938] entry_SYSCALL_64_fastpath+0x22/0x8f [ 30.062939] -> #2 (&sb->s_type->i_mutex_key#3){++++}: [ 30.062942] start_creating+0x59/0x110 [ 30.062944] __debugfs_create_file+0x2e/0xe0 [ 30.062946] relay_create_buf_file+0x62/0x80 [ 30.062947] relay_late_setup_files+0x84/0x250 [ 30.062967] guc_log_late_setup+0x52/0x110 [i915] [ 30.062985] i915_guc_log_register+0x3a/0x60 [i915] [ 30.062997] i915_driver_load+0x7b6/0x1720 [i915] [ 30.063014] i915_pci_probe+0x2e/0x90 [i915] [ 30.063017] pci_device_probe+0x9c/0x120 [ 30.063018] driver_probe_device+0x2a3/0x480 [ 30.063020] __driver_attach+0xd9/0xe0 [ 30.063021] bus_for_each_dev+0x57/0x90 [ 30.063022] bus_add_driver+0x168/0x260 [ 30.063023] driver_register+0x52/0xc0 [ 30.063024] do_one_initcall+0x39/0x150 [ 30.063025] do_init_module+0x56/0x1ef [ 30.063026] load_module+0x231c/0x2d70 [ 30.063027] SyS_finit_module+0xa5/0xe0 [ 30.063028] do_syscall_64+0x59/0x1a0 [ 30.063030] return_from_SYSCALL_64+0x0/0x75 [ 30.063030] -> #1 (relay_channels_mutex){+.+.}: [ 30.063034] relay_open+0x12c/0x2b0 [ 30.063051] guc_log_runtime_create+0xa0/0x220 [i915] [ 30.063067] intel_guc_log_create+0xec/0x1c0 [i915] [ 30.063083] intel_guc_init+0x5d/0x100 [i915] [ 30.063100] intel_uc_init+0x29/0xa0 [i915] [ 30.063116] i915_gem_init+0x18a/0x540 [i915] [ 30.063128] i915_driver_load+0xaa9/0x1720 [i915] [ 30.063140] i915_pci_probe+0x2e/0x90 [i915] [ 30.063141] pci_device_probe+0x9c/0x120 [ 30.063143] driver_probe_device+0x2a3/0x480 [ 30.063144] __driver_attach+0xd9/0xe0 [ 30.063145] bus_for_each_dev+0x57/0x90 [ 30.063146] bus_add_driver+0x168/0x260 [ 30.063147] driver_register+0x52/0xc0 [ 30.063148] do_one_initcall+0x39/0x150 [ 30.063149] do_init_module+0x56/0x1ef [ 30.063150] load_module+0x231c/0x2d70 [ 30.063151] SyS_finit_module+0xa5/0xe0 [ 30.063152] do_syscall_64+0x59/0x1a0 [ 30.063153] return_from_SYSCALL_64+0x0/0x75 [ 30.063154] -> #0 (&dev->struct_mutex){+.+.}: [ 30.063156] __mutex_lock+0x81/0x9b0 [ 30.063172] i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.063187] i915_gem_fault+0x201/0x790 [i915] [ 30.063190] __do_fault+0x15/0x70 [ 30.063191] __handle_mm_fault+0x677/0xdc0 [ 30.063193] handle_mm_fault+0x14f/0x2f0 [ 30.063194] __do_page_fault+0x2d1/0x560 [ 30.063195] page_fault+0x4c/0x60 [ 30.063196] other info that might help us debug this:[ 30.063197] Chain exists of: &dev->struct_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem[ 30.063200] Possible unsafe locking scenario:[ 30.063201] CPU0 CPU1 [ 30.063201] ---- ---- [ 30.063202] lock(&mm->mmap_sem); [ 30.063203] lock(&sb->s_type->i_mutex_key#3); [ 30.063205] lock(&mm->mmap_sem); [ 30.063206] lock(&dev->struct_mutex); [ 30.063207] *** DEADLOCK ***[ 30.063208] 1 lock held by debugfs_test/1268: [ 30.063209] #0: (&mm->mmap_sem){++++}, at: [<00000000dd7adc93>] __do_page_fault+0x106/0x560 [ 30.063211] stack backtrace: [ 30.063213] CPU: 4 PID: 1268 Comm: debugfs_test Tainted: G U 4.15.0-rc8-CI-CI_DRM_3648+ #1 [ 30.063214] Hardware name: System manufacturer System Product Name/Z170 PRO GAMING, BIOS 3402 04/26/2017 [ 30.063214] Call Trace: [ 30.063216] dump_stack+0x5f/0x86 [ 30.063219] print_circular_bug.isra.18+0x1d0/0x2c0 [ 30.063221] __lock_acquire+0x14ae/0x1b60 [ 30.063224] ? lock_acquire+0xaf/0x200 [ 30.063226] lock_acquire+0xaf/0x200 [ 30.063240] ? i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.063242] __mutex_lock+0x81/0x9b0 [ 30.063256] ? i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.063270] ? i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.063285] ? i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.063298] i915_mutex_lock_interruptible+0x47/0x130 [i915] [ 30.063300] ? __pm_runtime_resume+0x4f/0x80 [ 30.063315] i915_gem_fault+0x201/0x790 [i915] [ 30.063317] __do_fault+0x15/0x70 [ 30.063318] ? _raw_spin_unlock+0x29/0x40 [ 30.063320] __handle_mm_fault+0x677/0xdc0 [ 30.063323] handle_mm_fault+0x14f/0x2f0 [ 30.063324] __do_page_fault+0x2d1/0x560 [ 30.063326] ? page_fault+0x36/0x60 [ 30.063327] page_fault+0x4c/0x60 [ 30.063328] RIP: 0033:0x7f6675e9ae4f [ 30.063329] RSP: 002b:00007ffc3ed48868 EFLAGS: 00010283
Quoted 1 line
I thought I had seen a patch for that?
Yes. It was being worked at while this series was also in progress.
Should have pushed that first. Currently checking sanity on trybot and will post once it passes.
Thanks,
Sagar
Quoted 1 line
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v2,1/2] drm/i915/guc: Redefine guc_log_level modparam values
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: series starting with [v2,1/2] drm/i915/guc: Redefine guc_log_level modparam values
URL : https://patchwork.freedesktop.org/series/36341/
State : success
== Summary ==
Series 36341v1 series starting with [v2,1/2] drm/i915/guc: Redefine guc_log_level modparam values
https://patchwork.freedesktop.org/api/1.0/series/36341/revisions/1/mbox/
Test debugfs_test:
Subgroup read_all_entries:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> INCOMPLETE (fi-bdw-5557u) fdo#104162
fail -> PASS (fi-skl-6700k2) fdo#103191fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104162 https://bugs.freedesktop.org/show_bug.cgi?id=104162
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fi-bdw-5557u total:245 pass:227 dwarn:0 dfail:0 fail:0 skip:17 fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:375s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:485s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:280s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:484s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:483s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:475s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:454s fi-cnl-y2 total:288 pass:258 dwarn:3 dfail:0 fail:0 skip:27 time:543s fi-elk-e7500 total:224 pass:168 dwarn:10 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:275s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:511s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:393s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:403s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:412s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:459s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:413s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:468s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:500s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:454s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:504s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:579s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:430s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:512s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:529s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:494s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:478s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:431s fi-snb-2520m total:3 pass:2 dwarn:0 dfail:0 fail:0 skip:0 fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:394s Blacklisted hosts: fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:568s fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:472s
fi-bdw-gvtdvm failed to collect. IGT log at Patchwork_7650/fi-bdw-gvtdvm/igt.log
da4321c7c088d01ad62b18d37dcfe5ef8d0b855d drm-tip: 2018y-01m-11d-14h-59m-37s UTC integration manifest 6623668a0fee drm/i915/guc: Change values for i915_guc_log_controla7d4778bb579 drm/i915/guc: Redefine guc_log_level modparam values
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7650/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Michal Wajdeczko
We used value -1 to indicate "disabled" and values 0..3 to indicate "enabled", but most of our other modparams are using -1 for "auto" mode and 0 for "disable". For consistency let's change our log level values to:
-1: auto (depends on platform and
Kconfig.debugsettings)
0: disabled
1: enabled (severity level 0 = min)
2: enabled (severity level 1)
3: enabled (severity level 2)
4: enabled (severity level 3 = max)v2: fix commit message (Sagar)
display sanitized modparam value (Sagar)
unify sanitize messages (Sagar/Michal)
Quoted 6 lines
Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>
Quoted 323 lines
--- drivers/gpu/drm/i915/i915_params.c | 3 +- drivers/gpu/drm/i915/intel_guc.c | 21 ++++++++----- drivers/gpu/drm/i915/intel_guc_log.c | 47 +++++++++++++--------------- drivers/gpu/drm/i915/intel_uc.c | 60 ++++++++++++++++++++++++++++++++---- 4 files changed, 92 insertions(+), 39 deletions(-)drivers/gpu/drm/i915/i915_params.c +2
-1@@ -155,7 +155,8 @@ struct i915_params i915_modparams __read_mostly = { "(-1=auto, 0=disable [default], 1=GuC submission, 2=HuC load)");i915_param_named (guc_log_level, int,0400 , -"GuC firmware logging level (-1:disabled (default), 0-3:enabled)" ); +"GuC firmware logging level. Requires GuC to be loaded. " +"(-1=auto [default], 0=disable, 1..4=enable with verbosity min..max)" );i915_param_named_unsafe (guc_firmware_path, charp,0400 ,"GuC firmware path to use instead of the default one" );drivers/gpu/drm/i915/intel_guc.c +14
-7@@ -215,6 +215,18 @@ static u32 get_core_family(struct drm_i915_private *dev_priv) } } +static u32 get_log_verbosity_flags (void ) +{ +if (i915_modparams.guc_log_level >0 ) { +u32 verbosity = i915_modparams.guc_log_level -1 ; + +GEM_BUG_ON (verbosity >GUC_LOG_VERBOSITY_MAX ); +return verbosity <<GUC_LOG_VERBOSITY_SHIFT ; + } +GEM_BUG_ON (i915_modparams.enable_guc <0 ); +return GUC_LOG_DISABLED ; +} +/* * Initialise the GuC parameter block before starting the firmware * transfer. These parameters are read by the firmware on startup @@ -247,12 +259,7 @@ void intel_guc_init_params(struct intel_guc *guc) params[GUC_CTL_LOG_PARAMS ] = guc->log.flags; -if (i915_modparams.guc_log_level >=0 ) { - params[GUC_CTL_DEBUG ] = - i915_modparams.guc_log_level <<GUC_LOG_VERBOSITY_SHIFT ; - }else { - params[GUC_CTL_DEBUG ] =GUC_LOG_DISABLED ; - } + params[GUC_CTL_DEBUG ] =get_log_verbosity_flags ();/* If GuC submission is enabled, set up additional parameters here */ if (USES_GUC_SUBMISSION (dev_priv)) {@@ -445,7 +452,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv)if (guc->fw.load_status !=INTEL_UC_FIRMWARE_SUCCESS )return 0 ; -if (i915_modparams.guc_log_level >=0 ) +if (i915_modparams.guc_log_level)gen9_enable_guc_interrupts (dev_priv); data[0 ] =INTEL_GUC_ACTION_EXIT_S_STATE ;drivers/gpu/drm/i915/intel_guc_log.c +22
-25@@ -33,11 +33,10 @@/** * DOC: GuC firmware log * -* Firmware log is enabled by setting i915.guc_log_level to non-negative level. +* Firmware log is enabled by setting i915.guc_log_level to the positive level. * Log data is printed out via reading debugfs i915_guc_log_dump. Reading from * i915_guc_load_status will print out firmware loading status and scratch * registers value. -* */ static int guc_log_flush_complete (struct intel_guc *guc)@@ -147,7 +146,7 @@ static int guc_log_relay_file_create(struct intel_guc *guc)struct dentry *log_dir;int ret; -if (i915_modparams.guc_log_level <0 ) +if (!i915_modparams.guc_log_level)return 0 ;/* For now create the log file in /sys/kernel/debug/dri/0 dir */ @@ -423,8 +422,8 @@ static void guc_log_runtime_destroy(struct intel_guc *guc) {/* * It's possible that the runtime stuff was never allocated because -* guc_log_level was < 0 at the time -**/ +* GuC log was disabled at the boot time. +*/ if (!guc_log_has_runtime (guc))return ;@@ -441,9 +440,10 @@ static int guc_log_late_setup(struct intel_guc *guc)lockdep_assert_held (&dev_priv->drm.struct_mutex);if (!guc_log_has_runtime (guc)) { -/* If log_level was set as -1 at boot time, then setup needed to -* handle log buffer flush interrupts would not have been done yet, -* so do that now. +/* +* If log was disabled at boot time, then setup needed to handle +* log buffer flush interrupts would not have been done yet, so +* do that now. */ ret =guc_log_runtime_create (guc);if (ret)@@ -460,7 +460,7 @@ static int guc_log_late_setup(struct intel_guc *guc)guc_log_runtime_destroy (guc); err:/* logging will remain off */ - i915_modparams.guc_log_level =-1 ; + i915_modparams.guc_log_level =0 ;return ret; }@@ -482,8 +482,7 @@ static void guc_flush_logs(struct intel_guc *guc) {struct drm_i915_private *dev_priv =guc_to_i915 (guc); -if (!USES_GUC_SUBMISSION (dev_priv) || - (i915_modparams.guc_log_level <0 )) +if (!USES_GUC_SUBMISSION (dev_priv) || !i915_modparams.guc_log_level)return ;/* First disable the interrupts, will be renabled afterwards */ @@ -511,9 +510,6 @@ int intel_guc_log_create(struct intel_guc *guc)GEM_BUG_ON (guc->log.vma); -if (i915_modparams.guc_log_level >GUC_LOG_VERBOSITY_MAX ) - i915_modparams.guc_log_level =GUC_LOG_VERBOSITY_MAX ; -/* The first page is to save log buffer state. Allocate one * extra page for others in case for overlap */ size = (1 + GUC_LOG_DPC_PAGES + 1 +@@ -537,7 +533,7 @@ int intel_guc_log_create(struct intel_guc *guc) guc->log.vma = vma; -if (i915_modparams.guc_log_level >=0 ) { +if (i915_modparams.guc_log_level) { ret =guc_log_runtime_create (guc);if (ret <0 ) goto err_vma;@@ -558,7 +554,7 @@ int intel_guc_log_create(struct intel_guc *guc)i915_vma_unpin_and_release (&guc->log.vma); err:/* logging will be off */ - i915_modparams.guc_log_level =-1 ; + i915_modparams.guc_log_level =0 ;return ret; }@@ -582,7 +578,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)return -EINVAL ;/* This combination doesn't make sense & won't have any effect */ -if (!log_param.logging_enabled && (i915_modparams.guc_log_level <0 )) +if (!log_param.logging_enabled && !i915_modparams.guc_log_level)return 0 ; ret =guc_log_control (guc, log_param.value);@@ -592,11 +588,12 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val) }if (log_param.logging_enabled) { - i915_modparams.guc_log_level = log_param.verbosity; + i915_modparams.guc_log_level =1 + log_param.verbosity; -/* If log_level was set as -1 at boot time, then the relay channel file -* wouldn't have been created by now and interrupts also would not have -* been enabled. Try again now, just in case. +/* +* If log was disabled at boot time, then the relay channel file +* wouldn't have been created by now and interrupts also would +* not have been enabled. Try again now, just in case. */ ret =guc_log_late_setup (guc);if (ret <0 ) {@@ -607,7 +604,8 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)/* GuC logging is currently the only user of Guc2Host interrupts */ gen9_enable_guc_interrupts (dev_priv); }else { -/* Once logging is disabled, GuC won't generate logs & send an +/* +* Once logging is disabled, GuC won't generate logs & send an * interrupt. But there could be some data in the log buffer * which is yet to be captured. So request GuC to update the log * buffer state and then collect the left over logs. @@ -615,7 +613,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)guc_flush_logs (guc);/* As logging is disabled, update log level to reflect that */ - i915_modparams.guc_log_level =-1 ; + i915_modparams.guc_log_level =0 ; }return ret;@@ -623,8 +621,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)void i915_guc_log_register (struct drm_i915_private *dev_priv) { -if (!USES_GUC_SUBMISSION (dev_priv) || - (i915_modparams.guc_log_level <0 )) +if (!USES_GUC_SUBMISSION (dev_priv) || !i915_modparams.guc_log_level)return ;mutex_lock (&dev_priv->drm.struct_mutex);drivers/gpu/drm/i915/intel_uc.c +53
-5@@ -65,6 +65,21 @@ static int __get_platform_enable_guc(struct drm_i915_private *dev_priv)return enable_guc; } +static int __get_default_guc_log_level (struct drm_i915_private *dev_priv) +{ +int guc_log_level =0 ;/* disabled */ + +/* Enable if we're running on platform with GuC and debug config */ +if (HAS_GUC (dev_priv) &&intel_uc_is_using_guc () && + (IS_ENABLED (CONFIG_DRM_I915_DEBUG ) || +IS_ENABLED (CONFIG_DRM_I915_DEBUG_GEM ))) + guc_log_level =1 +GUC_LOG_VERBOSITY_MAX ; + +/* Any platform specific fine-tuning can be done here */ + +return guc_log_level; +} +/** * intel_uc_sanitize_options - sanitize uC related modparam options * @dev_priv: device private @@ -74,6 +89,13 @@ static int __get_platform_enable_guc(struct drm_i915_private *dev_priv)* modparam varies between platforms and it is hardcoded in driver code. * Any other modparam value is only monitored against availability of the * related hardware or firmware definitions. +* +* In case of "guc_log_level" option this function will attempt to modify +* it only if it was initially set to "auto(-1)" or if initial value was +* "enable(1..4)" on platforms without the GuC. Default value for this +* modparam varies between platforms and is usually set to "disable(0)" +* unless GuC is enabled on given platform and the driver is compiled with +* debug config when this modparam will default to "enable(1..4)". */ void intel_uc_sanitize_options (struct drm_i915_private *dev_priv) {@@ -91,22 +113,48 @@ void intel_uc_sanitize_options(struct drm_i915_private *dev_priv)/* Verify GuC firmware availability */ if (intel_uc_is_using_guc () && !intel_uc_fw_is_selected (guc_fw)) { -DRM_WARN ("Incompatible option detected: enable_guc=%d, %s!\n" , - i915_modparams.enable_guc, +DRM_WARN ("Incompatible option detected: %s=%d, %s!\n" , +"enable_guc" , i915_modparams.enable_guc, !HAS_GUC (dev_priv) ?"no GuC hardware" :"no GuC firmware" ); }/* Verify HuC firmware availability */ if (intel_uc_is_using_huc () && !intel_uc_fw_is_selected (huc_fw)) { -DRM_WARN ("Incompatible option detected: enable_guc=%d, %s!\n" , - i915_modparams.enable_guc, +DRM_WARN ("Incompatible option detected: %s=%d, %s!\n" , +"enable_guc" , i915_modparams.enable_guc, !HAS_HUC (dev_priv) ?"no HuC hardware" :"no HuC firmware" ); } +/* A negative value means "use platform/config default" */ +if (i915_modparams.guc_log_level <0 ) + i915_modparams.guc_log_level = +__get_default_guc_log_level (dev_priv); + +if (i915_modparams.guc_log_level >0 && !intel_uc_is_using_guc ()) { +DRM_WARN ("Incompatible option detected: %s=%d, %s!\n" , +"guc_log_level" , i915_modparams.guc_log_level, + !HAS_GUC (dev_priv) ?"no GuC hardware" : +"GuC not enabled" ); + i915_modparams.guc_log_level =0 ; + } + +if (i915_modparams.guc_log_level >1 +GUC_LOG_VERBOSITY_MAX ) { +DRM_WARN ("Incompatible option detected: %s=%d, %s!\n" , +"guc_log_level" , i915_modparams.guc_log_level, +"verbosity too high" ); + i915_modparams.guc_log_level =1 +GUC_LOG_VERBOSITY_MAX ; + } + +DRM_DEBUG_DRIVER ("guc_log_level=%d (enabled:%s verbosity:%d)\n" , + i915_modparams.guc_log_level, +yesno (i915_modparams.guc_log_level), + i915_modparams.guc_log_level -1 ); +/* Make sure that sanitization was done */ GEM_BUG_ON (i915_modparams.enable_guc <0 ); +GEM_BUG_ON (i915_modparams.guc_log_level <0 ); }void intel_uc_init_early (struct drm_i915_private *dev_priv)@@ -152,7 +200,7 @@ void intel_uc_init_mmio(struct drm_i915_private *dev_priv)static void guc_capture_load_err_log (struct intel_guc *guc) { -if (!guc->log.vma || i915_modparams.guc_log_level <0 ) +if (!guc->log.vma || !i915_modparams.guc_log_level)return ;if (!guc->load_err_log)
drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 376
Quoted 8 lines
drivers/gpu/drm/i915/intel_uc.c +1
-1@@ -322,7 +370,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) }if (USES_GUC_SUBMISSION (dev_priv)) { -if (i915_modparams.guc_log_level >=0 ) +if (i915_modparams.guc_log_level)gen9_enable_guc_interrupts (dev_priv); ret =intel_guc_submission_enable (guc);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx