Kernel Halt with framebuffer enabled: omap_mbox_get()

2011-09-15 Thread Stuart Brown
Hi,

We're doing some development with the TI8168 EVM and have followed the 
instructions on the TI wiki for enabling the /dev framebuffer. When we do this 
we end up with a kernel halt during boot (see below for example).

Doing some investigation it looks like the for loop in mach-omap2/mailbox.c: 
omap_mbox_get() might be wrong:

  for(mbox = *mboxes; mbox; mbox++)

It looks like this increments the omap_mbox structure rather than the array? 
Should the loop actually be something like

   for(mbox = *mboxes;  (mbox != NULL); mbox = *mboxes++)

I'm hesitant to query this as it looks like this change has been in the kernel 
for about a year, so perhaps I'm missing something? 

Stuart

 Kernel Halt

IR RC5 (streamzap) protocol handler initialized
IR LIRC bridge handler initialized
Linux video capture interface: v2.00
OMAP Watchdog Timer Rev 0x00: initial timeout 60 sec
Unable to handle kernel NULL pointer dereference at virtual address 0002
pgd = c0004000
[0002] *pgd=
Internal error: Oops: 5 [#1]
last sysfs file:
Modules linked in:
CPU: 0    Not tainted  (2.6.37 #2)
PC is at strcmp+0xc/0x3c
LR is at omap_mbox_get+0x50/0x1f8
pc : [c0145d70]    lr : [c004d704]    psr: 8013
sp : c2c25f10  ip : c2c25f20  fp : c2c25f1c
r10:   r9 :   r8 : 
r7 : c0322314  r6 : c03a7938  r5 : c03ac6c4  r4 : c0385b8c/mbo/
r3 : 0064  r2 : 0076  r1 : c0322314  r0 : 0002
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 80004019  DAC: 0017
Process swapper (pid: 1, stack limit = 0xc2c242e8)
Stack: (0xc2c25f10 to 0xc2c26000)
Stack: (0xc2c25f10 to 0xc2c26000)
5f00: c2c25f44 c2c25f20 c004d704 c0145d70
5f20: c021d3cc c0145d70 c03a78dc c03a7810 c03a78d8 c001e1ac c2c25f6c c2c25f48
5f40: c022133c c004d6c0   c03ac0c0 c2c24000 c03ac0c0 c0056c28
5f60: c2c25f94 c2c25f70 c001e1e8 c0221148  c2c24000 c03ac0c0 c0056c28
5f80: c001e1ac  c2c25fdc c2c25f98 c002b44c c001e1b8 c2c25fbc 30342980
5fa0: 0036  c2c25fc4 0197 c0391998 c0021e34 c0021e84 c0056c28
5fc0: 0013    c2c25ff4 c2c25fe0 c0008998 c002b324
5fe0:  c00088f8  c2c25ff8 c0056c28 c0008904 33c53c6c 33d53cec
Backtrace:
[c0145d64] (strcmp+0x0/0x3c) from [c004d704] (omap_mbox_get+0x50/0x1f8)
[c004d6b4] (omap_mbox_get+0x0/0x1f8) from [c022133c] 
(notify_shm_drv_setup+0x200/0x28c)
r7:c001e1ac r6:c03a78d8 r5:c03a7810 r4:c03a78dc
[c022113c] (notify_shm_drv_setup+0x0/0x28c) from [c001e1e8] 
(notify_init+0x3c/0x2c8)
r6:c0056c28 r5:c03ac0c0 r4:c2c24000
[c001e1ac] (notify_init+0x0/0x2c8) from [c002b44c] 
(do_one_initcall+0x134/0x19c)
r8: r7:c001e1ac r6:c0056c28 r5:c03ac0c0 r4:c2c24000
r3:
[c002b318] (do_one_initcall+0x0/0x19c) from [c0008998] 
(kernel_init+0xa0/0x14c)
[c00088f8] (kernel_init+0x0/0x14c) from [c0056c28] (do_exit+0x0/0x644)
r5:c00088f8 r4:
Code: e89da800 e1a0c00d e92dd800 e24cb004 (e4d03001)


end


Plexus Corp. 
Registered address: Pinnacle Hill, Kelso, Roxburghshire, TD5 8XX. 
Registered in Scotland: number SC146948.

This email transmission is confidential and intended solely for the person or 
organisation to whom it is addressed. If you are not the intended recipient, 
you must not copy, distribute or disseminate the information, or take any 
action in reliance of it. Any views expressed in this message are those of the 
individual sender, except where the sender specifically states them to be the 
views of Plexus Corp. If you have received this message in error, do not open 
any attachment but please notify the sender (above) deleting this message from 
your system. Please rely on your own virus check no responsibility is taken by 
the sender for any damage rising out of any bug or virus infection.

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel Halt with framebuffer enabled: omap_mbox_get()

2011-09-15 Thread Ohad Ben-Cohen
Hi Stuart,

On Thu, Sep 15, 2011 at 3:22 PM, Stuart Brown stuart.br...@plexus.com wrote:
 Doing some investigation it looks like the for loop in mach-omap2/mailbox.c: 
 omap_mbox_get() might be wrong:

      for(mbox = *mboxes; mbox; mbox++)
...
 I'm hesitant to query this as it looks like this change has been in the 
 kernel for about a year, so perhaps I'm missing something?

You're probably missing the following patch from Kevin:

commit c03773206bf2249a890c4d420ed32ef500630095
Author: Kevin Hilman khil...@ti.com
Date:   Fri Feb 11 19:56:43 2011 +

OMAP2+: mailbox: fix lookups for multiple mailboxes

The pointer math in omap_mbox_get() is not quite right, and leads to
passing NULL to strcmp() when searching for an mbox that is not first
in the list.

Convert to using array indexing as is done in all the other functions
which walk the mbox list.

Tested on OMAP2420/n810, OMAP3630/zoom3, OMAP4430/Blaze

Signed-off-by: Kevin Hilman khil...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 459b319..49d3208 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox)

 struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
 {
-   struct omap_mbox *mbox;
-   int ret;
+   struct omap_mbox *_mbox, *mbox = NULL;
+   int i, ret;

if (!mboxes)
return ERR_PTR(-EINVAL);

-   for (mbox = *mboxes; mbox; mbox++)
-   if (!strcmp(mbox-name, name))
+   for (i = 0; (_mbox = mboxes[i]); i++) {
+   if (!strcmp(_mbox-name, name)) {
+   mbox = _mbox;
break;
+   }
+   }

if (!mbox)
return ERR_PTR(-ENOENT);
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Kernel Halt with framebuffer enabled: omap_mbox_get()

2011-09-15 Thread Stuart Brown
Thanks Ohad,

It looks like this patch is missing from the arago-project linux-omap3 code 
base.

We've been using the most recent release - T1816XPSP_04.00.00.12.

What would the procedure be to get this patch applied to the arago-project? 

Stuart

-Original Message-
From: Ohad Ben-Cohen [mailto:o...@wizery.com] 
Sent: 15 September 2011 14:12
To: Stuart Brown
Cc: linux-omap@vger.kernel.org; Brian Murray
Subject: Re: Kernel Halt with framebuffer enabled: omap_mbox_get()

Hi Stuart,

On Thu, Sep 15, 2011 at 3:22 PM, Stuart Brown stuart.br...@plexus.com wrote:
 Doing some investigation it looks like the for loop in mach-omap2/mailbox.c: 
 omap_mbox_get() might be wrong:

      for(mbox = *mboxes; mbox; mbox++)
...
 I'm hesitant to query this as it looks like this change has been in the 
 kernel for about a year, so perhaps I'm missing something?

You're probably missing the following patch from Kevin:

commit c03773206bf2249a890c4d420ed32ef500630095
Author: Kevin Hilman khil...@ti.com
Date:   Fri Feb 11 19:56:43 2011 +

OMAP2+: mailbox: fix lookups for multiple mailboxes

The pointer math in omap_mbox_get() is not quite right, and leads to
passing NULL to strcmp() when searching for an mbox that is not first
in the list.

Convert to using array indexing as is done in all the other functions
which walk the mbox list.

Tested on OMAP2420/n810, OMAP3630/zoom3, OMAP4430/Blaze

Signed-off-by: Kevin Hilman khil...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 459b319..49d3208 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox)

 struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
 {
-   struct omap_mbox *mbox;
-   int ret;
+   struct omap_mbox *_mbox, *mbox = NULL;
+   int i, ret;

if (!mboxes)
return ERR_PTR(-EINVAL);

-   for (mbox = *mboxes; mbox; mbox++)
-   if (!strcmp(mbox-name, name))
+   for (i = 0; (_mbox = mboxes[i]); i++) {
+   if (!strcmp(_mbox-name, name)) {
+   mbox = _mbox;
break;
+   }
+   }

if (!mbox)
return ERR_PTR(-ENOENT);


Plexus Corp. 
Registered address: Pinnacle Hill, Kelso, Roxburghshire, TD5 8XX. 
Registered in Scotland: number SC146948.

This email transmission is confidential and intended solely for the person or 
organisation to whom it is addressed. If you are not the intended recipient, 
you must not copy, distribute or disseminate the information, or take any 
action in reliance of it. Any views expressed in this message are those of the 
individual sender, except where the sender specifically states them to be the 
views of Plexus Corp. If you have received this message in error, do not open 
any attachment but please notify the sender (above) deleting this message from 
your system. Please rely on your own virus check no responsibility is taken by 
the sender for any damage rising out of any bug or virus infection.

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Kernel Halt with framebuffer enabled: omap_mbox_get()

2011-09-15 Thread Ohad Ben-Cohen
On Thu, Sep 15, 2011 at 4:40 PM, Stuart Brown stuart.br...@plexus.com wrote:
 What would the procedure be to get this patch applied to the arago-project?

I have a feeling that asking Sanjeev will help ;)
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html