<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 13, 2017 at 12:10 PM, Khem Raj <span dir="ltr">&lt;<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, May 13, 2017 at 8:45 AM, Bruce Ashfield<br>
&lt;<a href="mailto:bruce.ashfield@gmail.com">bruce.ashfield@gmail.com</a>&gt; wrote:<br>
&gt; I already have this queued, I&#39;m just not sending any kernel pull requests<br>
&gt; while<br>
&gt; the release is finalizing.<br>
<br>
</span>its already done yesterday :) so you are free to send<br></blockquote><div><br></div><div>oh! I hadn&#39;t noticed. I was heads down working on some features. I&#39;ll update</div><div>and send my queue tonight. </div><div><br></div><div>I attached the patch to show it exists :D</div><div><br></div><div>Cheers,</div><div><br></div><div>Bruce</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
&gt;<br>
&gt; So please, do not queue or merge this change.<br>
&gt;<br>
<br>
</span>sure<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; Bruce<br>
&gt;<br>
&gt; On Fri, May 12, 2017 at 10:59 PM, Khem Raj &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Signed-off-by: Khem Raj &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt;<br>
&gt;&gt; ---<br>
&gt;&gt;  ...ve-up-on-gcc-ilog2-<wbr>constant-optimizations.patch | 134<br>
&gt;&gt; +++++++++++++++++++++<br>
&gt;&gt;  meta/recipes-kernel/linux/<a href="http://linux-yocto_4.1.bb" rel="noreferrer" target="_blank">linu<wbr>x-yocto_4.1.bb</a>       |   2 +<br>
&gt;&gt;  2 files changed, 136 insertions(+)<br>
&gt;&gt;  create mode 100644<br>
&gt;&gt; meta/recipes-kernel/linux/<wbr>linux-yocto/0001-give-up-on-<wbr>gcc-ilog2-constant-<wbr>optimizations.patch<br>
&gt;&gt;<br>
&gt;&gt; diff --git<br>
&gt;&gt; a/meta/recipes-kernel/linux/<wbr>linux-yocto/0001-give-up-on-<wbr>gcc-ilog2-constant-<wbr>optimizations.patch<br>
&gt;&gt; b/meta/recipes-kernel/linux/<wbr>linux-yocto/0001-give-up-on-<wbr>gcc-ilog2-constant-<wbr>optimizations.patch<br>
&gt;&gt; new file mode 100644<br>
&gt;&gt; index 0000000000..35c4484f20<br>
&gt;&gt; --- /dev/null<br>
&gt;&gt; +++<br>
&gt;&gt; b/meta/recipes-kernel/linux/<wbr>linux-yocto/0001-give-up-on-<wbr>gcc-ilog2-constant-<wbr>optimizations.patch<br>
&gt;&gt; @@ -0,0 +1,134 @@<br>
&gt;&gt; +From 273bf720b7acb5f808337fe57c5f40<wbr>0422a30051 Mon Sep 17 00:00:00 2001<br>
&gt;&gt; +From: Linus Torvalds &lt;<a href="mailto:torvalds@linux-foundation.org">torvalds@linux-foundation.org</a><wbr>&gt;<br>
&gt;&gt; +Date: Thu, 2 Mar 2017 12:17:22 -0800<br>
&gt;&gt; +Subject: [PATCH] give up on gcc ilog2() constant optimizations<br>
&gt;&gt; +<br>
&gt;&gt; +commit 474c90156c8dcc2fa815e6716cc939<wbr>4d7930cb9c upstream.<br>
&gt;&gt; +<br>
&gt;&gt; +gcc-7 has an &quot;optimization&quot; pass that completely screws up, and<br>
&gt;&gt; +generates the code expansion for the (impossible) case of calling<br>
&gt;&gt; +ilog2() with a zero constant, even when the code gcc compiles does not<br>
&gt;&gt; +actually have a zero constant.<br>
&gt;&gt; +<br>
&gt;&gt; +And we try to generate a compile-time error for anybody doing ilog2() on<br>
&gt;&gt; +a constant where that doesn&#39;t make sense (be it zero or negative).  So<br>
&gt;&gt; +now gcc7 will fail the build due to our sanity checking, because it<br>
&gt;&gt; +created that constant-zero case that didn&#39;t actually exist in the source<br>
&gt;&gt; +code.<br>
&gt;&gt; +<br>
&gt;&gt; +There&#39;s a whole long discussion on the kernel mailing about how to work<br>
&gt;&gt; +around this gcc bug.  The gcc people themselevs have discussed their<br>
&gt;&gt; +&quot;feature&quot; in<br>
&gt;&gt; +<br>
&gt;&gt; +   <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785" rel="noreferrer" target="_blank">https://gcc.gnu.org/bugzilla/<wbr>show_bug.cgi?id=72785</a><br>
&gt;&gt; +<br>
&gt;&gt; +but it&#39;s all water under the bridge, because while it looked at one<br>
&gt;&gt; +point like it would be solved by the time gcc7 was released, that was<br>
&gt;&gt; +not to be.<br>
&gt;&gt; +<br>
&gt;&gt; +So now we have to deal with this compiler braindamage.<br>
&gt;&gt; +<br>
&gt;&gt; +And the only simple approach seems to be to just delete the code that<br>
&gt;&gt; +tries to warn about bad uses of ilog2().<br>
&gt;&gt; +<br>
&gt;&gt; +So now &quot;ilog2()&quot; will just return 0 not just for the value 1, but for<br>
&gt;&gt; +any non-positive value too.<br>
&gt;&gt; +<br>
&gt;&gt; +It&#39;s not like I can recall anybody having ever actually tried to use<br>
&gt;&gt; +this function on any invalid value, but maybe the sanity check just<br>
&gt;&gt; +meant that such code never made it out in public.<br>
&gt;&gt; +<br>
&gt;&gt; +Reported-by: Laura Abbott &lt;<a href="mailto:labbott@redhat.com">labbott@redhat.com</a>&gt;<br>
&gt;&gt; +Cc: John Stultz &lt;<a href="mailto:john.stultz@linaro.org">john.stultz@linaro.org</a>&gt;,<br>
&gt;&gt; +Cc: Thomas Gleixner &lt;<a href="mailto:tglx@linutronix.de">tglx@linutronix.de</a>&gt;<br>
&gt;&gt; +Cc: Ard Biesheuvel &lt;<a href="mailto:ard.biesheuvel@linaro.org">ard.biesheuvel@linaro.org</a>&gt;<br>
&gt;&gt; +Signed-off-by: Linus Torvalds &lt;<a href="mailto:torvalds@linux-foundation.org">torvalds@linux-foundation.org</a><wbr>&gt;<br>
&gt;&gt; +Cc: Jiri Slaby &lt;<a href="mailto:jslaby@suse.cz">jslaby@suse.cz</a>&gt;<br>
&gt;&gt; +Signed-off-by: Greg Kroah-Hartman &lt;<a href="mailto:gregkh@linuxfoundation.org">gregkh@linuxfoundation.org</a>&gt;<br>
&gt;&gt; +Signed-off-by: Khem Raj &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt;<br>
&gt;&gt; +---<br>
&gt;&gt; +Upstream-Status: Backport<br>
&gt;&gt; +<br>
&gt;&gt; + include/linux/log2.h       | 13 ++-----------<br>
&gt;&gt; + tools/include/linux/log2.h | 13 ++-----------<br>
&gt;&gt; + 2 files changed, 4 insertions(+), 22 deletions(-)<br>
&gt;&gt; +<br>
&gt;&gt; +diff --git a/include/linux/log2.h b/include/linux/log2.h<br>
&gt;&gt; +index fd7ff3d91e6a..f38fae23bdac 100644<br>
&gt;&gt; +--- a/include/linux/log2.h<br>
&gt;&gt; ++++ b/include/linux/log2.h<br>
&gt;&gt; +@@ -16,12 +16,6 @@<br>
&gt;&gt; + #include &lt;linux/bitops.h&gt;<br>
&gt;&gt; +<br>
&gt;&gt; + /*<br>
&gt;&gt; +- * deal with unrepresentable constant logarithms<br>
&gt;&gt; +- */<br>
&gt;&gt; +-extern __attribute__((const, noreturn))<br>
&gt;&gt; +-int ____ilog2_NaN(void);<br>
&gt;&gt; +-<br>
&gt;&gt; +-/*<br>
&gt;&gt; +  * non-constant log of base 2 calculators<br>
&gt;&gt; +  * - the arch may override these in asm/bitops.h if they can be<br>
&gt;&gt; implemented<br>
&gt;&gt; +  *   more efficiently than using fls() and fls64()<br>
&gt;&gt; +@@ -85,7 +79,7 @@ unsigned long __rounddown_pow_of_two(<wbr>unsigned long n)<br>
&gt;&gt; + #define ilog2(n)                              \<br>
&gt;&gt; + (                                             \<br>
&gt;&gt; +       __builtin_constant_p(n) ? (             \<br>
&gt;&gt; +-              (n) &lt; 1 ? ____ilog2_NaN() :     \<br>
&gt;&gt; ++              (n) &lt; 2 ? 0 :                   \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt; 63) ? 63 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt; 62) ? 62 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt; 61) ? 61 :       \<br>
&gt;&gt; +@@ -148,10 +142,7 @@ unsigned long __rounddown_pow_of_two(<wbr>unsigned long<br>
&gt;&gt; n)<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt;  4) ?  4 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt;  3) ?  3 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt;  2) ?  2 :       \<br>
&gt;&gt; +-              (n) &amp; (1ULL &lt;&lt;  1) ?  1 :       \<br>
&gt;&gt; +-              (n) &amp; (1ULL &lt;&lt;  0) ?  0 :       \<br>
&gt;&gt; +-              ____ilog2_NaN()                 \<br>
&gt;&gt; +-                                 ) :          \<br>
&gt;&gt; ++              1 ) :                           \<br>
&gt;&gt; +       (sizeof(n) &lt;= 4) ?                      \<br>
&gt;&gt; +       __ilog2_u32(n) :                        \<br>
&gt;&gt; +       __ilog2_u64(n)                          \<br>
&gt;&gt; +diff --git a/tools/include/linux/log2.h b/tools/include/linux/log2.h<br>
&gt;&gt; +index 41446668ccce..d5677d39c1e4 100644<br>
&gt;&gt; +--- a/tools/include/linux/log2.h<br>
&gt;&gt; ++++ b/tools/include/linux/log2.h<br>
&gt;&gt; +@@ -13,12 +13,6 @@<br>
&gt;&gt; + #define _TOOLS_LINUX_LOG2_H<br>
&gt;&gt; +<br>
&gt;&gt; + /*<br>
&gt;&gt; +- * deal with unrepresentable constant logarithms<br>
&gt;&gt; +- */<br>
&gt;&gt; +-extern __attribute__((const, noreturn))<br>
&gt;&gt; +-int ____ilog2_NaN(void);<br>
&gt;&gt; +-<br>
&gt;&gt; +-/*<br>
&gt;&gt; +  * non-constant log of base 2 calculators<br>
&gt;&gt; +  * - the arch may override these in asm/bitops.h if they can be<br>
&gt;&gt; implemented<br>
&gt;&gt; +  *   more efficiently than using fls() and fls64()<br>
&gt;&gt; +@@ -78,7 +72,7 @@ unsigned long __rounddown_pow_of_two(<wbr>unsigned long n)<br>
&gt;&gt; + #define ilog2(n)                              \<br>
&gt;&gt; + (                                             \<br>
&gt;&gt; +       __builtin_constant_p(n) ? (             \<br>
&gt;&gt; +-              (n) &lt; 1 ? ____ilog2_NaN() :     \<br>
&gt;&gt; ++              (n) &lt; 2 ? 0 :                   \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt; 63) ? 63 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt; 62) ? 62 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt; 61) ? 61 :       \<br>
&gt;&gt; +@@ -141,10 +135,7 @@ unsigned long __rounddown_pow_of_two(<wbr>unsigned long<br>
&gt;&gt; n)<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt;  4) ?  4 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt;  3) ?  3 :       \<br>
&gt;&gt; +               (n) &amp; (1ULL &lt;&lt;  2) ?  2 :       \<br>
&gt;&gt; +-              (n) &amp; (1ULL &lt;&lt;  1) ?  1 :       \<br>
&gt;&gt; +-              (n) &amp; (1ULL &lt;&lt;  0) ?  0 :       \<br>
&gt;&gt; +-              ____ilog2_NaN()                 \<br>
&gt;&gt; +-                                 ) :          \<br>
&gt;&gt; ++              1 ) :                           \<br>
&gt;&gt; +       (sizeof(n) &lt;= 4) ?                      \<br>
&gt;&gt; +       __ilog2_u32(n) :                        \<br>
&gt;&gt; +       __ilog2_u64(n)                          \<br>
&gt;&gt; +--<br>
&gt;&gt; +2.12.2<br>
&gt;&gt; +<br>
&gt;&gt; diff --git a/meta/recipes-kernel/linux/<a href="http://linux-yocto_4.1.bb" rel="noreferrer" target="_blank">li<wbr>nux-yocto_4.1.bb</a><br>
&gt;&gt; b/meta/recipes-kernel/linux/<a href="http://linux-yocto_4.1.bb" rel="noreferrer" target="_blank">li<wbr>nux-yocto_4.1.bb</a><br>
&gt;&gt; index bf7f266ee6..f90d5159d5 100644<br>
&gt;&gt; --- a/meta/recipes-kernel/linux/<a href="http://linux-yocto_4.1.bb" rel="noreferrer" target="_blank">li<wbr>nux-yocto_4.1.bb</a><br>
&gt;&gt; +++ b/meta/recipes-kernel/linux/<a href="http://linux-yocto_4.1.bb" rel="noreferrer" target="_blank">li<wbr>nux-yocto_4.1.bb</a><br>
&gt;&gt; @@ -24,6 +24,8 @@ SRCREV_meta ?=<br>
&gt;&gt; &quot;<wbr>7140ddb86e4b01529185e6d4a60600<wbr>1ad152b8f3&quot;<br>
&gt;&gt;  SRC_URI =<br>
&gt;&gt; &quot;git://<a href="http://git.yoctoproject.org/linux-yocto-4.1.git;name=machine;branch=${KBRANCH}" rel="noreferrer" target="_blank">git.yoctoproject.org/<wbr>linux-yocto-4.1.git;name=<wbr>machine;branch=${KBRANCH}</a>;<br>
&gt;&gt; \<br>
&gt;&gt;<br>
&gt;&gt; git://<a href="http://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}" rel="noreferrer" target="_blank">git.yoctoproject.org/<wbr>yocto-kernel-cache;type=kmeta;<wbr>name=meta;branch=yocto-4.1;<wbr>destsuffix=${KMETA}</a>&quot;<br>
&gt;&gt;<br>
&gt;&gt; +SRC_URI +=<br>
&gt;&gt; &quot;file://0001-give-up-on-gcc-<wbr>ilog2-constant-optimizations.<wbr>patch&quot;<br>
&gt;&gt; +<br>
&gt;&gt;  LINUX_VERSION ?= &quot;4.1.38&quot;<br>
&gt;&gt;<br>
&gt;&gt;  PV = &quot;${LINUX_VERSION}+git${SRCPV}&quot;<br>
&gt;&gt; --<br>
&gt;&gt; 2.13.0<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; Openembedded-core mailing list<br>
&gt;&gt; <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
&gt;&gt; <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; &quot;Thou shalt not follow the NULL pointer, for chaos and madness await thee at<br>
&gt; its end&quot;<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">&quot;Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end&quot;</div>
</div></div>