<?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>8748</bug_id>
          
          <creation_ts>2015-12-02 04:58:57 +0000</creation_ts>
          <short_desc>qemu86-64 with corei7-64 did not support gcc optimization level 3 &apos;-O3&apos; very well</short_desc>
          <delta_ts>2016-06-17 17:05:56 +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>OE-Core</product>
          <component>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</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>2.2 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Hongxu Jia">hongxu.jia</reporter>
          <assigned_to name="Aníbal Limón">anibal.limon</assigned_to>
          <cc>anibal.limon</cc>
    
    <cc>jose.perez.carranza</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
          
          <qa_contact name="David Rodriguez">david.israelx.rodriguez.castellanos</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>56922</commentid>
    <comment_count>0</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2015-12-02 04:58:57 +0000</bug_when>
    <thetext>1. On qemux86-64, set corei7-64 to instaed of core2-64
diff --git a/meta/conf/machine/qemux86-64.conf b/meta/conf/machine/qemux86-64.conf
index 489194a..080ca79 100644
--- a/meta/conf/machine/qemux86-64.conf
+++ b/meta/conf/machine/qemux86-64.conf
@@ -8,8 +8,8 @@ PREFERRED_PROVIDER_virtual/libgles1 ?= &quot;mesa&quot;
 PREFERRED_PROVIDER_virtual/libgles2 ?= &quot;mesa&quot;
 
 require conf/machine/include/qemu.inc
-DEFAULTTUNE ?= &quot;core2-64&quot;
-require conf/machine/include/tune-core2.inc
+DEFAULTTUNE ?= &quot;corei7-64&quot;
+require conf/machine/include/tune-corei7.inc
 
 KERNEL_IMAGETYPE = &quot;bzImage&quot;

diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 3b0e54c..1543f94 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -442,7 +442,7 @@ if [ &quot;$MACHINE&quot; = &quot;qemux86-64&quot; ]; then
     if [ &quot;$KVM_ACTIVE&quot; = &quot;yes&quot; ]; then
         CPU_SUBTYPE=kvm64
     else
-        CPU_SUBTYPE=core2duo
+        CPU_SUBTYPE=Nehalem
     fi
     if [ ! -z &quot;$vga_option&quot; ]; then
         QEMU_UI_OPTIONS=&quot;$QEMU_UI_OPTIONS&quot;

2. Make use of service in meta-skeleton to do the test
diff --git a/meta-skeleton/recipes-skeleton/service/service/skeleton_test.c b/meta-skeleton/recipes-skeleton/service/service/skeleton_test.c
index 96c67ac..a338b20 100644
--- a/meta-skeleton/recipes-skeleton/service/service/skeleton_test.c
+++ b/meta-skeleton/recipes-skeleton/service/service/skeleton_test.c
@@ -1,12 +1,32 @@
-#include &lt;unistd.h&gt;
-
-/* This demo does nothing except for testing /etc/init.d/skeleton */
-
-int main(int argc, char *argv[])
-{
-       daemon(0, 0);
-       while (1) {
-               sleep(1);
-       }
-       return 0;
-}
+#include &lt;stdio.h&gt; 
+#include &lt;string.h&gt; 
+
+int main(int argc, char *argv[]) 
+{ 
+    char hex_digest[44]; 
+    char digest[20] = {0xc4, 0xf9, 0x37, 0x5f, 0x98, 
+                       0x34, 0xb4, 0xe7, 0xf0, 0xa5, 
+                       0x28, 0xcc, 0x65, 0xc0, 0x55, 
+                       0x70, 0x2b, 0xf5, 0xf2, 0x4a}; 
+    unsigned int i, j, digest_size = 20; 
+
+    /* Make hex version of the digest: correct in qemu */ 
+    memset(hex_digest, 0, sizeof(hex_digest)); 
+    for (i=0; i&lt;digest_size; i++) 
+        sprintf(hex_digest+i*2, &quot;%x&quot;, digest[i]&amp;0xFF); 
+    printf(&quot;hex_digest %s\n&quot;, hex_digest); 
+
+    /* Make hex version of the digest: incorrect in qemu */ 
+    memset(hex_digest, 0, sizeof(hex_digest)); 
+    for(i=j=0; i&lt;digest_size; i++) { 
+        char c; 
+        c = (digest[i] &gt;&gt; 4) &amp; 0xf; 
+        c = (c&gt;9) ? c+&apos;a&apos;-10 : c + &apos;0&apos;; 
+        hex_digest[j++] = c; 
+        c = (digest[i] &amp; 0xf); 
+        c = (c&gt;9) ? c+&apos;a&apos;-10 : c + &apos;0&apos;; 
+        hex_digest[j++] = c; 
+    } 
+    printf(&quot;hex_digest %s\n&quot;, hex_digest); 
+} 
+
diff --git a/meta-skeleton/recipes-skeleton/service/service_0.1.bb b/meta-skeleton/recipes-skeleton/service/service_0.1.bb
index c5cd7a9..e00f033 100644
--- a/meta-skeleton/recipes-skeleton/service/service_0.1.bb
+++ b/meta-skeleton/recipes-skeleton/service/service_0.1.bb
@@ -9,7 +9,7 @@ SRC_URI = &quot;file://skeleton \
           &quot;
 
 do_compile () {
-       ${CC} ${WORKDIR}/skeleton_test.c -o ${WORKDIR}/skeleton-test
+       ${CC} -O3 ${WORKDIR}/skeleton_test.c -o ${WORKDIR}/skeleton-test
 }
 
 do_install () {


3. $ Add service to image
In bblayers.conf
...
BBLAYERS ?= &quot; \ 
  /buildarea/raid0/hjia/poky/meta \
  /buildarea/raid0/hjia/poky/meta-yocto \
  /buildarea/raid0/hjia/poky/meta-skeleton \
  /buildarea/raid0/hjia/poky/meta-yocto-bsp \
  &quot;
...

In local.conf
...
MACHINE ?= &quot;qemux86-64&quot;
IMAGE_INSTALL_append = &quot; service&quot;
...

bitbake core-image-minimal

4. Run qemu and invoke service
runqemu qemux86-64 nographic

root@qemux86-64:~# skeleton-test 
hex_digest c4f9375f9834b4e7f0a528cc65c055702bf5f24a
hex_digest c4f9375f9834b4e7f005080c050005002bf5f24a

The two hex_digest outputs should be same, but it is not on qemux86-64 with corei7-64

//Hongxu</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56923</commentid>
    <comment_count>1</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2015-12-02 05:00:59 +0000</bug_when>
    <thetext>It is the root cause of https://bugzilla.yoctoproject.org/show_bug.cgi?id=8747</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56945</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-12-02 15:11:23 +0000</bug_when>
    <thetext>Can you (or have you) reported this to upstream?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56972</commentid>
    <comment_count>3</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2015-12-03 01:35:20 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Can you (or have you) reported this to upstream?

Got it, let me do some investigation

//Hongxu</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57003</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-12-03 15:57:34 +0000</bug_when>
    <thetext>*** Bug 8747 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57051</commentid>
    <comment_count>5</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2015-12-04 15:55:37 +0000</bug_when>
    <thetext>The latest qemu changelog adds the following info for IA and x86 and related architectures:
&quot;CPU models and features
Haswell and Broadwell CPU models now include ABM
Cache information passthrough (which was enabled by default on &quot;-cpu host&quot;) is now disabled by default
ABM, POPCNT, and SSE4a are not enabled in the default CPU models (qemu64, qemu32) anymore, as many hosts don&apos;t support it
RDTSCP was removed from AMD CPU models, as current KVM versions can&apos;t expose RDTSCP to guests in AMD hosts
New Intel memory instructions (clflushopt/clwb/pcommit) are now supported&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60608</commentid>
    <comment_count>6</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2016-03-31 15:17:42 +0000</bug_when>
    <thetext>It appears that this might be fixed in the upstream now, but will require a qemu update, this will have to wait for 2.2.  Assigning to Qemu maintainer</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62122</commentid>
    <comment_count>7</comment_count>
    <who name="Aníbal Limón">anibal.limon</who>
    <bug_when>2016-05-11 19:04:11 +0000</bug_when>
    <thetext>I tested in master with your changes [1] and it works under qemu 2.5.0.

I don&apos;t now if it is targeted to work for qemu 2.4.x or this bug could be closed?.

[1] http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=alimon/simple_patches&amp;id=b0059633ca6017ef5c3947ca84920b0a89f23cff</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62170</commentid>
    <comment_count>8</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2016-05-13 04:50:16 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; I tested in master with your changes [1] and it works under qemu 2.5.0.
&gt; 
&gt; I don&apos;t now if it is targeted to work for qemu 2.4.x or this bug could be
&gt; closed?.
&gt; 
&gt; [1]
&gt; http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=alimon/
&gt; simple_patches&amp;id=b0059633ca6017ef5c3947ca84920b0a89f23cff

I think your test is reasonable, my suggestion is to close it

//Hongxu</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62193</commentid>
    <comment_count>9</comment_count>
    <who name="Aníbal Limón">anibal.limon</who>
    <bug_when>2016-05-13 17:27:05 +0000</bug_when>
    <thetext>Closing because this issue was fixed in qemu 2.5.x.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63117</commentid>
    <comment_count>10</comment_count>
    <who name="David Rodriguez">david.israelx.rodriguez.castellanos</who>
    <bug_when>2016-06-17 17:05:56 +0000</bug_when>
    <thetext>As stated on Comment 7 this issue is already verified.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>