<?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>14248</bug_id>
          
          <creation_ts>2021-02-23 12:33:33 +0000</creation_ts>
          <short_desc>Can&apos;t enable qemu-usermode for intel-skylake-64 target</short_desc>
          <delta_ts>2023-09-07 14:56:35 +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>BSPs</product>
          <component>bsps-meta-intel</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>OBSOLETE</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>0.0.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Colin Finck">c.finck</reporter>
          <assigned_to name="Naveen Saini">naveen.kumar.saini</assigned_to>
          <cc>aehs29</cc>
    
    <cc>alejandro</cc>
    
    <cc>c.finck</cc>
    
    <cc>naveen.kumar.saini</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <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>89349</commentid>
    <comment_count>0</comment_count>
    <who name="Colin Finck">c.finck</who>
    <bug_when>2021-02-23 12:33:33 +0000</bug_when>
    <thetext>Using the meta-intel layer and the &quot;intel-skylake-64&quot; machine, tune-skylake.inc is included.
This file comes with a line

    MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;

while at the same time checking if MACHINE_FEATURES contains &quot;qemu-usermode&quot;
(https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/conf/machine/include/tune-skylake.inc#n28).

How can this condition ever be fulfilled?
According to Paul Eggleton, another Intel employee, MACHINE_FEATURES_remove &quot;removes the value no matter how it comes in&quot; and &quot;_remove should be used sparingly and really ought to be used only where it&apos;s very unlikely that anyone would want to override it&quot; (https://www.openembedded.org/pipermail/bitbake-devel/2015-September/006419.html).

I currently cannot build any image using &quot;intel-skylake-64&quot;, as I&apos;m using a read-only filesystem and base packages like systemd already pull in glib and udev-hwdb, which require qemu-usermode to build an image with read-only filesystem.

If there is no specific reason for having this line, please remove it and let the user decide if qemu-usermode shall be included or not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89382</commentid>
    <comment_count>1</comment_count>
    <who name="Alejandro">alejandro</who>
    <bug_when>2021-02-25 01:57:26 +0000</bug_when>
    <thetext>Hey Colin,

Took me a bit to figure out how that was working.


(In reply to comment #0)
&gt; Using the meta-intel layer and the &quot;intel-skylake-64&quot; machine,
&gt; tune-skylake.inc is included.
&gt; This file comes with a line
&gt; 
&gt;     MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;
&gt; 
&gt; while at the same time checking if MACHINE_FEATURES contains &quot;qemu-usermode&quot;
&gt; (https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/conf/machine/
&gt; include/tune-skylake.inc#n28).

I believe QEMU still hasn&apos;t gotten AVX2 support (fact check me on this, haven;t checked in a while), which means that if qemu-usermode isn&apos;t removed it will start breaking things for others

&gt; 
&gt; How can this condition ever be fulfilled?
&gt; According to Paul Eggleton, another Intel employee, MACHINE_FEATURES_remove
&gt; &quot;removes the value no matter how it comes in&quot; and &quot;_remove should be used
&gt; sparingly and really ought to be used only where it&apos;s very unlikely that
&gt; anyone would want to override it&quot;
&gt; (https://www.openembedded.org/pipermail/bitbake-devel/2015-September/006419.
&gt; html).
&gt; 

You&apos;re right that condition cannot easily be fulfilled, in fact Paul was right too and normally it shouldn&apos;t work, but the way I got it to work here:

https://github.com/aehs29/meta-chromebook/blob/507555aa06e89a8cd52fcce56bf255fde44dfe30/conf/machine/eve-chromebook.conf#L78

and here:
https://github.com/aehs29/meta-chromebook/blob/master/classes/qemuuser-enable-chromebook.bbclass

was to inherit a class from the conf file which would then run anon python to re-add qemu-usermode with the supported optimizations only.


&gt; I currently cannot build any image using &quot;intel-skylake-64&quot;, as I&apos;m using a
&gt; read-only filesystem and base packages like systemd already pull in glib and
&gt; udev-hwdb, which require qemu-usermode to build an image with read-only
&gt; filesystem.
&gt; 
&gt; If there is no specific reason for having this line, please remove it and
&gt; let the user decide if qemu-usermode shall be included or not.

I hope that helps.

Alejandro</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89383</commentid>
    <comment_count>2</comment_count>
    <who name="Naveen Saini">naveen.kumar.saini</who>
    <bug_when>2021-02-25 03:10:31 +0000</bug_when>
    <thetext>Hi Colin, You can try to use intel-corei7-64 machine, if -mtune=skylake is not requirement!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89385</commentid>
    <comment_count>3</comment_count>
    <who name="Colin Finck">c.finck</who>
    <bug_when>2021-02-25 09:16:07 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I believe QEMU still hasn&apos;t gotten AVX2 support (fact check me on this,
&gt; haven;t checked in a while), which means that if qemu-usermode isn&apos;t removed
&gt; it will start breaking things for others

Indeed, there is still no support for any AVX in QEMU.
However, the way I understand it, qemu-usermode is only used during build when `EXTRA_IMAGE_FEATURES += &quot;read-only-rootfs&quot;` is set. The build process then calls qemu-usermode to perform tasks that would otherwise be handled at first boot (gobject-introspection or generating the udev-hwdb).
Please correct me if this has changed in the meantime and qemu-usermode is now used in additional cases.

Apart from that, things won&apos;t &quot;break&quot; if qemu-usermode is enabled. The intel-skylake-64 target would merely be compiled with fewer optimizations.
If my theory still holds that qemu-usermode is only added for &quot;read-only-rootfs&quot;, and &quot;read-only-rootfs&quot; is not a default, things should be unchanged for most users.


&gt; You&apos;re right that condition cannot easily be fulfilled, in fact Paul was
&gt; right too and normally it shouldn&apos;t work, but the way I got it to work here:
&gt; 
&gt; https://github.com/aehs29/meta-chromebook/blob/
&gt; 507555aa06e89a8cd52fcce56bf255fde44dfe30/conf/machine/eve-chromebook.conf#L78
&gt; 
&gt; and here:
&gt; https://github.com/aehs29/meta-chromebook/blob/master/classes/qemuuser-
&gt; enable-chromebook.bbclass

Oh dear... Thank you very much for that workaround!
But is that in any way supported, without a chance of suddenly breaking in the next release? :)


(In reply to comment #2)
&gt; You can try to use intel-corei7-64 machine, if -mtune=skylake is
&gt; not requirement!

I have been using intel-corei7-64 previously, but wanted to upgrade to intel-skylake-64 now, as I&apos;m not using any machines older than Skylake.
There is more than just AVX/AVX2 to gain from an upgrade from Nehalem to Skylake (e.g. AES).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89392</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2021-02-25 15:39:43 +0000</bug_when>
    <thetext>qemu-usermode is not only used in read-only rootfs, it&apos;s *essential* for read-only-rootfs and an optimisation for read-write rootfs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89396</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-25 15:52:30 +0000</bug_when>
    <thetext>Not implemented in qemu but there is a summer of code project that Ross is aware of so who knows how long this might take.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89397</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2021-02-25 15:54:07 +0000</bug_when>
    <thetext>Found the bug# in qemu: https://bugs.launchpad.net/qemu/+bug/1818075</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89422</commentid>
    <comment_count>7</comment_count>
    <who name="Colin Finck">c.finck</who>
    <bug_when>2021-02-26 16:31:13 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; qemu-usermode is not only used in read-only rootfs, it&apos;s *essential* for
&gt; read-only-rootfs and an optimisation for read-write rootfs.

In that case, isn&apos;t there even more reason to remove the

    MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;

line?

This now sounds like it breaks &gt;50% of the cases where people could use the &quot;intel-skylake-64&quot; machine as a Yocto target.
Looking at Alejandro&apos;s workaround in https://github.com/aehs29/meta-chromebook/blob/507555aa06e89a8cd52fcce56bf255fde44dfe30/conf/machine/eve-chromebook.conf#L78, he actually had to configure a new machine and couldn&apos;t apply this on the existing &quot;intel-skylake-64&quot; target.

Right now, I must consider &quot;intel-skylake-64&quot; broken by default, with no way to add back &quot;qemu-usermode&quot;.
Those people who still want maximum optimizations after removing the line above can still add

    MACHINE_FEATURES_append = &quot;qemu-usermode&quot;

to some configuration file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89429</commentid>
    <comment_count>8</comment_count>
    <who name="Alejandro">alejandro</who>
    <bug_when>2021-02-27 00:44:57 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #4)
&gt; &gt; qemu-usermode is not only used in read-only rootfs, it&apos;s *essential* for
&gt; &gt; read-only-rootfs and an optimisation for read-write rootfs.
&gt; 
&gt; In that case, isn&apos;t there even more reason to remove the
&gt; 
&gt;     MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;
&gt; 
&gt; line?
&gt; 
&gt; This now sounds like it breaks &gt;50% of the cases where people could use the
&gt; &quot;intel-skylake-64&quot; machine as a Yocto target.
&gt; Looking at Alejandro&apos;s workaround in
&gt; https://github.com/aehs29/meta-chromebook/blob/
&gt; 507555aa06e89a8cd52fcce56bf255fde44dfe30/conf/machine/eve-chromebook.
&gt; conf#L78, he actually had to configure a new machine and couldn&apos;t apply this
&gt; on the existing &quot;intel-skylake-64&quot; target.
&gt; 
&gt; Right now, I must consider &quot;intel-skylake-64&quot; broken by default, with no way
&gt; to add back &quot;qemu-usermode&quot;.
&gt; Those people who still want maximum optimizations after removing the line
&gt; above can still add
&gt; 
&gt;     MACHINE_FEATURES_append = &quot;qemu-usermode&quot;
&gt; 
&gt; to some configuration file.

Its not my decision to make, but I disagree, I believe intel-skylake-64 should take advantage of as many optimizations/instructions as possible by default, I&apos;d love for us to support it fully for all components but sadly we depend on an external bug, so IMO the skylake tune should still remove qemu-usermode.

I was going to create another machine regardless, IMO the provided machines should be used as reference, if you tweak the metadata a bit I&apos;m sure you&apos;ll be able to inherit that class and keep the skylake machine conf vanilla if that&apos;s what you want.

That last statement is a bit confusing, you seem to want to keep qemu-usermode by default but you&apos;re stating others can append it again?.

- Removing qemu-usermode by default allows skylake to be tuned properly
- Not removing qemu-usermode, will support qemu-usermode, but will build a half optimized skylake</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89443</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2021-02-27 21:25:38 +0000</bug_when>
    <thetext>&gt; This now sounds like it breaks &gt;50% of the cases where people could use the
&gt; &quot;intel-skylake-64&quot; machine as a Yocto target.

What you seem to be missing is that adding qemu-usermode to intel-skylake-64 breaks 100% of use-cases as qemu can&apos;t execute Skylake code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89444</commentid>
    <comment_count>10</comment_count>
    <who name="Colin Finck">c.finck</who>
    <bug_when>2021-02-28 07:18:39 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; That last statement is a bit confusing

Yep, I should have suggested for local.conf:

    MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;


(In reply to comment #8)
&gt; - Removing qemu-usermode by default allows skylake to be tuned properly
&gt; - Not removing qemu-usermode, will support qemu-usermode, but will build a
&gt; half optimized skylake

- Keeping qemu-usermode by default allows a build for &quot;intel-skylake-64&quot; to succeed at all (considering that Ross said qemu-usermode is used most of the time).
- If you still want maximum Skylake tuning (with AVX and AVX2) *and* don&apos;t need qemu-usermode, you can add

    MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;

to your local.conf.

Is an &quot;intel-skylake-64&quot; target that can hardly be used in a Yocto build really what you want?


(In reply to comment #9)
&gt; What you seem to be missing is that adding qemu-usermode to intel-skylake-64
&gt; breaks 100% of use-cases as qemu can&apos;t execute Skylake code.

Look at the actual code: https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/conf/machine/include/tune-skylake.inc
The &quot;intel-skylake-64&quot; target already checks if qemu-usermode is part of MACHINE_FEATURES and disables AVX and AVX2 in that case, just enough for qemu-usermode to work.

However, the current &quot;intel-skylake-64&quot; target also hardcodes MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;, hence there is no way to add back qemu-usermode without creating a new target.

What&apos;s the purpose of the @bb.utils.contains(&apos;MACHINE_FEATURES&apos;, &apos;qemu-usermode&apos;, ...) check then?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89445</commentid>
    <comment_count>11</comment_count>
    <who name="Alejandro">alejandro</who>
    <bug_when>2021-02-28 23:43:01 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; (In reply to comment #8)
&gt; &gt; That last statement is a bit confusing
&gt; 
&gt; Yep, I should have suggested for local.conf:
&gt; 
&gt;     MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;
&gt; 
&gt; 
&gt; (In reply to comment #8)
&gt; &gt; - Removing qemu-usermode by default allows skylake to be tuned properly
&gt; &gt; - Not removing qemu-usermode, will support qemu-usermode, but will build a
&gt; &gt; half optimized skylake
&gt; 
&gt; - Keeping qemu-usermode by default allows a build for &quot;intel-skylake-64&quot; to
&gt; succeed at all (considering that Ross said qemu-usermode is used most of the
&gt; time).
&gt; - If you still want maximum Skylake tuning (with AVX and AVX2) *and* don&apos;t
&gt; need qemu-usermode, you can add
&gt; 
&gt;     MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;
&gt; 
&gt; to your local.conf.
&gt; 
&gt; Is an &quot;intel-skylake-64&quot; target that can hardly be used in a Yocto build
&gt; really what you want?
&gt; 
&gt; 
&gt; (In reply to comment #9)
&gt; &gt; What you seem to be missing is that adding qemu-usermode to intel-skylake-64
&gt; &gt; breaks 100% of use-cases as qemu can&apos;t execute Skylake code.
&gt; 
&gt; Look at the actual code:
&gt; https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/conf/machine/
&gt; include/tune-skylake.inc
&gt; The &quot;intel-skylake-64&quot; target already checks if qemu-usermode is part of
&gt; MACHINE_FEATURES and disables AVX and AVX2 in that case, just enough for
&gt; qemu-usermode to work.
&gt; 
&gt; However, the current &quot;intel-skylake-64&quot; target also hardcodes
&gt; MACHINE_FEATURES_remove = &quot;qemu-usermode&quot;, hence there is no way to add back
&gt; qemu-usermode without creating a new target.
&gt; 
&gt; What&apos;s the purpose of the @bb.utils.contains(&apos;MACHINE_FEATURES&apos;,
&gt; &apos;qemu-usermode&apos;, ...) check then?

I&apos;m aware what the code does, I put that code myself, the purpose of the check is that people like you and I who are able to keep qemu-usermode in some way and want to use the skylake tune along with qemu-usermode at least get a build working even though were sacrificing optimization, a non-optimized working build is better than a broken build IMO.

I&apos;m sorry this is confusing for you, I propose we add some comments to the code to explain that (I think I explained it on the commit message, but it doesn&apos;t hurt to add more information).

Worst case scenario we should keep the MACHINE_FEATURES_remove = &quot;qemu-usermode&quot; line to keep an optimized system by default and remove the bb.utils check so that people aren&apos;t confused by it like you are, but I don&apos;t believe there&apos;s much benefit in that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96359</commentid>
    <comment_count>12</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-09-07 14:56:35 +0000</bug_when>
    <thetext>qemu now has avx2 support.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>