<?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>10880</bug_id>
          
          <creation_ts>2017-01-05 12:42:05 +0000</creation_ts>
          <short_desc>perf recipe contaminates linux shared workdir in do_configure_prepend()</short_desc>
          <delta_ts>2018-06-01 02:11:54 +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.4</version>
          <rep_platform>All</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="Martin Hundeboll">mnhu</reporter>
          <assigned_to name="Hongxu Jia">hongxu.jia</assigned_to>
          <cc>hongxu.jia</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>69511</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Hundeboll">mnhu</who>
    <bug_when>2017-01-05 12:42:05 +0000</bug_when>
    <thetext>When baking perf the shared workdir is modified:

% git status
 HEAD detached at 43daed5beff6
 Changes not staged for commit:
  (use &quot;git add &lt;file&gt;...&quot; to update what will be committed)
  (use &quot;git checkout -- &lt;file&gt;...&quot; to discard changes in working directory)

        modified:   tools/build/Makefile.build
        modified:   tools/build/Makefile.feature
        modified:   tools/lib/api/Makefile
        modified:   tools/perf/Makefile.perf
        modified:   tools/perf/arch/arm/tests/dwarf-unwind.c
        modified:   tools/perf/arch/arm/util/unwind-libunwind.c
        modified:   tools/perf/config/Makefile

no changes added to commit (use &quot;git add&quot; and/or &quot;git commit -a&quot;)

Building the kernel (or its modules) afterwards (without running do_unpack) changes the kernelversion to *-dirty, which might lead to misplaced modules etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69521</commentid>
    <comment_count>1</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2017-01-05 15:33:10 +0000</bug_when>
    <thetext>There&apos;s no easy way to fix this. How the perf recipe modifies the kernel source is out of necessity, since perf is a separate recipe and not attached to a definitive non-kernel source tree.

That means that we can&apos;t just fix perf issues with patches (since they won&apos;t apply to everyone&apos;s kernel source tree), and we can&apos;t fix it directly in linux-yocto (my preference), since not everyone uses linux-yocto.

Also, we can&apos;t just commit the changes, since not everyone uses git based kernel source trees, hence having the perf recipe itself do git add/commits won&apos;t universally work (not to mention we have enough issues even with the kernel recipes ensuring that git is configured properly for commits). We could always do a commit for linux-yocto, but again, not everyone uses linux-yocto.

We could do kernel-recipe specific providers of perf, and those kernel trees could carry perf patches. Possible, but duplicated effort to maintain fixes.

We could split out the perf code into a separate tree, patch and build from it. Also possible, but then we&apos;d deviate from upstream development and have kernel version skew.

We could test for a git based ${S} and conditionally commit changes, but that adds complexity to the recipe .. but is probably the best option.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69529</commentid>
    <comment_count>2</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2017-01-05 16:21:49 +0000</bug_when>
    <thetext>I see this got a milestone .. to be clear, I accepted this, but am not committing to a fix. 

Changing the milestone.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69540</commentid>
    <comment_count>3</comment_count>
    <who name="Martin Hundeboll">mnhu</who>
    <bug_when>2017-01-05 18:08:04 +0000</bug_when>
    <thetext>Doing commits from the perf recipe doesn&apos;t fix the problem, as following kernel builds will have a new commit-id.

I lean towards building perf as part of the kernel-class, possibly conditional on a class-variable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69541</commentid>
    <comment_count>4</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2017-01-05 18:26:52 +0000</bug_when>
    <thetext>perf was explicitly split out from the kernel recipes. I&apos;m not going to be the one that attempts to put it back in. 

It has a separate set of depends/functionality/complications that the already complex kernel build process needs no part of.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69542</commentid>
    <comment_count>5</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2017-01-05 18:28:48 +0000</bug_when>
    <thetext>Alternatively, we can just have the kernel recipe clean up, and unpack the sources again on subsequent builds if the tree has been modified. (In reply to comment #4)
&gt; perf was explicitly split out from the kernel recipes. I&apos;m not going to be
&gt; the one that attempts to put it back in. 
&gt; 
&gt; It has a separate set of depends/functionality/complications that the
&gt; already complex kernel build process needs no part of.

Not to mention, you are still in the situation where perf fixes cannot be shared, which isn&apos;t going to fly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69543</commentid>
    <comment_count>6</comment_count>
    <who name="Martin Hundeboll">mnhu</who>
    <bug_when>2017-01-05 18:31:00 +0000</bug_when>
    <thetext>Would that race with other recipes using the shared kernel source? E.g. do_compile_kernelmodules...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69552</commentid>
    <comment_count>7</comment_count>
    <who name="Martin Hundeboll">mnhu</who>
    <bug_when>2017-01-05 21:08:19 +0000</bug_when>
    <thetext>For your information I fixed this in my local layer (non-x86 multilib) with a bbappend:

% cat perf.bbappend 
RDEPENDS_perf_remove = &quot;perl&quot;

# remove tainting of shared workdir, see
# https://bugzilla.yoctoproject.org/show_bug.cgi?id=10880
do_configure_prepend() {
    # Fix for rebuilding
    rm -rf ${B}/
    mkdir -p ${B}/

    # return here to avoid running do_configure_append() from perf.bb
    return

}

# Fix the build failures caused by the early return in
# do_configure_prepend() by passing the correct options to make:
#  - Unlike other kernel builds, perf uses &quot;OUTPUT&quot; instead of &quot;O&quot;
#    to specify the build directory
#  - The perf build ignores the flags given in ${CC}, so pass them in
#    via EXTRA_CFLAGS instead
EXTRA_OEMAKE += &quot; \
    OUTPUT=${B}/ \
    EXTRA_CFLAGS=&quot;${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -ldw&quot; \
&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69553</commentid>
    <comment_count>8</comment_count>
    <who name="Martin Hundeboll">mnhu</who>
    <bug_when>2017-01-05 21:13:01 +0000</bug_when>
    <thetext>Alternatively, the perf recipe could patch out the -dirty feature from ./scripts/setlocalversion</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72393</commentid>
    <comment_count>9</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2017-04-12 17:31:49 +0000</bug_when>
    <thetext>I had asked Richard about this one via email, but there are other higher priority items for 2.3 to complete first.

I&apos;ll take my half done implementation and complete it in early 2.4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75616</commentid>
    <comment_count>10</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2017-08-03 15:19:56 +0000</bug_when>
    <thetext>See Bruce&apos;s question</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80683</commentid>
    <comment_count>11</comment_count>
    <who name="Hongxu Jia">hongxu.jia</who>
    <bug_when>2018-06-01 02:11:54 +0000</bug_when>
    <thetext>Merged into oe-core

commit 9b38c824961fc9dce51bda95c25dac91a69fc64f
Author: Hongxu Jia &lt;hongxu.jia@windriver.com&gt;
Date:   Tue Apr 24 11:33:47 2018 +0800

    perf: make a copy of kernel source to perf workdir
    
    Since perf contaminates linux shared workdir, it probably caused
    kernel-devsrc compile failure at world build.
    ...
    |0 blocks
    |cpio: ./tools/perf/arch/arm/util/sedr7ORqk: Cannot stat:
    No such file or directory
    |0 blocks
    ...
    cpio tried to find a file at ${S}/tools/perf and failed
    if the input list is not valid.
    
    Make a copy of kernel shared source directory into a perf workdir
    could fix the issue.
    
    Drop `Fix for rebuilding&apos; which is obsolete
    
    [YOCTO #10880]
    
    Signed-off-by: Hongxu Jia &lt;hongxu.jia@windriver.com&gt;
    Signed-off-by: Ross Burton &lt;ross.burton@intel.com&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>