Reply to topic  [ 4 posts ] 
yorz: sp_read and sp_write fail with SIGBUS on ia64 
Author Message
Yorick Master

Joined: Tue Mar 07, 2006 10:31 pm
Posts: 125
Location: Meudon, France
Post yorz: sp_read and sp_write fail with SIGBUS on ia64
Hi,

yorick-z's png_write and png_read break on ia64 (Debian GNU/Linux unstable ia64, libpng 1.2.49). The problem disappears if I comment out those lines in sp_read and sp_write (spng.c):
Code:
if (memops && memops->smalloc && memops->sfree) {                                                                                                                                                                                                                       
    spx_malloc = spng_malloc;                                                                                                                                                                                                                                                 
    spx_free = spng_free;                                                                                                                                                                                                                                                     
}


I wonder whether this solution is fine on the short term and how to solve the bug on the longer run.

Here comes a gdb backtrace:

Code:
(sid)thibaut@merulo:~/yorick-z-1.2.0+cvs20080115$ gdb --args yorick -batch check.i
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "ia64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/yorick...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/yorick -batch check.i


---------------------------------------checking zlib.i
OK: partial deflate flush, len=25825
OK: partial inflate flush, len=6053
OK: level 9 size=42099 (default size=42268)
OK: long type size=72323 (char type size=42268)
OK: long inflate flush, len=60328
OK: dict size=2300 (default size=3701)


---------------------------------------checking png.i

Program received signal SIGBUS, Bus error.
__sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
109   ../sysdeps/unix/sysv/linux/ia64/setjmp.S: No such file or directory.
(gdb) bt
#0  __sigsetjmp () at ../sysdeps/unix/sysv/linux/ia64/setjmp.S:109
#1  0x20000000007e67d0 in png_create_write_struct_2 () from /lib/ia64-linux-gnu/libpng12.so.0
#2  0x20000000006e8670 in sp_write (filename=0x6000000000043010 "test-gray.png", memops=0x20000000006ff9d8, info=0x60000fffff9d7260) at spng.c:432
#3  0x20000000006e44a0 in Y__png_write (nArgs=274616) at ypng.c:254
#4  0x400000000012d820 in EvalBI ()
#5  0x4000000000169f10 in Eval ()
#6  0x40000000000f3140 in YRun ()
#7  0x40000000000fb900 in DoTask ()
#8  0x40000000000fbf00 in y_on_idle ()
#9  0x400000000002cfe0 in p_on_idle ()
#10 0x400000000002c0b0 in u_waiter ()
#11 0x400000000002c3b0 in u_main_loop ()
#12 0x400000000002bab0 in main ()
(gdb) disassemble
Dump of assembler code for function __sigsetjmp:
   0x20000000003ca0a0 <+0>:   [MMI]       alloc r35=ar.pfs,9,7,0
   0x20000000003ca0a1 <+1>:               mov.m r36=ar.unat
   0x20000000003ca0a2 <+2>:               nop.i 0x0;;
   0x20000000003ca0b0 <+16>:   [MII]       mov.m r17=ar.fpsr
   0x20000000003ca0b1 <+17>:               mov r2=r32
   0x20000000003ca0b2 <+18>:               adds r3=8,r32;;
   0x20000000003ca0c0 <+32>:   [MMI]       st8.spill.nta [r2]=r12,16
   0x20000000003ca0c1 <+33>:               st8.spill.nta [r3]=r1,16
   0x20000000003ca0c2 <+34>:               nop.i 0x0;;
   0x20000000003ca0d0 <+48>:   [MMI]       st8.nta [r2]=r36,16
   0x20000000003ca0d1 <+49>:               st8.nta [r3]=r17,16
   0x20000000003ca0d2 <+50>:               adds r8=160,r32;;
   0x20000000003ca0e0 <+64>:   [MMI]       st8.spill.nta [r2]=r4,16
   0x20000000003ca0e1 <+65>:               st8.spill.nta [r3]=r5,16
   0x20000000003ca0e2 <+66>:               adds r9=176,r32;;
=> 0x20000000003ca0f0 <+80>:   [MMI]       stf.spill.nta [r8]=f2,32
   0x20000000003ca0f1 <+81>:               stf.spill.nta [r9]=f3,32
   0x20000000003ca0f2 <+82>:               mov r34=b0;;
   0x20000000003ca100 <+96>:   [MMI]       stf.spill.nta [r8]=f4,32
   0x20000000003ca101 <+97>:               stf.spill.nta [r9]=f5,32
   0x20000000003ca102 <+98>:               mov r17=b1;;
   0x20000000003ca110 <+112>:   [MMI]       stf.spill.nta [r8]=f16,32
   0x20000000003ca111 <+113>:               stf.spill.nta [r9]=f17,32
   0x20000000003ca112 <+114>:               mov r18=b2;;
   0x20000000003ca120 <+128>:   [MMI]       stf.spill.nta [r8]=f18,32
   0x20000000003ca121 <+129>:               stf.spill.nta [r9]=f19,32
   0x20000000003ca122 <+130>:               mov r19=b3;;
   0x20000000003ca130 <+144>:   [MMI]       stf.spill.nta [r8]=f20,32
   0x20000000003ca131 <+145>:               stf.spill.nta [r9]=f21,32
   0x20000000003ca132 <+146>:               mov r20=b4;;
   0x20000000003ca140 <+160>:   [MMI]       stf.spill.nta [r8]=f22,32
   0x20000000003ca141 <+161>:               stf.spill.nta [r9]=f23,32
   0x20000000003ca142 <+162>:               mov r21=b5;;
   0x20000000003ca150 <+176>:   [MMI]       stf.spill.nta [r8]=f24,32
   0x20000000003ca151 <+177>:               stf.spill.nta [r9]=f25,32
   0x20000000003ca152 <+178>:               mov.i r22=ar.lc;;
   0x20000000003ca160 <+192>:   [MMI]       stf.spill.nta [r8]=f26,32
   0x20000000003ca161 <+193>:               stf.spill.nta [r9]=f27,32
   0x20000000003ca162 <+194>:               mov r24=pr;;
   0x20000000003ca170 <+208>:   [MMI]       stf.spill.nta [r8]=f28,32
   0x20000000003ca171 <+209>:               stf.spill.nta [r9]=f29,32
   0x20000000003ca172 <+210>:               mov r37=r34;;
   0x20000000003ca180 <+224>:   [MMI]       adds r38=-16,r13;;
   0x20000000003ca181 <+225>:               ld8 r38=[r38]
   0x20000000003ca182 <+226>:               nop.i 0x0;;
   0x20000000003ca190 <+240>:   [MMI]       xor r37=r37,r38
   0x20000000003ca191 <+241>:               stf.spill.nta [r8]=f30
   0x20000000003ca192 <+242>:               nop.i 0x0
   0x20000000003ca1a0 <+256>:   [MMI]       stf.spill.nta [r9]=f31
   0x20000000003ca1a1 <+257>:               st8.spill.nta [r2]=r6,16
   0x20000000003ca1a2 <+258>:               nop.i 0x0
   0x20000000003ca1b0 <+272>:   [MMI]       st8.spill.nta [r3]=r7,16;;
   0x20000000003ca1b1 <+273>:               mov.m r23=ar.bsp
   0x20000000003ca1b2 <+274>:               nop.i 0x0
   0x20000000003ca1c0 <+288>:   [MII]       mov.m r25=ar.unat
   0x20000000003ca1c1 <+289>:               mov r39=r32
   0x20000000003ca1c2 <+290>:               nop.i 0x0
   0x20000000003ca1d0 <+304>:   [MMI]       st8.nta [r2]=r37,16
   0x20000000003ca1d1 <+305>:               st8.nta [r3]=r17,16
   0x20000000003ca1d2 <+306>:               mov r40=r33;;
   0x20000000003ca1e0 <+320>:   [MMI]       st8.nta [r2]=r18,16
   0x20000000003ca1e1 <+321>:               st8.nta [r3]=r19,16
   0x20000000003ca1e2 <+322>:               nop.i 0x0;;
   0x20000000003ca1f0 <+336>:   [MMI]       st8.nta [r2]=r20,16
   0x20000000003ca1f1 <+337>:               st8.nta [r3]=r21,16
   0x20000000003ca1f2 <+338>:               nop.i 0x0;;
   0x20000000003ca200 <+352>:   [MMI]       st8.nta [r2]=r35,16
   0x20000000003ca201 <+353>:               st8.nta [r3]=r22,16
   0x20000000003ca202 <+354>:               nop.i 0x0;;
   0x20000000003ca210 <+368>:   [MMI]       st8.nta [r2]=r24,16
   0x20000000003ca211 <+369>:               st8.nta [r3]=r23,16
   0x20000000003ca212 <+370>:               nop.i 0x0;;
   0x20000000003ca220 <+384>:   [MMB]       st8.nta [r2]=r25
   0x20000000003ca221 <+385>:               st8.nta [r3]=r32
   0x20000000003ca222 <+386>:               br.call.dpnt.few b0=0x20000000003ca280 <__sigjmp_save>
   0x20000000003ca230 <+400>:   [MII]       mov.m ar.unat=r36
   0x20000000003ca231 <+401>:               mov b0=r34
   0x20000000003ca232 <+402>:               mov.i ar.pfs=r35
---Type <return> to continue, or q <return> to quit---
End of assembler dump.
(gdb) quit
A debugging session is active.

   Inferior 1 [process 11026] will be killed.

Quit anyway? (y or n) y


Regards, Thibaut.


Mon Jun 18, 2012 5:37 am
Profile WWW
Yorick Master

Joined: Tue Mar 07, 2006 10:31 pm
Posts: 125
Location: Meudon, France
Post p_malloc returns unaligned pointers on ia64
After further investigation, it looks like p_malloc from Yorick returns 8-byte aligned pointer when they should be 16-byte aligned. I believe this is the issue discussed in this gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15087

That still leaves me with a few questions:
[*] Which package does this bug belong to? yorick-z? yorick? gcc?
[*] How to fix the problem at hand (ypng unusable on ia64)?
[*] Is there a good fix for the underlying problem?


Wed Jun 20, 2012 1:01 am
Profile WWW
Yorick Master

Joined: Tue Mar 07, 2006 10:31 pm
Posts: 125
Location: Meudon, France
Post Re: yorz: sp_read and sp_write fail with SIGBUS on ia64
Problem fixed by applying the patch below and building with
Code:
CPPFLAGS += -DMM_MIN_ALIGNMENT=16
.

Code:
Index: yorick-2.2.02+dfsg/play/any/mminit.c
===================================================================
--- yorick-2.2.02+dfsg.orig/play/any/mminit.c   2012-04-15 10:28:11.000000000 +0000
+++ yorick-2.2.02+dfsg/play/any/mminit.c   2012-06-20 13:39:55.000000000 +0000
@@ -18,6 +18,9 @@
typedef union mm_block mm_block;
typedef struct mm_arena mm_arena;

+#ifndef MM_MIN_ALIGNMENT
+# define MM_MIN_ALIGNMENT 1
+#endif
union mm_block {
   mm_block *next_free;  /* when not in use */
   mm_arena *arena;      /* when in use */
@@ -25,6 +28,7 @@
   long l;
   double d;   /* long double tickles bug for linux gcc 2.7.2 */
   void (*f)(void);
+  char c[MM_MIN_ALIGNMENT];
};

#ifndef P_DEBUG




Wed Jun 20, 2012 6:44 am
Profile WWW
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: yorz: sp_read and sp_write fail with SIGBUS on ia64
I have to think about this some more. I'd prefer a solution that only changed yorick-z/spng.c to the modification to yorick itself. The temptation to let this moribund platform die is overwhelming; I may well decide to simply let your Debian patch stand as the final solution for whatever short time we need to support IA64 architecture. Thank you very much for tracking this down.

Does anyone need to build yorick on an IA64 machine, other than for the Debian archives?


Sun Jul 08, 2012 1:57 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.