Re: [Intel-gfx] [PATCH v3] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

2018-03-23 Thread Michal Wajdeczko
On Fri, 23 Mar 2018 09:49:45 +0100, Joonas Lahtinen  
 wrote:



Michal,

Can you send this with the enable_guc HAX patch to get a run in the CI
with GuC.



Piotr will send it with CI prefix very soon.

Thanks,
Michal
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

2018-03-23 Thread Joonas Lahtinen
Michal,

Can you send this with the enable_guc HAX patch to get a run in the CI
with GuC.

Regards, Joonas
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

2018-03-22 Thread Yaodong Li

On 03/22/2018 11:17 AM, Piotr Piórkowski wrote:

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 
0008
[   71.098938] IP: intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.098947] PGD 0 P4D 0
[   71.098956] Oops:  [#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:c9417aa0 EFLAGS: 00010282
[   71.099097] RAX:  RBX: 88084cad12f8 RCX: a03e9357
[   71.099108] RDX: 0002 RSI: a034dba0 RDI: 88084cad12f8
[   71.099118] RBP: 0002 R08: 88085344ca90 R09: 0001
[   71.099128] R10:  R11:  R12: 88084cad
[   71.099139] R13: a034dba0 R14: fff5 R15: 88084cad12b0
[   71.099151] FS:  7f7f24ae2740() GS:88085e20() 
knlGS:
[   71.099162] CS:  0010 DS:  ES:  CR0: 80050033
[   71.099171] CR2: 0008 CR3: 000855f48001 CR4: 003606e0
[   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]  ? 0xa04d6000
[   71.099572]  driver_register+0x57/0xc0
[   71.099582]  ? 0xa04d6000
[   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:7ffda7d67ed8 EFLAGS: 0246 ORIG_RAX: 
0139
[   71.099734] RAX: ffda RBX: 55f96e2a8870 RCX: 7f7f23fb40d9
[   71.099748] RDX:  RSI: 55f96e2a8260 RDI: 0003
[   71.099763] RBP: 55f96e2a8260 R08:  R09: 7ffda7d68088
[   71.099777] R10: 0003 R11: 0246 R12: 
[   71.099791] R13: 55f96e2a8830 R14:  R15: 55f96e2a8260
[   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.14] RIP: intel_uc_fw_upload+0x1f/0x360 [i915] RSP: c9417aa0
[   71.100020] CR2: 0008
[   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)

Signed-off-by: Piotr Piórkowski 
Reported-by: Radoslaw Szwichtenberg 
Cc: Michał Winiarski 
Cc: Michal Wajdeczko 
Cc: Sagar Arun Kamble 
Cc: Joonas Lahtinen 
Cc: Jackie Li 
Cc: Radoslaw Szwichtenberg 
---
  drivers/gpu/drm/i915/intel_uc_fw.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c 
b/drivers/gpu/drm/i915/intel_uc_fw.c
index 30c73243f54d..486eb116015b 100644
--- a/drivers/gpu/drm/i915/intel_uc_fw.c
+++ b/drivers/gpu/drm/i915/intel_uc_fw.c
@@ -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 

Re: [Intel-gfx] [PATCH v3] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

2018-03-22 Thread Michal Wajdeczko
On Thu, 22 Mar 2018 19:17:28 +0100, Piotr Piórkowski  
 wrote:


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  
0008

[   71.098938] IP: intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.098947] PGD 0 P4D 0
[   71.098956] Oops:  [#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:c9417aa0 EFLAGS: 00010282
[   71.099097] RAX:  RBX: 88084cad12f8 RCX:  
a03e9357
[   71.099108] RDX: 0002 RSI: a034dba0 RDI:  
88084cad12f8
[   71.099118] RBP: 0002 R08: 88085344ca90 R09:  
0001
[   71.099128] R10:  R11:  R12:  
88084cad
[   71.099139] R13: a034dba0 R14: fff5 R15:  
88084cad12b0
[   71.099151] FS:  7f7f24ae2740() GS:88085e20()  
knlGS:

[   71.099162] CS:  0010 DS:  ES:  CR0: 80050033
[   71.099171] CR2: 0008 CR3: 000855f48001 CR4:  
003606e0

[   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]  ? 0xa04d6000
[   71.099572]  driver_register+0x57/0xc0
[   71.099582]  ? 0xa04d6000
[   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:7ffda7d67ed8 EFLAGS: 0246 ORIG_RAX:  
0139
[   71.099734] RAX: ffda RBX: 55f96e2a8870 RCX:  
7f7f23fb40d9
[   71.099748] RDX:  RSI: 55f96e2a8260 RDI:  
0003
[   71.099763] RBP: 55f96e2a8260 R08:  R09:  
7ffda7d68088
[   71.099777] R10: 0003 R11: 0246 R12:  

[   71.099791] R13: 55f96e2a8830 R14:  R15:  
55f96e2a8260
[   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.14] RIP: intel_uc_fw_upload+0x1f/0x360 [i915] RSP:  
c9417aa0

[   71.100020] CR2: 0008
[   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)

Signed-off-by: Piotr Piórkowski 
Reported-by: Radoslaw Szwichtenberg 
Cc: Michał Winiarski 
Cc: Michal Wajdeczko 
Cc: Sagar Arun Kamble 
Cc: Joonas Lahtinen 
Cc: Jackie Li 
Cc: Radoslaw Szwichtenberg 
---
 drivers/gpu/drm/i915/intel_uc_fw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c  
b/drivers/gpu/drm/i915/intel_uc_fw.c

index 30c73243f54d..486eb116015b 100644
--- a/drivers/gpu/drm/i915/intel_uc_fw.c
+++ b/drivers/gpu/drm/i915/intel_uc_fw.c
@@ -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 

[Intel-gfx] [PATCH v3] drm/i915/guc: Fix null pointer dereference when GuC FW is not available

2018-03-22 Thread 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:

[   71.098873] BUG: unable to handle kernel NULL pointer dereference at 
0008
[   71.098938] IP: intel_uc_fw_upload+0x1f/0x360 [i915]
[   71.098947] PGD 0 P4D 0
[   71.098956] Oops:  [#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:c9417aa0 EFLAGS: 00010282
[   71.099097] RAX:  RBX: 88084cad12f8 RCX: a03e9357
[   71.099108] RDX: 0002 RSI: a034dba0 RDI: 88084cad12f8
[   71.099118] RBP: 0002 R08: 88085344ca90 R09: 0001
[   71.099128] R10:  R11:  R12: 88084cad
[   71.099139] R13: a034dba0 R14: fff5 R15: 88084cad12b0
[   71.099151] FS:  7f7f24ae2740() GS:88085e20() 
knlGS:
[   71.099162] CS:  0010 DS:  ES:  CR0: 80050033
[   71.099171] CR2: 0008 CR3: 000855f48001 CR4: 003606e0
[   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]  ? 0xa04d6000
[   71.099572]  driver_register+0x57/0xc0
[   71.099582]  ? 0xa04d6000
[   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:7ffda7d67ed8 EFLAGS: 0246 ORIG_RAX: 
0139
[   71.099734] RAX: ffda RBX: 55f96e2a8870 RCX: 7f7f23fb40d9
[   71.099748] RDX:  RSI: 55f96e2a8260 RDI: 0003
[   71.099763] RBP: 55f96e2a8260 R08:  R09: 7ffda7d68088
[   71.099777] R10: 0003 R11: 0246 R12: 
[   71.099791] R13: 55f96e2a8830 R14:  R15: 55f96e2a8260
[   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.14] RIP: intel_uc_fw_upload+0x1f/0x360 [i915] RSP: c9417aa0
[   71.100020] CR2: 0008
[   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)

Signed-off-by: Piotr Piórkowski 
Reported-by: Radoslaw Szwichtenberg 
Cc: Michał Winiarski 
Cc: Michal Wajdeczko 
Cc: Sagar Arun Kamble 
Cc: Joonas Lahtinen 
Cc: Jackie Li 
Cc: Radoslaw Szwichtenberg 
---
 drivers/gpu/drm/i915/intel_uc_fw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c 
b/drivers/gpu/drm/i915/intel_uc_fw.c
index 30c73243f54d..486eb116015b 100644
--- a/drivers/gpu/drm/i915/intel_uc_fw.c
+++ b/drivers/gpu/drm/i915/intel_uc_fw.c
@@ -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