<?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>12535</bug_id>
          
          <creation_ts>2018-02-06 21:39:59 +0000</creation_ts>
          <short_desc>kernel-devsrc do_package takes unreasonably long time</short_desc>
          <delta_ts>2018-11-30 20:10: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>OE-Core</product>
          <component>kernel</component>
          <version>2.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</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>4.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Juro Bystricky">juro.bystricky</reporter>
          <assigned_to name="Bruce Ashfield">bruce.ashfield</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tom.zanussi</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>79368</commentid>
    <comment_count>0</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-06 21:39:59 +0000</bug_when>
    <thetext>When building an image such as core-image-sato-sdk-ptest, we build kernel-devsrc package as well. I observed it takes over 5501 (!) seconds for kernel-devsrc do_package on my system.
Granted, the I/O is stressed quite a bit, but this does not seem reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79369</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-02-06 22:15:55 +0000</bug_when>
    <thetext>Assigning to Bruce as he&apos;s kernel.

If you have taskstats can you verify that this is do_package() and not do_package_rpm or similar.  Or is it all of them.

I suspect the basic problem is that kernel-devsrc is huge.  It&apos;s possible that there&apos;s an algorithmic problem in the classes somewhere but its more likely just to be linear scaling on a package an order of magnitude larger than most others.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79372</commentid>
    <comment_count>2</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-06 22:59:02 +0000</bug_when>
    <thetext>It is do_package, do_package_qa and do_package_rpm are rather fast.
And yes, we have few hundred MB of sources...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79376</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-02-07 14:04:57 +0000</bug_when>
    <thetext>buildstats for me:

ross@flashheart /data/poky-tmp/master/buildstats/20180207125644/kernel-devsrc-1.0-r0
$ grep Elapsed  *
do_install:Elapsed time: 17.05 seconds
do_package:Elapsed time: 218.46 seconds
do_packagedata:Elapsed time: 4.95 seconds
do_package_qa:Elapsed time: 34.58 seconds
do_package_write_ipk:Elapsed time: 252.06 seconds
do_package_write_rpm:Elapsed time: 201.40 seconds
do_populate_lic_setscene:Elapsed time: 0.20 seconds
do_prepare_recipe_sysroot:Elapsed time: 0.14 seconds
do_rm_work:Elapsed time: 0.97 seconds

Slow, but not astronomically.  This was on tmpfs though...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79377</commentid>
    <comment_count>4</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-02-07 14:08:23 +0000</bug_when>
    <thetext>Yah, it has always been slow. Mainly because of the amount of small files being slung around. The same reason why we moved the kernel into work-shared to avoid the time penalty of moving the source around the tree for a build.

That being said, I can definitely poke at this more and see if something sub-optimal has crept into the steps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79378</commentid>
    <comment_count>5</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-07 16:21:24 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; buildstats for me:
&gt; 
&gt; ross@flashheart
&gt; /data/poky-tmp/master/buildstats/20180207125644/kernel-devsrc-1.0-r0
&gt; $ grep Elapsed  *
&gt; do_install:Elapsed time: 17.05 seconds
&gt; do_package:Elapsed time: 218.46 seconds
&gt; do_packagedata:Elapsed time: 4.95 seconds
&gt; do_package_qa:Elapsed time: 34.58 seconds
&gt; do_package_write_ipk:Elapsed time: 252.06 seconds
&gt; do_package_write_rpm:Elapsed time: 201.40 seconds
&gt; do_populate_lic_setscene:Elapsed time: 0.20 seconds
&gt; do_prepare_recipe_sysroot:Elapsed time: 0.14 seconds
&gt; do_rm_work:Elapsed time: 0.97 seconds
&gt; 
&gt; Slow, but not astronomically.  This was on tmpfs though...

Well, my numbers are quite a bit worse for do_package:

/data/master/poky-contrib/build2-nuc-sato-master-multilib-distro-1-2018-02-05/tmp/buildstats/20180206002151/kernel-devsrc-1.0-r0$ grep Elapsed *
do_deploy_sde:Elapsed time: 0.27 seconds
do_install:Elapsed time: 155.82 seconds
do_package:Elapsed time: 5110.79 seconds
do_packagedata:Elapsed time: 0.36 seconds
do_package_qa:Elapsed time: 25.88 seconds
do_package_write_deb:Elapsed time: 27.16 seconds
do_package_write_ipk:Elapsed time: 368.88 seconds
do_package_write_rpm:Elapsed time: 349.06 seconds
do_populate_lic:Elapsed time: 1.26 seconds
do_prepare_recipe_sysroot:Elapsed time: 8.71 seconds

Having said that, I do build with some extra patches, so I&apos;ll double check with another build without those.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79396</commentid>
    <comment_count>6</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-08 16:13:06 +0000</bug_when>
    <thetext>It is probably worthwhile mentioning at the time the package was being built, I was deleting some older build folders (running multiple rm -rf &lt;old-builddir&gt; &amp; )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79404</commentid>
    <comment_count>7</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-09 16:03:31 +0000</bug_when>
    <thetext>When repeating the build in ramdisk, there were no problems. I believe the exceedingly long time for do_package is caused by rm&quot; running in the background, and there is probably not much that can be done about it (short of maybe using different file system).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79406</commentid>
    <comment_count>8</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2018-02-09 17:06:16 +0000</bug_when>
    <thetext>Juro, You could try:
$ ionice -c 3 rm -rf old-build
to see if that interferes less with the primary build when both are using a disk-backed filesystem. If you don&apos;t use ionice then the filesystem *should* treat both the build and the clean-up as equal priority jobs as you probably know.

That said, a slowdown from ~3-500 seconds to ~5000 seconds seems wrong and might be worth trying to understand by doing additional systematic tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79409</commentid>
    <comment_count>9</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-09 17:13:18 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Juro, You could try:
&gt; $ ionice -c 3 rm -rf old-build
&gt; to see if that interferes less with the primary build when both are using a
&gt; disk-backed filesystem. If you don&apos;t use ionice then the filesystem *should*
&gt; treat both the build and the clean-up as equal priority jobs as you probably
&gt; know.
&gt; 
&gt; That said, a slowdown from ~3-500 seconds to ~5000 seconds seems wrong and
&gt; might be worth trying to understand by doing additional systematic tests.

Thanks, I was not using ionice, so it will be interesting to see how it improves the do_package performance. I am constantly running out of disk space, so I keep deleting old builds frequently. Therefore I was getting those &quot;unreasonable&quot; times for do_package of krenel-devsrc frequently as well, failing to connect the dots.

I plan on running some benchmarks (obtained by profiling via bitbake -P) and will post the results (with/without rm and/or ionice).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79441</commentid>
    <comment_count>10</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-02-14 20:01:03 +0000</bug_when>
    <thetext>I have a significantly streamlined kernel-devsrc package under test.

I&apos;m just wondering where I can find the set of tests for it .. since I&apos;m sure, I&apos;ve dropped some required elements :D</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79442</commentid>
    <comment_count>11</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-14 20:43:05 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; I have a significantly streamlined kernel-devsrc package under test.
&gt; 
&gt; I&apos;m just wondering where I can find the set of tests for it .. since I&apos;m
&gt; sure, I&apos;ve dropped some required elements :D

I generally do

local.conf : INHERIT += &quot;testimage&quot;
$ MACHINE=xxx bitbake core-image-sato-sdk
$ MACHINE=xxx bitbake core-image-sato-sdk -c testimage

(I would do this for several machines)

One of the tests is building external kernel module. 
Takes a while.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79445</commentid>
    <comment_count>12</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-02-15 04:50:47 +0000</bug_when>
    <thetext>I was able to build and launch, but of course my runqemu failed due to an SDK issue. On my servers, I always run &quot;nographic&quot;.

Does anyone have a pointer where the testimage stuff is documented ? I looked, but can&apos;t find the tests, how to run a single test, or how to modify the qemu parameters to have nographic in play.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79446</commentid>
    <comment_count>13</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-02-15 05:03:43 +0000</bug_when>
    <thetext>I found the tests/and suites variables via the bbclass. still searching on how to pass &apos;nographic&apos; to the run, perhaps I need a non-sato based image. ..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79447</commentid>
    <comment_count>14</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-02-15 05:10:07 +0000</bug_when>
    <thetext>following the steps in the qa test, I scp&apos;d the components onto my target and ran the test manually:

root@qemux86-64:/tmp# make
make -C /lib/modules/4.14.16-yocto-standard/build/ M=/tmp modules
make[1]: Entering directory &apos;/lib/modules/4.14.16-yocto-standard/build&apos;
  CC [M]  /tmp/hellomod.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/hellomod.mod.o
  LD [M]  /tmp/hellomod.ko
make[1]: Leaving directory &apos;/lib/modules/4.14.16-yocto-standard/build&apos;
root@qemux86-64:/tmp# insmod hellomod.ko   
[  331.162855] hellomod: loading out-of-tree module taints kernel.
[  331.167231] Hello world!

------

I made one change, in that the kernel build infrastructure is normalized to what you find in other distros: /lib/modules/&lt;version&gt;/build/...

This is all done with a kerneldev package that is:

-rw-r--r-- 2 bruce bruce 9.4M Feb 14 18:13 kernel-devsrc-1.0-r0.qemux86_64.rpm

So 9.4Megs, shouldn&apos;t break the bank in terms of i/o or in image size.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79450</commentid>
    <comment_count>15</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-02-15 10:59:51 +0000</bug_when>
    <thetext>9.4M down from 600M? I owe you a beer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79451</commentid>
    <comment_count>16</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-15 15:05:56 +0000</bug_when>
    <thetext>(In reply to comment #15)
&gt; 9.4M down from 600M? I owe you a beer.

(In reply to comment #14)
&gt; following the steps in the qa test, I scp&apos;d the components onto my target
&gt; and ran the test manually:
&gt; 
&gt; root@qemux86-64:/tmp# make
&gt; make -C /lib/modules/4.14.16-yocto-standard/build/ M=/tmp modules
&gt; make[1]: Entering directory &apos;/lib/modules/4.14.16-yocto-standard/build&apos;
&gt;   CC [M]  /tmp/hellomod.o
&gt;   Building modules, stage 2.
&gt;   MODPOST 1 modules
&gt;   CC      /tmp/hellomod.mod.o
&gt;   LD [M]  /tmp/hellomod.ko
&gt; make[1]: Leaving directory &apos;/lib/modules/4.14.16-yocto-standard/build&apos;
&gt; root@qemux86-64:/tmp# insmod hellomod.ko   
&gt; [  331.162855] hellomod: loading out-of-tree module taints kernel.
&gt; [  331.167231] Hello world!
&gt; 
&gt; ------
&gt; 
&gt; I made one change, in that the kernel build infrastructure is normalized to
&gt; what you find in other distros: /lib/modules/&lt;version&gt;/build/...
&gt; 
&gt; This is all done with a kerneldev package that is:
&gt; 
&gt; -rw-r--r-- 2 bruce bruce 9.4M Feb 14 18:13
&gt; kernel-devsrc-1.0-r0.qemux86_64.rpm
&gt; 
&gt; So 9.4Megs, shouldn&apos;t break the bank in terms of i/o or in image size.

Yes, the link is quite useful. I had to put it manually in BuildAppliance recipe:
lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
in order to be able to build VirtualBox guest extensions (as an out-of-tree module). Having said that, I will test the new kernel-devsrc package with BuildAppliance as well...(w/o the link)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79453</commentid>
    <comment_count>17</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2018-02-15 15:12:45 +0000</bug_when>
    <thetext>Once this is merged, I will resolve
https://bugzilla.yoctoproject.org/show_bug.cgi?id=6630
and
https://bugzilla.yoctoproject.org/show_bug.cgi?id=4389</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82372</commentid>
    <comment_count>18</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-11-30 20:10:35 +0000</bug_when>
    <thetext>The re-worked kernel-devsrc package addresses this issue</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>