<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>347</bug_id>
          
          <creation_ts>2010-09-21 00:51:35 +0000</creation_ts>
          <short_desc>[QT] libQtGui.so on qemux86-64 uses SSSE3 instructions and crashes Qemu</short_desc>
          <delta_ts>2010-12-21 06:07:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>0.9</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>0.9 M4</target_milestone>
          
          <blocked>280</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Qing He">qing.he</reporter>
          <assigned_to name="Qing He">qing.he</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>jiajun.xu</cc>
    
    <cc>ke.yu</cc>
    
    <cc>kevin.tian</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          <cf_verified>Program Management</cf_verified>
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9927</commentid>
    <comment_count>0</comment_count>
    <who name="Qing He">qing.he</who>
    <bug_when>2010-09-21 00:51:35 +0000</bug_when>
    <thetext>See also bug 280, it is observed in fotowall loading

######
root@qemux86-64:~# DISPLAY=:0.0 fotowall
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for
BOM: Bad file descriptor
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open
failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
Illegal instruction
######

And dmesg shows
######
fotowall[842] trap invalid opcode ip:7f92361fc1ed sp:7ffff191b798 error:0 in
libQtGui.so.4.6.3[7f9236067000+9d0000]
######


The offending function is qt_blend_argb32_on_argb3_sse2(), it calls intrinsic _mm_set_epi16, and it compiles to PSHUFB, which is only available in SSSE3.

Qemu needs to run with -cpu qemux86-64,+ssse3 explicitly, or it crashes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9948</commentid>
    <comment_count>1</comment_count>
    <who name="Qing He">qing.he</who>
    <bug_when>2010-09-25 20:23:29 +0000</bug_when>
    <thetext>mark this bug at Intel confidential

QtGui has an internal cpu dispatcher, so ideally gdrawhelper_sse2 shouldn&apos;t include ssse3 instructions, it uses -msse2 as gcc flags. PSHUFB is actually generated by the use of -march=core2 in gcc-4.5, reproducing it is simple

---
$ cat a.c
#include &lt;emmintrin.h&gt;
__m128i f(int a)
{
    return _mm_set1_epi16(a);
}

$ gcc-4.5 -O2 -m64 -march=core2 -c a.c
$ objdump -d a.o
0000000000000000 &lt;f&gt;:
   0:   66 0f 6e c7             movd   %edi,%xmm0
   4:   66 0f 38 00 05 00 00    pshufb 0x0(%rip),%xmm0   # d &lt;f+0xd&gt;
   b:   00 00
   d:   c3                      retq
---

it can be fixed in at least two ways:
  1. not using -march=core2 for generic machine like qemux86-64
  2. adding &quot;-cpu qemu64,+ssse3&quot; or &quot;-cpu core2duo&quot; into qemu command line

#2 is easier, but it may leads to controversy like:
  http://mer-l-in.blogspot.com/2010/08/are-intel-subverting-meegocom.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9966</commentid>
    <comment_count>2</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2010-09-27 11:22:45 +0000</bug_when>
    <thetext>http://git.pokylinux.org/cgit/cgit.cgi/poky/commit/?id=59646974abd58812f3b37e62224bd41e71bedfbc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10735</commentid>
    <comment_count>3</comment_count>
    <who name="Qing He">qing.he</who>
    <bug_when>2010-10-21 01:01:37 +0000</bug_when>
    <thetext>after removing the optimization flag, the crash doesn&apos;t happen anymore</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>10737</commentid>
    <comment_count>4</comment_count>
    <who name="Qing He">qing.he</who>
    <bug_when>2010-10-21 01:01:57 +0000</bug_when>
    <thetext>marked as verified</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>