Skip to contentSkip to conversation

drm/i915/guc: Fix null pointer dereference when GuC FW is not available

PATCH In review Piotr Piórkowski 5 participants 10 messages Mar 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915/guc: Fix null pointer dereference when GuC FW is not available

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

[   71.098873] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[   71.098938] IP: intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.098947] PGD 0 P4D 0
[   71.098956] Oops: 0000 [#1] PREEMPT SMP PTI
[   71.098965] Modules linked in: i915(O+) netconsole x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel mei_me i2c_i801 prime_numbers mei [last unloaded: i915]
[   71.099005] CPU: 2 PID: 1167 Comm: insmod Tainted: G     U  W  O     4.16.0-rc1+ #337
[   71.099018] Hardware name: /NUC6i5SYB, BIOS SYSKLi35.86A.0065.2018.0103.1000 01/03/2018
[   71.099077] RIP: 0010:intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.099087] RSP: 0018:ffffc90000417aa0 EFLAGS: 00010282
[   71.099097] RAX: 0000000000000000 RBX: ffff88084cad12f8 RCX: ffffffffa03e9357
[   71.099108] RDX: 0000000000000002 RSI: ffffffffa034dba0 RDI: ffff88084cad12f8
[   71.099118] RBP: 0000000000000002 R08: ffff88085344ca90 R09: 0000000000000001
[   71.099128] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88084cad0000
[   71.099139] R13: ffffffffa034dba0 R14: 00000000fffffff5 R15: ffff88084cad12b0
[   71.099151] FS:  00007f7f24ae2740(0000) GS:ffff88085e200000(0000) knlGS:0000000000000000
[   71.099162] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   71.099171] CR2: 0000000000000008 CR3: 0000000855f48001 CR4: 00000000003606e0
[   71.099182] Call Trace:
[   71.099246]  intel_uc_init_hw+0xc8/0x520 [i915]
[   71.099303]  i915_gem_init_hw+0x11f/0x2d0 [i915]
[   71.099364]  i915_gem_init+0x2b9/0x640 [i915]
[   71.099413]  i915_driver_load+0xb74/0x1110 [i915]
[   71.099462]  i915_pci_probe+0x2e/0x90 [i915]
[   71.099476]  pci_device_probe+0xa1/0x130
[   71.099488]  driver_probe_device+0x302/0x470
[   71.099502]  __driver_attach+0xb9/0xe0
[   71.099513]  ? driver_probe_device+0x470/0x470
[   71.099525]  ? driver_probe_device+0x470/0x470
[   71.099538]  bus_for_each_dev+0x64/0x90
[   71.099550]  bus_add_driver+0x164/0x260
[   71.099561]  ? 0xffffffffa04d6000
[   71.099572]  driver_register+0x57/0xc0
[   71.099582]  ? 0xffffffffa04d6000
[   71.099593]  do_one_initcall+0x3b/0x160
[   71.099606]  ? kmem_cache_alloc_trace+0x1c3/0x2a0
[   71.099621]  do_init_module+0x5b/0x1f9
[   71.099635]  load_module+0x2467/0x2a70
[   71.099654]  ? SyS_finit_module+0xbd/0xe0
[   71.099668]  SyS_finit_module+0xbd/0xe0
[   71.099682]  do_syscall_64+0x73/0x1c0
[   71.099694]  entry_SYSCALL_64_after_hwframe+0x26/0x9b
[   71.099706] RIP: 0033:0x7f7f23fb40d9
[   71.099717] RSP: 002b:00007ffda7d67ed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   71.099734] RAX: ffffffffffffffda RBX: 000055f96e2a8870 RCX: 00007f7f23fb40d9
[   71.099748] RDX: 0000000000000000 RSI: 000055f96e2a8260 RDI: 0000000000000003
[   71.099763] RBP: 000055f96e2a8260 R08: 0000000000000000 R09: 00007ffda7d68088
[   71.099777] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
[   71.099791] R13: 000055f96e2a8830 R14: 0000000000000000 R15: 000055f96e2a8260
[   71.099810] Code: 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 55 41 54 49 89 f5 55 53 48 c7 c1 57 93 3e a0 48 8b 47 10 48 89 fb 4c 8b 07 <48> 8b 68 08 8b 47 28 85 c0 74 15 83 f8 01 48 c7 c1 5b 93 3e a0
[   71.100004] RIP: intel_uc_fw_upload+0x1f/0x360 [i915] RSP: ffffc90000417aa0
[   71.100020] CR2: 0000000000000008
[   71.100031] ---[ end trace d8ac93c30ceff5b2 ]--
Fixes 6b0478fb722a ("drm/i915: Implement dynamic GuC WOPCM offset and size calculation")

v2: don't assume it is always GuC FW (Michal)
v3: added a new variable to avoid exceeding the number of characters in the line (Michal)

Cc Michał Winiarski <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Jackie Li <[email protected]>
Cc Radoslaw Szwichtenberg <[email protected]>
---
 drivers/gpu/drm/i915/intel_uc_fw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uc_fw.c +3 -3
index 30c73243f54d..93b0fc661b3a 100644
@@ -199,9 +199,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
 		       int (*xfer)(struct intel_uc_fw *uc_fw,
 				   struct i915_vma *vma))
 {
-	struct drm_i915_private *i915 = to_i915(uc_fw->obj->base.dev);
 	struct i915_vma *vma;
 	int err;
+	u32 ggtt_pin_bias;
 
 	DRM_DEBUG_DRIVER("%s fw load %s\n",
 			 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
@@ -222,9 +222,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
 		goto fail;
 	}
 
+	ggtt_pin_bias = to_i915(uc_fw->obj->base.dev)->guc.ggtt_pin_bias;
 	vma = i915_gem_object_ggtt_pin(uc_fw->obj, NULL, 0, 0,
-				       PIN_OFFSET_BIAS |
-				       i915->guc.ggtt_pin_bias);
+				       PIN_OFFSET_BIAS | ggtt_pin_bias);
 	if (IS_ERR(vma)) {
 		err = PTR_ERR(vma);
 		DRM_DEBUG_DRIVER("%s fw ggtt-pin err=%d\n",
Signature · 6 lines
2.14.3

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

PATCH 2/2 HAX: Enable GuC for CI

---
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_params.h +1 -1
index c96360398072..53037b5eff22 100644
@@ -47,7 +47,7 @@ struct drm_printer;
 	param(int, disable_power_well, -1) \
 	param(int, enable_ips, 1) \
 	param(int, invert_brightness, 0) \
-	param(int, enable_guc, 0) \
+	param(int, enable_guc, -1) \
 	param(int, guc_log_level, -1) \
 	param(char *, guc_firmware_path, NULL) \
 	param(char *, huc_firmware_path, NULL) \
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
In reply to Piotr Piórkowski
Quoted 2 lines · Piotr Piórkowski

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

Patch looks good but I have query on usage of enable_guc modparam.
enable_guc modparam will enable GuC/HuC only if firmware is available.
If user sets to forcefully enable GuC/HuC on systems that don't have firmware then it is user's fault. Michal, could you please clarify.

Thanks,
Sagar

Quoted 102 lines
[   71.098873] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[   71.098938] IP: intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.098947] PGD 0 P4D 0
[   71.098956] Oops: 0000 [#1] PREEMPT SMP PTI
[   71.098965] Modules linked in: i915(O+) netconsole x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel mei_me i2c_i801 prime_numbers mei [last unloaded: i915]
[   71.099005] CPU: 2 PID: 1167 Comm: insmod Tainted: G     U  W  O     4.16.0-rc1+ #337
[   71.099018] Hardware name: /NUC6i5SYB, BIOS SYSKLi35.86A.0065.2018.0103.1000 01/03/2018
[   71.099077] RIP: 0010:intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.099087] RSP: 0018:ffffc90000417aa0 EFLAGS: 00010282
[   71.099097] RAX: 0000000000000000 RBX: ffff88084cad12f8 RCX: ffffffffa03e9357
[   71.099108] RDX: 0000000000000002 RSI: ffffffffa034dba0 RDI: ffff88084cad12f8
[   71.099118] RBP: 0000000000000002 R08: ffff88085344ca90 R09: 0000000000000001
[   71.099128] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88084cad0000
[   71.099139] R13: ffffffffa034dba0 R14: 00000000fffffff5 R15: ffff88084cad12b0
[   71.099151] FS:  00007f7f24ae2740(0000) GS:ffff88085e200000(0000) knlGS:0000000000000000
[   71.099162] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   71.099171] CR2: 0000000000000008 CR3: 0000000855f48001 CR4: 00000000003606e0
[   71.099182] Call Trace:
[   71.099246]  intel_uc_init_hw+0xc8/0x520 [i915]
[   71.099303]  i915_gem_init_hw+0x11f/0x2d0 [i915]
[   71.099364]  i915_gem_init+0x2b9/0x640 [i915]
[   71.099413]  i915_driver_load+0xb74/0x1110 [i915]
[   71.099462]  i915_pci_probe+0x2e/0x90 [i915]
[   71.099476]  pci_device_probe+0xa1/0x130
[   71.099488]  driver_probe_device+0x302/0x470
[   71.099502]  __driver_attach+0xb9/0xe0
[   71.099513]  ? driver_probe_device+0x470/0x470
[   71.099525]  ? driver_probe_device+0x470/0x470
[   71.099538]  bus_for_each_dev+0x64/0x90
[   71.099550]  bus_add_driver+0x164/0x260
[   71.099561]  ? 0xffffffffa04d6000
[   71.099572]  driver_register+0x57/0xc0
[   71.099582]  ? 0xffffffffa04d6000
[   71.099593]  do_one_initcall+0x3b/0x160
[   71.099606]  ? kmem_cache_alloc_trace+0x1c3/0x2a0
[   71.099621]  do_init_module+0x5b/0x1f9
[   71.099635]  load_module+0x2467/0x2a70
[   71.099654]  ? SyS_finit_module+0xbd/0xe0
[   71.099668]  SyS_finit_module+0xbd/0xe0
[   71.099682]  do_syscall_64+0x73/0x1c0
[   71.099694]  entry_SYSCALL_64_after_hwframe+0x26/0x9b
[   71.099706] RIP: 0033:0x7f7f23fb40d9
[   71.099717] RSP: 002b:00007ffda7d67ed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   71.099734] RAX: ffffffffffffffda RBX: 000055f96e2a8870 RCX: 00007f7f23fb40d9
[   71.099748] RDX: 0000000000000000 RSI: 000055f96e2a8260 RDI: 0000000000000003
[   71.099763] RBP: 000055f96e2a8260 R08: 0000000000000000 R09: 00007ffda7d68088
[   71.099777] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
[   71.099791] R13: 000055f96e2a8830 R14: 0000000000000000 R15: 000055f96e2a8260
[   71.099810] Code: 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 55 41 54 49 89 f5 55 53 48 c7 c1 57 93 3e a0 48 8b 47 10 48 89 fb 4c 8b 07 <48> 8b 68 08 8b 47 28 85 c0 74 15 83 f8 01 48 c7 c1 5b 93 3e a0
[   71.100004] RIP: intel_uc_fw_upload+0x1f/0x360 [i915] RSP: ffffc90000417aa0
[   71.100020] CR2: 0000000000000008
[   71.100031] ---[ end trace d8ac93c30ceff5b2 ]--
Fixes 6b0478fb722a ("drm/i915: Implement dynamic GuC WOPCM offset and size calculation")

v2: don't assume it is always GuC FW (Michal)
v3: added a new variable to avoid exceeding the number of characters in the line (Michal)

Cc Michał Winiarski <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Jackie Li <[email protected]>
Cc Radoslaw Szwichtenberg <[email protected]>
---
  drivers/gpu/drm/i915/intel_uc_fw.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_uc_fw.c +3 -3
index 30c73243f54d..93b0fc661b3a 100644
@@ -199,9 +199,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
  		       int (*xfer)(struct intel_uc_fw *uc_fw,
  				   struct i915_vma *vma))
  {
-	struct drm_i915_private *i915 = to_i915(uc_fw->obj->base.dev);
  	struct i915_vma *vma;
  	int err;
+	u32 ggtt_pin_bias;
 
  	DRM_DEBUG_DRIVER("%s fw load %s\n",
  			 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
@@ -222,9 +222,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
  		goto fail;
  	}
 
+	ggtt_pin_bias = to_i915(uc_fw->obj->base.dev)->guc.ggtt_pin_bias;
  	vma = i915_gem_object_ggtt_pin(uc_fw->obj, NULL, 0, 0,
-				       PIN_OFFSET_BIAS |
-				       i915->guc.ggtt_pin_bias);
+				       PIN_OFFSET_BIAS | ggtt_pin_bias);
  	if (IS_ERR(vma)) {
  		err = PTR_ERR(vma);
  		DRM_DEBUG_DRIVER("%s fw ggtt-pin err=%d\n",
Signature · 7 lines
Thanks,
Sagar

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 7 lines · Sagar Arun Kamble
Quoted 2 lines · Piotr Piórkowski

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

Patch looks good but I have query on usage of enable_guc modparam. enable_guc modparam will enable GuC/HuC only if firmware is available.

During modparam sanitization phase, code will only check for firmware name, code will attempt to check if firmware file exists.

Quoted 1 line

If user sets to forcefully enable GuC/HuC on systems that don't have firmware then it is user's fault.

Sure its user's fault, but event in such case we should just gracefully abort driver load, without any NULL pointer BUG ;)

And note, that we will hit this bug not only when user force GuC with:
enable_guc=1 guc_firmware_path=/does/not/exist

but also when user just specify auto mode:

	enable_guc=-1

when predefined firmwares are not present (not installed or removed)

/m

Quoted 2 lines

Michal, could you please clarify.

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

#4 lore raw
Quoted 4 lines · Michal Wajdeczko
Quoted 2 lines · Sagar Arun Kamble
Quoted 8 lines
Quoted 5 lines · Piotr Piórkowski
Quoted 2 lines

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

Patch looks good but I have query on usage of enable_guc modparam. enable_guc modparam will enable GuC/HuC only if firmware is available.

During modparam sanitization phase, code will only check for firmware name, code will attempt to check if firmware file exists.

Is it better if we won't even call into upload FW once we found the FW fetching was failed?

Quoted 6 lines
Quoted 2 lines

If user sets to forcefully enable GuC/HuC on systems that don't have firmware then it is user's fault.

Sure its user's fault, but event in such case we should just gracefully abort driver load, without any NULL pointer BUG ;)

Quoted 8 lines

And note, that we will hit this bug not only when user force GuC with:
    enable_guc=1 guc_firmware_path=/does/not/exist

but also when user just specify auto mode:
    enable_guc=-1

when predefined firmwares are not present (not installed or removed)

it feels like it's still user's fault even with the auto mode. why the user even set the enable_guc to -1 after known the fact that the FWs are not present? I mean should users be expected to know the fact that the auto mode enable_guc = -1 will enable the GuC and HuC, if the guc_firmware_path was left to be none?

I agree we should make sure correct pointer access. it's a non-excusable fault:)

The thing actually frustrated me was that we failed to screen such an error with the CI, but suddenly it broke things and tests with incorrect configurations (enable_guc set to 1 or -1 + No FW available). so maybe we should add a case to cover such a case in CI as well if we did have such test configurations.

Thanks,
-Jackie

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

#5 lore raw
Quoted 26 lines · Yaodong Li
Quoted 4 lines · Michal Wajdeczko
Quoted 2 lines · Sagar Arun Kamble
Quoted 8 lines
Quoted 5 lines · Piotr Piórkowski
Quoted 2 lines

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

Patch looks good but I have query on usage of enable_guc modparam. enable_guc modparam will enable GuC/HuC only if firmware is available.

During modparam sanitization phase, code will only check for firmware name, code will attempt to check if firmware file exists.

Is it better if we won't even call into upload FW once we found the FW fetching was failed?

Quoted 12 lines
Quoted 2 lines

If user sets to forcefully enable GuC/HuC on systems that don't have firmware then it is user's fault.

Sure its user's fault, but event in such case we should just gracefully abort driver load, without any NULL pointer BUG ;)

And note, that we will hit this bug not only when user force GuC with:
enable_guc=1 guc_firmware_path=/does/not/exist

but also when user just specify auto mode:

    enable_guc=-1
Quoted 7 lines
Quoted 2 lines

when predefined firmwares are not present (not installed or removed)

it feels like it's still user's fault even with the auto mode. why the user even set the enable_guc to -1 after known the fact that the FWs are not present? I mean should users be expected to know the fact that the auto mode enable_guc = -1 will enable the GuC and HuC, if the guc_firmware_path was left to be none?

GuC fw path will not be none, as we have some hardcoded paths in the code. And we don't tell the user that after turning on 'auto' mode, he has to do something special. Only later in case of fw fetch errors, we are just printing error message with extra help:

"%s: Failed to fetch firmware %s (error %d)\n"
"%s: Firmware can be downloaded from %s\n"

Quoted 8 lines

I agree we should make sure correct pointer access. it's a non-excusable fault:)

The thing actually frustrated me was that we failed to screen such an error with the CI, but suddenly it broke things and tests with incorrect configurations (enable_guc set to 1 or -1 + No FW available). so maybe we should add a case to cover such a case in CI as well if we did have such test configurations.

I guess you can write such test on your own and submit patch to igt-dev ;)

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

#6 lore raw
Quoted 36 lines · Michal Wajdeczko
Quoted 26 lines · Yaodong Li
Quoted 4 lines · Michal Wajdeczko
Quoted 2 lines · Sagar Arun Kamble
Quoted 8 lines
Quoted 5 lines · Piotr Piórkowski
Quoted 2 lines

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

Patch looks good but I have query on usage of enable_guc modparam. enable_guc modparam will enable GuC/HuC only if firmware is available.

During modparam sanitization phase, code will only check for firmware name, code will attempt to check if firmware file exists.

Is it better if we won't even call into upload FW once we found the FW fetching was failed?

Quoted 12 lines
Quoted 2 lines

If user sets to forcefully enable GuC/HuC on systems that don't have firmware then it is user's fault.

Sure its user's fault, but event in such case we should just gracefully abort driver load, without any NULL pointer BUG ;)

And note, that we will hit this bug not only when user force GuC with:
    enable_guc=1 guc_firmware_path=/does/not/exist

but also when user just specify auto mode:
    enable_guc=-1

Quoted 7 lines
Quoted 2 lines

when predefined firmwares are not present (not installed or removed)

it feels like it's still user's fault even with the auto mode. why the user even set the enable_guc to -1 after known the fact that the FWs are not present? I mean should users be expected to know the fact that the auto mode enable_guc = -1 will enable the GuC and HuC, if the guc_firmware_path was left to be none?

Quoted 8 lines

GuC fw path will not be none, as we have some hardcoded paths in the code. And we don't tell the user that after turning on 'auto' mode, he has to do something special. Only later in case of fw fetch errors, we are just printing error message with extra help:

"%s: Failed to fetch firmware %s (error %d)\n"
"%s: Firmware can be downloaded from %s\n"

In this case, back to my question: maybe it's a better idea to make things stops here instead of continuing to call following functions such as uc_init, uc_init_hw -> fw_upload?

Quoted 10 lines
Quoted 8 lines

I agree we should make sure correct pointer access. it's a non-excusable fault:)

The thing actually frustrated me was that we failed to screen such an error with the CI, but suddenly it broke things and tests with incorrect configurations (enable_guc set to 1 or -1 + No FW available). so maybe we should add a case to cover such a case in CI as well if we did have such test configurations.

I guess you can write such test on your own and submit patch to igt-dev ;)

:-)

Regards,
-Jackie

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

#7 lore raw
Quoted 42 lines · Yaodong Li
Quoted 41 lines · Michal Wajdeczko
Quoted 26 lines · Yaodong Li
Quoted 4 lines · Michal Wajdeczko
Quoted 2 lines · Sagar Arun Kamble
Quoted 8 lines
Quoted 5 lines · Piotr Piórkowski
Quoted 2 lines

If GuC firmware is not available on the system and we load i915 with enable GuC, then we hit this null pointer dereference issue:

Patch looks good but I have query on usage of enable_guc modparam. enable_guc modparam will enable GuC/HuC only if firmware is available.

During modparam sanitization phase, code will only check for firmware name, code will attempt to check if firmware file exists.

Is it better if we won't even call into upload FW once we found the FW fetching was failed?

Quoted 12 lines
Quoted 2 lines

If user sets to forcefully enable GuC/HuC on systems that don't have firmware then it is user's fault.

Sure its user's fault, but event in such case we should just gracefully abort driver load, without any NULL pointer BUG ;)

And note, that we will hit this bug not only when user force GuC with:
enable_guc=1 guc_firmware_path=/does/not/exist

but also when user just specify auto mode:

    enable_guc=-1
Quoted 7 lines
Quoted 2 lines

when predefined firmwares are not present (not installed or removed)

it feels like it's still user's fault even with the auto mode. why the user even set the enable_guc to -1 after known the fact that the FWs are not present? I mean should users be expected to know the fact that the auto mode enable_guc = -1 will enable the GuC and HuC, if the guc_firmware_path was left to be none?

GuC fw path will not be none, as we have some hardcoded paths in the code. And we don't tell the user that after turning on 'auto' mode, he has to do something special. Only later in case of fw fetch errors, we are just printing error message with extra help:

Quoted 5 lines
Quoted 3 lines

"%s: Failed to fetch firmware %s (error %d)\n"
"%s: Firmware can be downloaded from %s\n"

In this case, back to my question: maybe it's a better idea to make things stops here instead of continuing to call following functions such as uc_init, uc_init_hw -> fw_upload?

We can stop at many places, but we should be still prepared for broken/ unsigned firmware, and signature will be verified during fw_upload

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

I agree we should make sure correct pointer access. it's a non-excusable fault:)

The thing actually frustrated me was that we failed to screen such an error with the CI, but suddenly it broke things and tests with incorrect configurations (enable_guc set to 1 or -1 + No FW available). so maybe we should add a case to cover such a case in CI as well if we did have such test configurations.

Quoted 5 lines
Quoted 1 line

I guess you can write such test on your own and submit patch to igt-dev ;)

:-)

Regards,
-Jackie

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

#8 lore raw

✓ Fi.CI.BAT: success for series starting with [CI,1/2] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

In reply to Piotr Piórkowski
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/2] drm/i915/guc: Fix null pointer dereference when GuC FW is not available
URL : https://patchwork.freedesktop.org/series/40559/
State : success

== Summary ==

Series 40559v1 series starting with [CI,1/2] drm/i915/guc: Fix null pointer dereference when GuC FW is not available
https://patchwork.freedesktop.org/api/1.0/series/40559/revisions/1/mbox/

---- Known issues:

Test gem_mmap_gtt:

        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:434s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:443s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:379s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:536s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:296s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:516s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:513s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:521s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:512s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:418s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:514s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:590s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:427s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:320s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:538s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:423s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:464s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:432s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:473s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:465s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:510s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:652s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:445s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:530s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:504s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:497s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:429s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:446s
fi-snb-2520m     total:242  pass:208  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:399s
Blacklisted hosts:
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-cnl-psr       total:224  pass:198  dwarn:0   dfail:0   fail:1   skip:24 

fi-glk-j4005 failed to collect. IGT log at Patchwork_8471/fi-glk-j4005/run0.log

4ff2198305421dab54e106502c38de82813eb461 drm-tip: 2018y-03m-23d-11h-56m-39s UTC integration manifest 55082cf6341f HAX: Enable GuC for CI
dc1ff4314559 drm/i915/guc: Fix null pointer dereference when GuC FW is not available

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8471/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

✗ Fi.CI.IGT: failure for series starting with [CI,1/2] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

In reply to Piotr Piórkowski
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/2] drm/i915/guc: Fix null pointer dereference when GuC FW is not available
URL : https://patchwork.freedesktop.org/series/40559/
State : failure

== Summary ==

---- Possible new issues:

Test kms_frontbuffer_tracking:

        Subgroup fbc-rgb101010-draw-render:
                pass       -> FAIL       (shard-apl)
Test perf:
        Subgroup gen8-unprivileged-single-ctx-counters:
                pass       -> FAIL       (shard-apl)
Test pm_rpm:
        Subgroup debugfs-read:
                pass       -> DMESG-WARN (shard-apl)

---- Known issues:

Test drv_missed_irq:

                pass       -> SKIP       (shard-apl) fdo#103199
Test drv_selftest:
        Subgroup live_gtt:
                pass       -> INCOMPLETE (shard-apl) fdo#103927
Test kms_cursor_legacy:
        Subgroup 2x-long-flip-vs-cursor-atomic:
                fail       -> PASS       (shard-hsw) fdo#104873
Test kms_flip:
        Subgroup 2x-flip-vs-expired-vblank:
                fail       -> PASS       (shard-hsw) fdo#102887 +1
        Subgroup 2x-plain-flip-ts-check-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368 +1
Test kms_sysfs_edid_timing:
                pass       -> WARN       (shard-apl) fdo#100047

fdo#103199 https://bugs.freedesktop.org/show_bug.cgi?id=103199
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104873 https://bugs.freedesktop.org/show_bug.cgi?id=104873
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047

shard-apl        total:3462 pass:1793 dwarn:2   dfail:0   fail:9   skip:1656 time:12866s
shard-hsw        total:3484 pass:1771 dwarn:1   dfail:0   fail:4   skip:1707 time:11635s
shard-snb        total:3484 pass:1363 dwarn:1   dfail:0   fail:3   skip:2117 time:7023s

Blacklisted hosts:
shard-kbl total:3243 pass:1771 dwarn:3 dfail:0 fail:14 skip:1450 time:8510s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8471/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx