| Summary: | qemu86-64 with corei7-64 did not support gcc optimization level 3 '-O3' very well | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Hongxu Jia <hongxu.jia> |
| Component: | core | Assignee: | Aníbal Limón <anibal.limon> |
| Status: | VERIFIED FIXED | QA Contact: | David Rodriguez <david.israelx.rodriguez.castellanos> |
| Severity: | normal | ||
| Priority: | Medium+ | CC: | anibal.limon, jose.perez.carranza, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, richard.purdie, sgw |
| Version: | unspecified | ||
| Target Milestone: | 2.2 M1 | ||
| Hardware: | x86 | ||
| OS: | x86_64 | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
It is the root cause of https://bugzilla.yoctoproject.org/show_bug.cgi?id=8747 Can you (or have you) reported this to upstream? (In reply to comment #2) > Can you (or have you) reported this to upstream? Got it, let me do some investigation //Hongxu *** Bug 8747 has been marked as a duplicate of this bug. *** The latest qemu changelog adds the following info for IA and x86 and related architectures: "CPU models and features Haswell and Broadwell CPU models now include ABM Cache information passthrough (which was enabled by default on "-cpu host") is now disabled by default ABM, POPCNT, and SSE4a are not enabled in the default CPU models (qemu64, qemu32) anymore, as many hosts don't support it RDTSCP was removed from AMD CPU models, as current KVM versions can't expose RDTSCP to guests in AMD hosts New Intel memory instructions (clflushopt/clwb/pcommit) are now supported" 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 I tested in master with your changes [1] and it works under qemu 2.5.0. I don'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&id=b0059633ca6017ef5c3947ca84920b0a89f23cff (In reply to comment #7) > I tested in master with your changes [1] and it works under qemu 2.5.0. > > I don'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&id=b0059633ca6017ef5c3947ca84920b0a89f23cff I think your test is reasonable, my suggestion is to close it //Hongxu Closing because this issue was fixed in qemu 2.5.x. As stated on Comment 7 this issue is already verified. |
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 ?= "mesa" PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa" require conf/machine/include/qemu.inc -DEFAULTTUNE ?= "core2-64" -require conf/machine/include/tune-core2.inc +DEFAULTTUNE ?= "corei7-64" +require conf/machine/include/tune-corei7.inc KERNEL_IMAGETYPE = "bzImage" 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 [ "$MACHINE" = "qemux86-64" ]; then if [ "$KVM_ACTIVE" = "yes" ]; then CPU_SUBTYPE=kvm64 else - CPU_SUBTYPE=core2duo + CPU_SUBTYPE=Nehalem fi if [ ! -z "$vga_option" ]; then QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" 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 <unistd.h> - -/* 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 <stdio.h> +#include <string.h> + +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<digest_size; i++) + sprintf(hex_digest+i*2, "%x", digest[i]&0xFF); + printf("hex_digest %s\n", hex_digest); + + /* Make hex version of the digest: incorrect in qemu */ + memset(hex_digest, 0, sizeof(hex_digest)); + for(i=j=0; i<digest_size; i++) { + char c; + c = (digest[i] >> 4) & 0xf; + c = (c>9) ? c+'a'-10 : c + '0'; + hex_digest[j++] = c; + c = (digest[i] & 0xf); + c = (c>9) ? c+'a'-10 : c + '0'; + hex_digest[j++] = c; + } + printf("hex_digest %s\n", 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 = "file://skeleton \ " 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 ?= " \ /buildarea/raid0/hjia/poky/meta \ /buildarea/raid0/hjia/poky/meta-yocto \ /buildarea/raid0/hjia/poky/meta-skeleton \ /buildarea/raid0/hjia/poky/meta-yocto-bsp \ " ... In local.conf ... MACHINE ?= "qemux86-64" IMAGE_INSTALL_append = " service" ... 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