Skip to contentSkip to conversation

Do_ade

DISCUSSION hermit 3 participants 5 messages Dec 21, 2009 – Dec 23, 2009 MIPS

lore
Share & tools
lore

hermit

author
#0 lore raw

We are trying to run WEBkit on MIPS 24ke system.
we found a lot of "do_ade" print. but system doesn't crash. because of do_ade print, the system performance seems poor. I wonder if there is any compile flag can remove do_ade warning? Thanks!

Signature · 2 lines
View this message in context: http://old.nabble.com/Do_ade-tp26871250p26871250.html
Sent from the linux-mips main mailing list archive at Nabble.com.
#1 lore raw
Quoted 11 lines · hermit

We are trying to run WEBkit on MIPS 24ke system.
we found a lot of "do_ade" print. but system doesn't crash. because of do_ade print, the system performance seems poor. I wonder if there is any compile flag can remove do_ade warning? Thanks!

Signature · 2 lines
View this message in context: http://old.nabble.com/Do_ade-tp26871250p26871250.html
Sent from the linux-mips main mailing list archive at Nabble.com.

If you get messages from do_ade(), it means that your application is accessing data that is not aligned on a boundary that is a multiple of the size of the data. Accessing such unaligned data causes an exception that one would typically expect to kill your process. Fortunately, or unfortunately, depending on your view, the code that handles this exception can be configured to do one of three things:

o Send a SIGBUS signal to your process, which generally kills it
o Print a message and then emulate the unaligned load or store
o Silently emulate the unaligned load or store

It sounds like your system is configured for the print and emulate option. The emulation is quite a bit slower than a simple aligned load or store, so I am not surprised you are seeing noticable performance impact. The warning may be impacting your performance as it is printed sychronously, but even if you silence the warning, your performance will suffer.

There are various ways that you can get unaligned accesses. One is to have code that does bad pointer arithmetic. Another possiblity, one that I encountered recently, is to have a bad gcc. IIRC gcc 4.1.0 had this problem. Upgrading the version of gcc caused the problem to go away, but it wasn't really clear what bug fix did the job. Anyway, I know that verson 4.3.2 works as you would expect.

I strongly recommend, if you have an older gcc, that you upgrade. An instruction emulated through exception handling can easily be a hundred times slower than that instruction operating on aligned data. If, however, you really only want to quiet the warning, you must first mount the debugfs
filesystem: "mount -t debugfs debug /proc/sys/debug". Then write a zero to /proc/sys/debug/mips/unaligned_action, i.e.
echo 0 >/proc/sys/debug/mips/unaligned_action.

Signature · 1 line
David VL
author
#2 lore raw

David
Thanks!
My GCC version is 4.2.3. it seems that it is not too old. I believe
there is bad pointer arithmetic.
Here is the do_ade print:
do_ade, 542 address error exception occurs! MediaPlayerServ(pid:839)
(a0 == 7edff5b6 a1 == 302daaca a2 == 00000002 a3 == 302daaca) (gp == 302e2730 sp == 7edff578 t9 == 2afb4640)
(epc == 302c3250, ra == 302c3388)
Suppose we can find which function cause "bad pointer arithmetic". I am new to MIPS, anybody can tell me how i can find the function? Thanks!
BGs/Hermit

Quoted 56 lines · David VomLehn (dvomlehn)
Quoted 12 lines · hermit

We are trying to run WEBkit on MIPS 24ke system.
we found a lot of "do_ade" print. but system doesn't crash. because of do_ade print, the system performance seems poor. I wonder if there is any compile flag can remove do_ade warning? Thanks!

Signature · 3 lines
View this message in context:
http://old.nabble.com/Do_ade-tp26871250p26871250.html
Sent from the linux-mips main mailing list archive at Nabble.com.

If you get messages from do_ade(), it means that your application is accessing data that is not aligned on a boundary that is a multiple of the size of the data. Accessing such unaligned data causes an exception that one would typically expect to kill your process. Fortunately, or unfortunately, depending on your view, the code that handles this exception
can be configured to do one of three things:

o Send a SIGBUS signal to your process, which generally kills it
o Print a message and then emulate the unaligned load or store
o Silently emulate the unaligned load or store

It sounds like your system is configured for the print and emulate option. The emulation is quite a bit slower than a simple aligned load or store, so I am not surprised you are seeing noticable performance impact. The warning
may be impacting your performance as it is printed sychronously, but even if you silence the warning, your performance will suffer.

There are various ways that you can get unaligned accesses. One is to have code that does bad pointer arithmetic. Another possiblity, one that I encountered recently, is to have a bad gcc. IIRC gcc 4.1.0 had this problem.
Upgrading the version of gcc caused the problem to go away, but it wasn't really clear what bug fix did the job. Anyway, I know that verson 4.3.2 works as you would expect.

I strongly recommend, if you have an older gcc, that you upgrade. An instruction emulated through exception handling can easily be a hundred times
slower than that instruction operating on aligned data. If, however, you really only want to quiet the warning, you must first mount the debugfs
filesystem: "mount -t debugfs debug /proc/sys/debug". Then write a zero to /proc/sys/debug/mips/unaligned_action, i.e.
echo 0 >/proc/sys/debug/mips/unaligned_action.

Signature · 1 line
David VL
Signature · 2 lines
View this message in context: http://old.nabble.com/Do_ade-tp26871250p26897656.html
Sent from the linux-mips main mailing list archive at Nabble.com.
#3 lore raw
Quoted 10 lines · hermit

My GCC version is 4.2.3. it seems that it is not too old. I believe
there is bad pointer arithmetic.
Here is the do_ade print:
do_ade, 542 address error exception occurs! MediaPlayerServ(pid:839)
(a0 == 7edff5b6 a1 == 302daaca a2 == 00000002 a3 == 302daaca) (gp == 302e2730 sp == 7edff578 t9 == 2afb4640)
(epc == 302c3250, ra == 302c3388)
Suppose we can find which function cause "bad pointer arithmetic". I am new to MIPS, anybody can tell me how i can find the function? Thanks!

This is not the normal kernel printout. It would seem that somebody who didn't know about the existence of the logging code added this code. The number 542 presumably is a line number and do_ade is in arch/mips/kernel/unaligned.c. So look around line 542 in that file.

Ralf

#4 lore raw
Quoted 13 lines · Ralf Baechle
Quoted 10 lines · hermit

My GCC version is 4.2.3. it seems that it is not too old. I believe
there is bad pointer arithmetic.
Here is the do_ade print:
do_ade, 542 address error exception occurs! MediaPlayerServ(pid:839)
(a0 == 7edff5b6 a1 == 302daaca a2 == 00000002 a3 == 302daaca) (gp == 302e2730 sp == 7edff578 t9 == 2afb4640)
(epc == 302c3250, ra == 302c3388)
Suppose we can find which function cause "bad pointer arithmetic". I am new to MIPS, anybody can tell me how i can find the function? Thanks!

Quoted 4 lines

This is not the normal kernel printout. It would seem that somebody who didn't know about the existence of the logging code added this code. The number 542 presumably is a line number and do_ade is in arch/mips/kernel/unaligned.c. So look around line 542 in that file.

If I understand hermit's problem, knowing the line in unaligned.c won't help much since the problem appears to be in the application MediaPayerServ. My suggestion is to use addr2line on the location where the exception occurred, which is the EPC value 302c3250. The addr2line utility can be used on the unstripped version of the userspace executable to determine the function, file, and line number where the unaligned access was made.

Quoted 1 line

Ralf

Signature · 1 line
David VL