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