Bug 252179 - test_altivec fails with SIGILL
Summary: test_altivec fails with SIGILL
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: liboil
Version: 7
Hardware: ppc64
OS: Linux
low
low
Target Milestone: ---
Assignee: Behdad Esfahbod
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: FE-ExcludeArch-ppc64, F-ExcludeArch-ppc64 F-ExcludeArch-ppc
TreeView+ depends on / blocked
 
Reported: 2007-08-14 15:09 UTC by Bastien Nocera
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version: 0.3.12-9.fc7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-08-27 21:49:36 UTC


Attachments (Terms of Use)
liboil-0.3.12-altivec-fix.patch (2.06 KB, patch)
2007-08-14 15:54 UTC, Bastien Nocera
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
FreeDesktop.org 11997 None None None Never

Description Bastien Nocera 2007-08-14 15:09:06 UTC
(Note: this bug makes gst-inspect-0.10 crash, so that totem's configure can't
detect whether required plugins are installed)

liboil-0.3.12-4.fc8.ppc64

Filed upstream at:
https://bugs.freedesktop.org/show_bug.cgi?id=11997

# gdb /usr/bin/gst-inspect-0.10 
<snip>
(gdb) run --gst-disable-registry-fork
Starting program: /usr/bin/gst-inspect-0.10 --gst-disable-registry-fork
Program received signal SIGILL, Illegal instruction.
[Switching to Thread 4398051383792 (LWP 22970)]
test_altivec (ignored=0x0) at liboilcpu.c:647
647       asm volatile ("vor v0, v0, v0\n");
(gdb) bt
#0  test_altivec (ignored=0x0) at liboilcpu.c:647
#1  0x00000400048ff400 in oil_cpu_fault_check_try (func=@0x40004960b80:
0x400048ff300 <test_altivec>, priv=0x0) at liboilcpu.c:209
#2  0x00000400048ff5b8 in _oil_cpu_init () at liboilcpu.c:655
#3  0x0000040004900670 in oil_init () at liboilfunction.c:136
#4  0x0000040005836dd4 in ?? () from
/usr/lib64/gstreamer-0.10/libgstaudioresample.so
#5  0x0000040005833b30 in ?? () from
/usr/lib64/gstreamer-0.10/libgstaudioresample.so
#6  0x00000400000956ec in .gst_plugin_get_name () from
/usr/lib64/libgstreamer-0.10.so.0
#7  0x0000040000095d6c in .gst_plugin_load_file () from
/usr/lib64/libgstreamer-0.10.so.0
#8  0x000004000009c608 in .gst_default_registry_check_feature_version () from
/usr/lib64/libgstreamer-0.10.so.0
#9  0x000004000009c8c4 in .gst_registry_scan_path () from
/usr/lib64/libgstreamer-0.10.so.0
#10 0x0000040000052024 in .gst_registry_fork_set_enabled () from
/usr/lib64/libgstreamer-0.10.so.0
#11 0x0000040000052344 in .gst_registry_fork_set_enabled () from
/usr/lib64/libgstreamer-0.10.so.0
#12 0x00000400000538ec in .gst_init () from /usr/lib64/libgstreamer-0.10.so.0
#13 0x00000400002257cc in .g_option_context_parse () from
/lib64/libglib-2.0.so.0
#14 0x0000000010005fc8 in ?? ()
#15 0x0000008015459f2c in .generic_start_main () from /lib64/libc.so.6
#16 0x000000801545a1c0 in .__libc_start_main () from /lib64/libc.so.6
#17 0x0000000000000000 in ?? ()

Comment 1 Bastien Nocera 2007-08-14 15:25:00 UTC
This problem makes totem not compile on PPC and PPC64 (see upstream bug, the
problem occurs on both arches), adding to the blocker bugs.

Comment 3 Bastien Nocera 2007-08-14 15:54:44 UTC
Created attachment 161278 [details]
liboil-0.3.12-altivec-fix.patch

For some reason, I'm not in the ACLs for it, so can't commit.

Let me know when the patch is in so I can update the reqs in
gstreamer-plugins-good and gstreamer-plugins-base and gstreamer-plugins-good

Comment 4 Bastien Nocera 2007-08-14 15:59:58 UTC
Note that this needs to go in rawhide and probably F7 (although I won't be
updating deps for F7, takes too long to go through the rebuilds/updates cycles).

Comment 5 Bastien Nocera 2007-08-14 16:19:48 UTC
Never mind, this patch is already in our version of liboil, so it's something else.

Comment 6 Matthias Saou 2007-08-14 16:24:37 UTC
Note that you seem to have committed the patch and spec file changes, though :-/

Comment 7 Bastien Nocera 2007-08-14 16:27:41 UTC
My mistake, I was so sure this would fix it... I reverted the changes already.

Comment 8 Bastien Nocera 2007-08-14 18:10:09 UTC
Here's the second part of the patch that David committed:
http://webcvs.freedesktop.org/liboil/liboil/liboil/liboilcpu.c?r1=1.42&r2=1.43&view=patch

I believe this would fix it. Matthias, do you want to do the updates, or you
want me to do them?

Comment 9 Bastien Nocera 2007-08-15 08:31:40 UTC
We're in for a fun ride, the patch doesn't compile (I tested locally first this
time ;):
https://bugs.freedesktop.org/show_bug.cgi?id=10247#c10

Comment 10 Bastien Nocera 2007-08-15 08:39:13 UTC
The fix is simple though, building in rawhide now.

Comment 11 Bastien Nocera 2007-08-16 08:44:14 UTC
And we need to remove the hand-made signal saving code as well:
http://webcvs.freedesktop.org/liboil/liboil/liboil/liboilcpu.c?r1=1.43&r2=1.44

Testing now on a pSeries machine. Hopefully will finally fix the problem.

Comment 12 Bastien Nocera 2007-08-16 09:57:06 UTC
You wish it would work by now:
https://bugs.freedesktop.org/show_bug.cgi?id=12027

Comment 13 David Woodhouse 2007-08-22 18:23:52 UTC
The problem here is nothing to do with the explicit altivec test.
The problem here is because you've told the compiler it's allowed to use altivec
in normal C code, and recently is grew smart enough to actually do so. Just #if
0 the altivec tests in oil_cpu_detect_powerpc() and see it still die...

Program received signal SIGILL, Illegal instruction.
oil_prototype_from_string (
    s=0x10032c98 "float *dest, int dstr, float *src, int sstr, int n")
    at liboilprototype.c:189
189       OilParameter param = { 0 };
(gdb) bt
#0  oil_prototype_from_string (
    s=0x10032c98 "float *dest, int dstr, float *src, int sstr, int n")
    at liboilprototype.c:189
#1  0x10002f18 in oil_test_new (klass=0x10042d58) at liboiltest.c:73
#2  0x100011a8 in oil_class_optimize (klass=0x10042d58) at liboilfunction.c:350
#3  0x28000488 in ?? ()
#4  0x100014a0 in oil_optimize_all () at liboilfunction.c:179
#5  0x100015b4 in oil_init () at liboilfunction.c:140
#6  0x10000adc in main ()
(gdb) x/i $pc
0x1002fe04 <oil_prototype_from_string+4>:       vxor    v0,v0,v0


Comment 14 David Woodhouse 2007-08-22 19:05:39 UTC
Adding -fno-tree-vectorize to CFLAGS might help but since this project
unfortunately uses autocrap instead of proper makefiles, I cannot test. I
changed ALTIVEC_CFLAGS and LIBOIL_CFLAGS in both the top-level and
liboil/Makefile but it still seems not to use what I set.

Comment 15 David Woodhouse 2007-08-22 19:51:06 UTC
Just -fno-tree-vectorize isn't sufficient. Removing -maltivec seems to work:
        $ sed -i s/-maltivec/-Wa,-maltivec/ configure

Although it might be nice to build it both ways and to link at runtime against
the version which is appropriate. Glibc manages this kind of thing... how hard
would it be for liboil?

Comment 16 Bastien Nocera 2007-08-23 10:43:02 UTC
After some changes:
sed -i 's/CFLAGS="$CFLAGS "-maltivec""/CFLAGS="$CFLAGS "-fno-tree-vectorize
-Wa,-maltivec""/' configure
sed -i 's/LIBOIL_CFLAGS -maltivec/LIBOIL_CFLAGS -fno-tree-vectorize
-Wa,-maltivec/' configure

It still crashes:

Starting program:
/home/hadess/packages/BUILD/liboil-0.3.12/examples/.libs/lt-example1 

Program received signal SIGILL, Illegal instruction.
test_altivec (ignored=0x0) at liboilcpu.c:651
651       asm volatile ("vor v0, v0, v0\n");
(gdb) continue 
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00000080154bab88 in .__libc_malloc () from /lib64/libc.so.6
(gdb) bt
#0  0x00000080154bab88 in .__libc_malloc () from /lib64/libc.so.6
#1  0x0000040000038f10 in oil_prototype_from_string (s=0x4000006ce10 "uint8_t
*d_4xn, uint8_t* s_3xn, int n") at liboilprototype.c:195
#2  0x000004000003b518 in oil_test_new (klass=0x40000087fe8) at liboiltest.c:73
#3  0x0000040000036fbc in oil_class_optimize (klass=0x40000087fe8) at
liboilfunction.c:350
#4  0x0000040000037370 in oil_optimize_all () at liboilfunction.c:181
#5  0x00000400000374f0 in oil_init () at liboilfunction.c:140
#6  0x0000000010000708 in main (argc=24, argv=0x0) at example1.c:41
(gdb) x/i $pc
0x80154bab88 <.__libc_malloc+136>:      ld      r31,0(r9)

I'm at loss.

Comment 17 Bastien Nocera 2007-08-23 11:23:36 UTC
Filed as:
http://bugs.freedesktop.org/show_bug.cgi?id=12111

I disabled PPC's altivec tests altogether, and managed to get it running. No
altivec optimisations, but no crashes either.

Testing in 0.3.12-9 now.

Comment 18 Bastien Nocera 2007-08-23 16:36:10 UTC
"Fixed" in 0.3.12-9.

https://bugs.freedesktop.org/show_bug.cgi?id=12111
and
https://bugs.freedesktop.org/show_bug.cgi?id=12027
are still there, and there's no Altivec optimisations on PPC though.

Comment 19 Fedora Update System 2007-08-27 21:49:19 UTC
liboil-0.3.12-9.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Josh Boyer 2007-08-30 12:58:48 UTC
David Woodhouse has a build for this that selectively enables Altivec on PPC
platforms that support it:

http://koji.fedoraproject.org/koji/taskinfo?taskID=141552


Note You need to log in before you can comment on or make changes to this bug.