Re: linux 3.9-rc1: nouveau crash on PPC

2013-03-13 Thread Aaro Koskinen
Hi,

On Sat, Mar 09, 2013 at 08:44:31PM +0200, Aaro Koskinen wrote:
> There's nouveau crash during boot with 3.9-rc1 on iMac G5 (nVidia GeForce
> FX 5200 Ultra). This happens also with current mainline kernel HEAD
> (0aefda3e8188ad71168bd32152d41b3d72f04087).
> 
> git bisect tells the first bad commit is
> 1d7c71a3e2f77336df536855b0efd2dc5bdeb41b (drm/nouveau/disp: port vblank
> handling to event interface).
> 
> The crash is (manually copied from screen):
> 
> [...]
> 
> Unable to handle kernel paging request for data at address 0x1
> 
> call trace:
> nouveau_event_trigger

The cause is event handling linked lists getting corrupted.

I'm not sure how that code is intented to work, but with the below HACK
I can at least boot the iMac without crashing, and get a working display:

diff --git a/drivers/gpu/drm/nouveau/core/core/event.c 
b/drivers/gpu/drm/nouveau/core/core/event.c
index 6d01e0f..ab8d6c7 100644
--- a/drivers/gpu/drm/nouveau/core/core/event.c
+++ b/drivers/gpu/drm/nouveau/core/core/event.c
@@ -29,7 +29,7 @@ nouveau_event_put_locked(struct nouveau_event *event, int 
index,
 {
if (!--event->index[index].refs)
event->disable(event, index);
-   list_del(>head);
+   list_del(>heads[index]);
 }
 
 void
@@ -39,7 +39,7 @@ nouveau_event_put(struct nouveau_event *event, int index,
unsigned long flags;
 
spin_lock_irqsave(>lock, flags);
-   if (index < event->index_nr)
+   if (index < ARRAY_SIZE(handler->heads) && index < event->index_nr)
nouveau_event_put_locked(event, index, handler);
spin_unlock_irqrestore(>lock, flags);
 }
@@ -51,8 +51,8 @@ nouveau_event_get(struct nouveau_event *event, int index,
unsigned long flags;
 
spin_lock_irqsave(>lock, flags);
-   if (index < event->index_nr) {
-   list_add(>head, >index[index].list);
+   if (index < ARRAY_SIZE(handler->heads) && index < event->index_nr) {
+   list_add(>heads[index], >index[index].list);
if (!event->index[index].refs++)
event->enable(event, index);
}
@@ -69,7 +69,7 @@ nouveau_event_trigger(struct nouveau_event *event, int index)
return;
 
spin_lock_irqsave(>lock, flags);
-   list_for_each_entry_safe(handler, temp, >index[index].list, 
head) {
+   list_for_each_entry_safe(handler, temp, >index[index].list, 
heads[index]) {
if (handler->func(handler, index) == NVKM_EVENT_DROP) {
nouveau_event_put_locked(event, index, handler);
}
diff --git a/drivers/gpu/drm/nouveau/core/include/core/event.h 
b/drivers/gpu/drm/nouveau/core/include/core/event.h
index 9e09440..ba52172 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/event.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/event.h
@@ -6,7 +6,7 @@
 #define NVKM_EVENT_KEEP 1
 
 struct nouveau_eventh {
-   struct list_head head;
+   struct list_head heads[2];
int (*func)(struct nouveau_eventh *, int index);
 };
 
A.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux 3.9-rc1: nouveau crash on PPC

2013-03-13 Thread Aaro Koskinen
Hi,

On Sat, Mar 09, 2013 at 08:44:31PM +0200, Aaro Koskinen wrote:
 There's nouveau crash during boot with 3.9-rc1 on iMac G5 (nVidia GeForce
 FX 5200 Ultra). This happens also with current mainline kernel HEAD
 (0aefda3e8188ad71168bd32152d41b3d72f04087).
 
 git bisect tells the first bad commit is
 1d7c71a3e2f77336df536855b0efd2dc5bdeb41b (drm/nouveau/disp: port vblank
 handling to event interface).
 
 The crash is (manually copied from screen):
 
 [...]
 
 Unable to handle kernel paging request for data at address 0x1
 
 call trace:
 nouveau_event_trigger

The cause is event handling linked lists getting corrupted.

I'm not sure how that code is intented to work, but with the below HACK
I can at least boot the iMac without crashing, and get a working display:

diff --git a/drivers/gpu/drm/nouveau/core/core/event.c 
b/drivers/gpu/drm/nouveau/core/core/event.c
index 6d01e0f..ab8d6c7 100644
--- a/drivers/gpu/drm/nouveau/core/core/event.c
+++ b/drivers/gpu/drm/nouveau/core/core/event.c
@@ -29,7 +29,7 @@ nouveau_event_put_locked(struct nouveau_event *event, int 
index,
 {
if (!--event-index[index].refs)
event-disable(event, index);
-   list_del(handler-head);
+   list_del(handler-heads[index]);
 }
 
 void
@@ -39,7 +39,7 @@ nouveau_event_put(struct nouveau_event *event, int index,
unsigned long flags;
 
spin_lock_irqsave(event-lock, flags);
-   if (index  event-index_nr)
+   if (index  ARRAY_SIZE(handler-heads)  index  event-index_nr)
nouveau_event_put_locked(event, index, handler);
spin_unlock_irqrestore(event-lock, flags);
 }
@@ -51,8 +51,8 @@ nouveau_event_get(struct nouveau_event *event, int index,
unsigned long flags;
 
spin_lock_irqsave(event-lock, flags);
-   if (index  event-index_nr) {
-   list_add(handler-head, event-index[index].list);
+   if (index  ARRAY_SIZE(handler-heads)  index  event-index_nr) {
+   list_add(handler-heads[index], event-index[index].list);
if (!event-index[index].refs++)
event-enable(event, index);
}
@@ -69,7 +69,7 @@ nouveau_event_trigger(struct nouveau_event *event, int index)
return;
 
spin_lock_irqsave(event-lock, flags);
-   list_for_each_entry_safe(handler, temp, event-index[index].list, 
head) {
+   list_for_each_entry_safe(handler, temp, event-index[index].list, 
heads[index]) {
if (handler-func(handler, index) == NVKM_EVENT_DROP) {
nouveau_event_put_locked(event, index, handler);
}
diff --git a/drivers/gpu/drm/nouveau/core/include/core/event.h 
b/drivers/gpu/drm/nouveau/core/include/core/event.h
index 9e09440..ba52172 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/event.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/event.h
@@ -6,7 +6,7 @@
 #define NVKM_EVENT_KEEP 1
 
 struct nouveau_eventh {
-   struct list_head head;
+   struct list_head heads[2];
int (*func)(struct nouveau_eventh *, int index);
 };
 
A.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux 3.9-rc1: nouveau crash on PPC

2013-03-09 Thread Aaro Koskinen
Hi,

There's nouveau crash during boot with 3.9-rc1 on iMac G5 (nVidia GeForce
FX 5200 Ultra). This happens also with current mainline kernel HEAD
(0aefda3e8188ad71168bd32152d41b3d72f04087).

git bisect tells the first bad commit is
1d7c71a3e2f77336df536855b0efd2dc5bdeb41b (drm/nouveau/disp: port vblank
handling to event interface).

The crash is (manually copied from screen):

[...]

Unable to handle kernel paging request for data at address 0x1

call trace:
nouveau_event_trigger
nv04_disp_intr
nouveau_mc_intr
nouveau_irq_handler

[...]

I also tried to capture it with netconsole, and got this much:

[   23.114208] nouveau  [  DEVICE][:f0:10.0] BOOT0  : 0x034900b1
[   23.114257] nouveau  [  DEVICE][:f0:10.0] Chipset: NV34 (NV34)
[   23.114266] nouveau  [  DEVICE][:f0:10.0] Family : NV30
[   23.114672] nouveau  [   VBIOS][:f0:10.0] checking OpenFirmware for 
image...
[   23.114712] nouveau  [   VBIOS][:f0:10.0] ... checksum invalid
[   23.114720] nouveau  [   VBIOS][:f0:10.0] checking PRAMIN for image...
[   23.114754] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114761] nouveau  [   VBIOS][:f0:10.0] checking PROM for image...
[   23.114845] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114853] nouveau  [   VBIOS][:f0:10.0] checking ACPI for image...
[   23.114862] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114881] nouveau  [   VBIOS][:f0:10.0] checking PCIROM for image...
[   23.114930] nouveau :f0:10.0: Invalid ROM contents
[   23.114946] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114976] nouveau  [   VBIOS][:f0:10.0] using image from OpenFirmware
[   23.114987] nouveau  [   VBIOS][:f0:10.0] BMP version 5.26
[   23.115035] nouveau  [   VBIOS][:f0:10.0] version 04.34.20.18.00
[   23.134608] nouveau W[   VBIOS][:f0:10.0] unknown i2c type 3
[   23.134637] nouveau W[   VBIOS][:f0:10.0] unknown i2c type 3
[   23.136488] nouveau W[  PTIMER][:f0:10.0] unknown input clock freq
[   23.136536] nouveau  [ PFB][:f0:10.0] RAM type: DDR1
[   23.136544] nouveau  [ PFB][:f0:10.0] RAM size: 32 MiB
[   23.136552] nouveau  [ PFB][:f0:10.0]ZCOMP: 0 tags
[   23.150773] [TTM] Zone  kernel: Available graphics memory: 744988 kiB
[   23.150800] [TTM] Initializing pool allocator
[   23.150882] nouveau  [ DRM] VRAM: 31 MiB
[   23.150890] nouveau  [ DRM] GART: 128 MiB
[   23.150927] nouveau  [ DRM] BMP version 5.38
[   23.150937] nouveau  [ DRM] DCB version 2.2
[   23.150971] nouveau  [ DRM] DCB outp 00: 01000122 0004
[   23.150981] nouveau  [ DRM] DCB outp 01: 02010200 11b088b8
[   23.150988] nouveau  [ DRM] DCB outp 02: 02010201 11b00703
[   23.151040] nouveau  [ DRM] Loading NV17 power sequencing microcode
[   23.170180] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[   23.170212] [drm] No driver support for vblank timestamp query.
[   23.170277] nouveau E[ DRM] Pixel clock comparison table not found
[   23.171010] nouveau  [ DRM] 0 available performance level(s)
[   23.171028] nouveau  [ DRM] c: core 241MHz memory 475MHz
[   23.177822] nouveau  [ DRM] MM: using M2MF for buffer copies
[   23.177917] nouveau  [ DRM] Setting dpms mode 3 on TV encoder (output 2)
[   23.285783] nouveau  [ DRM] allocated 1680x1050 fb: 0x9000, bo 
c00056d52c00
[   23.306569] nouveau E[ DRM] Pixel clock comparison table not found
[   23.317565] Console: switching to colour frame buffer device 210x65
[   23.321370] nouveau :f0:10.0: fb0: nouveaufb frame buffer device
[   23.321386] nouveau :f0:10.0: registered panic notifier
[   23.321444] [drm] Initialized nouveau 1.1.0 20120801 for :f0:10.0 on 
minor 0
[   23.329860] Unable to handle kernel paging request for data at address 
0x1
[   23.329918] Faulting instruction address: 0xd0801394
[   23.329939] Oops: Kernel access of bad area, sig: 11 [#1]
[   23.329953] PREEMPT PowerMac
[   23.329982] Modules linked in: nouveau ttm drm_kms_helper
[   23.330035] NIP: d0801394 LR: d08013a8 CTR: c00178e0
[   23.330052] REGS: cfff78b0 TRAP: 0300   Not tainted  
(3.9.0-rc1-imac-00277-g0aefda3-dirty)
[   23.330065] MSR: 90009032   CR: 2884  XER: 

[   23.330174] SOFTE: 0
[   23.330187] DAR: 0001, DSISR: 4000
[   23.330202] TASK = c0805aa0[0] 'swapper' THREAD: c0894000
GPR00: d08013a8 cfff7b30 d09272c0 c00056de5458 
GPR04:   0002  
GPR08: [   24.321933] Kernel panic - not syncing: Fatal exception in interrupt
[   24.321951] drm_kms_helper: panic occurred, switching back to text console
[   24.322013] [ cut here ]
[   24.322029] WARNING: at drivers/gpu/drm/drm_crtc.c:82
[   24.322041] Modules linked in: nouveau ttm drm_kms_helper
[   

linux 3.9-rc1: nouveau crash on PPC

2013-03-09 Thread Aaro Koskinen
Hi,

There's nouveau crash during boot with 3.9-rc1 on iMac G5 (nVidia GeForce
FX 5200 Ultra). This happens also with current mainline kernel HEAD
(0aefda3e8188ad71168bd32152d41b3d72f04087).

git bisect tells the first bad commit is
1d7c71a3e2f77336df536855b0efd2dc5bdeb41b (drm/nouveau/disp: port vblank
handling to event interface).

The crash is (manually copied from screen):

[...]

Unable to handle kernel paging request for data at address 0x1

call trace:
nouveau_event_trigger
nv04_disp_intr
nouveau_mc_intr
nouveau_irq_handler

[...]

I also tried to capture it with netconsole, and got this much:

[   23.114208] nouveau  [  DEVICE][:f0:10.0] BOOT0  : 0x034900b1
[   23.114257] nouveau  [  DEVICE][:f0:10.0] Chipset: NV34 (NV34)
[   23.114266] nouveau  [  DEVICE][:f0:10.0] Family : NV30
[   23.114672] nouveau  [   VBIOS][:f0:10.0] checking OpenFirmware for 
image...
[   23.114712] nouveau  [   VBIOS][:f0:10.0] ... checksum invalid
[   23.114720] nouveau  [   VBIOS][:f0:10.0] checking PRAMIN for image...
[   23.114754] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114761] nouveau  [   VBIOS][:f0:10.0] checking PROM for image...
[   23.114845] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114853] nouveau  [   VBIOS][:f0:10.0] checking ACPI for image...
[   23.114862] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114881] nouveau  [   VBIOS][:f0:10.0] checking PCIROM for image...
[   23.114930] nouveau :f0:10.0: Invalid ROM contents
[   23.114946] nouveau  [   VBIOS][:f0:10.0] ... signature not found
[   23.114976] nouveau  [   VBIOS][:f0:10.0] using image from OpenFirmware
[   23.114987] nouveau  [   VBIOS][:f0:10.0] BMP version 5.26
[   23.115035] nouveau  [   VBIOS][:f0:10.0] version 04.34.20.18.00
[   23.134608] nouveau W[   VBIOS][:f0:10.0] unknown i2c type 3
[   23.134637] nouveau W[   VBIOS][:f0:10.0] unknown i2c type 3
[   23.136488] nouveau W[  PTIMER][:f0:10.0] unknown input clock freq
[   23.136536] nouveau  [ PFB][:f0:10.0] RAM type: DDR1
[   23.136544] nouveau  [ PFB][:f0:10.0] RAM size: 32 MiB
[   23.136552] nouveau  [ PFB][:f0:10.0]ZCOMP: 0 tags
[   23.150773] [TTM] Zone  kernel: Available graphics memory: 744988 kiB
[   23.150800] [TTM] Initializing pool allocator
[   23.150882] nouveau  [ DRM] VRAM: 31 MiB
[   23.150890] nouveau  [ DRM] GART: 128 MiB
[   23.150927] nouveau  [ DRM] BMP version 5.38
[   23.150937] nouveau  [ DRM] DCB version 2.2
[   23.150971] nouveau  [ DRM] DCB outp 00: 01000122 0004
[   23.150981] nouveau  [ DRM] DCB outp 01: 02010200 11b088b8
[   23.150988] nouveau  [ DRM] DCB outp 02: 02010201 11b00703
[   23.151040] nouveau  [ DRM] Loading NV17 power sequencing microcode
[   23.170180] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[   23.170212] [drm] No driver support for vblank timestamp query.
[   23.170277] nouveau E[ DRM] Pixel clock comparison table not found
[   23.171010] nouveau  [ DRM] 0 available performance level(s)
[   23.171028] nouveau  [ DRM] c: core 241MHz memory 475MHz
[   23.177822] nouveau  [ DRM] MM: using M2MF for buffer copies
[   23.177917] nouveau  [ DRM] Setting dpms mode 3 on TV encoder (output 2)
[   23.285783] nouveau  [ DRM] allocated 1680x1050 fb: 0x9000, bo 
c00056d52c00
[   23.306569] nouveau E[ DRM] Pixel clock comparison table not found
[   23.317565] Console: switching to colour frame buffer device 210x65
[   23.321370] nouveau :f0:10.0: fb0: nouveaufb frame buffer device
[   23.321386] nouveau :f0:10.0: registered panic notifier
[   23.321444] [drm] Initialized nouveau 1.1.0 20120801 for :f0:10.0 on 
minor 0
[   23.329860] Unable to handle kernel paging request for data at address 
0x1
[   23.329918] Faulting instruction address: 0xd0801394
[   23.329939] Oops: Kernel access of bad area, sig: 11 [#1]
[   23.329953] PREEMPT PowerMac
[   23.329982] Modules linked in: nouveau ttm drm_kms_helper
[   23.330035] NIP: d0801394 LR: d08013a8 CTR: c00178e0
[   23.330052] REGS: cfff78b0 TRAP: 0300   Not tainted  
(3.9.0-rc1-imac-00277-g0aefda3-dirty)
[   23.330065] MSR: 90009032 SF,HV,EE,ME,IR,DR,RI  CR: 2884  XER: 

[   23.330174] SOFTE: 0
[   23.330187] DAR: 0001, DSISR: 4000
[   23.330202] TASK = c0805aa0[0] 'swapper' THREAD: c0894000
GPR00: d08013a8 cfff7b30 d09272c0 c00056de5458 
GPR04:   0002  
GPR08: [   24.321933] Kernel panic - not syncing: Fatal exception in interrupt
[   24.321951] drm_kms_helper: panic occurred, switching back to text console
[   24.322013] [ cut here ]
[   24.322029] WARNING: at drivers/gpu/drm/drm_crtc.c:82
[   24.322041] Modules linked in: nouveau ttm