<?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>13113</bug_id>
          
          <creation_ts>2019-01-03 07:09:13 +0000</creation_ts>
          <short_desc>Accelerate out-of-tree kernel module built in eSDK</short_desc>
          <delta_ts>2019-01-11 02:12:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>eSDK</product>
          <component>eSDK</component>
          <version>2.7</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Zhaolong Zhang">zhangzl2013</reporter>
          <assigned_to name="Paul Eggleton">bluelightning</assigned_to>
          <cc>bruce.ashfield</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          <qa_contact name="Francisco Pedraza">francisco.j.pedraza.gonzalez</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>82640</commentid>
    <comment_count>0</comment_count>
    <who name="Zhaolong Zhang">zhangzl2013</who>
    <bug_when>2019-01-03 07:09:13 +0000</bug_when>
    <thetext>When building out-of-tree kernel modules in eSDK, it will always trigger a new rebuilding of kernel, which consumes lots of time.

I have tried to add virtual/kernel:do_shared_workdir to sstate cache and ship it with eSDK. On the eSDK side, run `bitbake linux-yocto -c shared_workdir` returns immediatlely, but `bitbake hello-mod` still triggers tasks from linux-yocto:do_fetch.

Adding this enhancement, it may need more time to generate the eSDK installer, but it will save considerably time at the eSDK user&apos;s side.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82653</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-01-03 16:25:34 +0000</bug_when>
    <thetext>As discussed on the mailing list, this is not something we plan to support.

There is no technical reason that do_shared_workdir couldn&apos;t be an sstate task however the combination of the kernel source and the kernel compiled artifacts is large and results in a large sstate object. This means the time to build the kernel increases substantially.

Using the the object in a new build, or in an eSDK then results in having to transfer a large object over a network which is also slow unless its a local transfer so there is a double hit.

We made a decision as a project to just rebuild these pieces if/as needed rather than take the hit on the performance of the base kernel builds.

I appreciate that doesn&apos;t work for every workload but it is the tradeoff we decided to make.

If should be possible to patch do_shared_work to be an sstate task, however that code path will be quite different from the current behavior. We don&apos;t have the build resources to be able to test these two different code paths (does devtoool work with both, do external modules work with both etc). We&apos;re therefore unlikely to merge such a patch.

I&apos;ve cc&apos;d Bruce in case he has any different viewpoint on this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82665</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-01-03 22:52:06 +0000</bug_when>
    <thetext>Just to additionally note, there was a change submitted which makes it easier to implement this:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=aa83cb5264554dd1963042f905688afc796e98d0

I decided to merge that to at least make this option easier to implement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82696</commentid>
    <comment_count>3</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2019-01-07 13:55:55 +0000</bug_when>
    <thetext>Just documenting that my view is the same as RPs. What made it into the tree looks appropriate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82748</commentid>
    <comment_count>4</comment_count>
      <attachid>4421</attachid>
    <who name="Zhaolong Zhang">zhangzl2013</who>
    <bug_when>2019-01-11 02:12:52 +0000</bug_when>
    <thetext>Created attachment 4421
add STAGING_KERNEL_BUILDDIR and STAGING_KERNEL_DIR to eSDK

For anyone that may need this acceleration, this patch is for your reference.
Apply this patch as well as http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=aa83cb5264554dd1963042f905688afc796e98d0.

My testing result:

With patch:                        Orig:
===========                        =====
build and export eSDK:
----------------------
real    72m28.549s                 real    69m17.119s
user    653m12.390s                user    645m38.162s
sys     154m17.175s                sys     153m22.593s

eSDK installer size:
--------------------
4.6G                               4.4G

eSDK installation:
------------------
real    6m40.714s                  real    8m7.331s
user    24m19.822s                 user    25m41.045s
sys     4m17.492s                  sys     4m23.538s

build hello-mod in eSDK:
------------------------
real    0m31.966s                  real    21m7.686s
user    3m48.485s                  user    35m10.894s
sys     0m7.827s                   sys     15m3.837s</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4421</attachid>
            <date>2019-01-11 02:12:52 +0000</date>
            <delta_ts>2019-01-11 02:12:52 +0000</delta_ts>
            <desc>add STAGING_KERNEL_BUILDDIR and STAGING_KERNEL_DIR to eSDK</desc>
            <filename>0001-eSDK-sstate-kernel-stuffs-and-export-to-eSDK.patch</filename>
            <type>text/plain</type>
            <size>2220</size>
            <attacher name="Zhaolong Zhang">zhangzl2013</attacher>
            
              <data encoding="base64">RnJvbSA5MzIzMmYzYWU5NmYzZGRkNTQ2OGY0ZTkzZmZmZjAxNTkxOWMyZDBhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBaaGFvbG9uZyBaaGFuZyA8emhhbmd6bDIwMTNAMTI2LmNvbT4K
RGF0ZTogVGh1LCAxMCBKYW4gMjAxOSAxMzo1NDo0OSArMDgwMApTdWJqZWN0OiBbUEFUQ0hdIGVT
REs6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