diff mbox

[1/3] Kconfig: disable PROFILE_ALL_BRANCHES for compile testing

Message ID 20180216214117.1947175-2-arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann Feb. 16, 2018, 9:41 p.m. UTC
This can easily double the time for compiling a driver but does not
provide any benefit for the compile tester, so it's better left disabled.

In addition, any 'inline' function that is not also 'static' and that
contains an 'if' causes a warning like

include/linux/string.h:212:2: note: in expansion of macro 'if'
  if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
  ^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static

without this patch, and I could not come up with a nice fix for that.
In combination with my patch to always enable 'CONFIG_COMPILE_TEST'
during 'randconfig' builds, we can at least hide these warnings for
most users.

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Steven Rostedt Feb. 16, 2018, 10:03 p.m. UTC | #1
On Fri, 16 Feb 2018 22:41:11 +0100
Arnd Bergmann <arnd@arndb.de> wrote:

> This can easily double the time for compiling a driver but does not
> provide any benefit for the compile tester, so it's better left disabled.
> 
> In addition, any 'inline' function that is not also 'static' and that
> contains an 'if' causes a warning like
> 
> include/linux/string.h:212:2: note: in expansion of macro 'if'
>   if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
>   ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
> 
> without this patch, and I could not come up with a nice fix for that.
> In combination with my patch to always enable 'CONFIG_COMPILE_TEST'
> during 'randconfig' builds, we can at least hide these warnings for
> most users.

This looks like it fixes the same issue that was already fixed and is
in Linus's tree.

 http://lkml.kernel.org/r/9199446b-a141-c0c3-9678-a3f9107f2750@infradead.org

See commit 68e76e034b6b1 ("tracing: Prevent PROFILE_ALL_BRANCHES when
FORTIFY_SOURCE=y")

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Feb. 16, 2018, 10:14 p.m. UTC | #2
On Fri, Feb 16, 2018 at 11:03 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Fri, 16 Feb 2018 22:41:11 +0100
> Arnd Bergmann <arnd@arndb.de> wrote:
>
>> This can easily double the time for compiling a driver but does not
>> provide any benefit for the compile tester, so it's better left disabled.
>>
>> In addition, any 'inline' function that is not also 'static' and that
>> contains an 'if' causes a warning like
>>
>> include/linux/string.h:212:2: note: in expansion of macro 'if'
>>   if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
>>   ^~
>> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
>>
>> without this patch, and I could not come up with a nice fix for that.
>> In combination with my patch to always enable 'CONFIG_COMPILE_TEST'
>> during 'randconfig' builds, we can at least hide these warnings for
>> most users.
>
> This looks like it fixes the same issue that was already fixed and is
> in Linus's tree.
>
>  http://lkml.kernel.org/r/9199446b-a141-c0c3-9678-a3f9107f2750@infradead.org
>
> See commit 68e76e034b6b1 ("tracing: Prevent PROFILE_ALL_BRANCHES when
> FORTIFY_SOURCE=y")

Ah, right. I missed that when I wrote the new changelog text for this old
patch of mine. It also means I should rebase the patch so it applies
on mainline, as I still want PROFILE_ALL_BRANCHES to be disabled
in COMPILE_TEST kernels for the build speed aspect.

Greg, could you add the 68e76e034b6b1 commit to 4.14-stable and
4.15-stable in the meantime?

        Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Feb. 16, 2018, 10:40 p.m. UTC | #3
On Fri, Feb 16, 2018 at 11:14 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Fri, Feb 16, 2018 at 11:03 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>> On Fri, 16 Feb 2018 22:41:11 +0100
>> Arnd Bergmann <arnd@arndb.de> wrote:
>>
>>> This can easily double the time for compiling a driver but does not
>>> provide any benefit for the compile tester, so it's better left disabled.
>>>
>>> In addition, any 'inline' function that is not also 'static' and that
>>> contains an 'if' causes a warning like
>>>
>>> include/linux/string.h:212:2: note: in expansion of macro 'if'
>>>   if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
>>>   ^~
>>> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
>>>
>>> without this patch, and I could not come up with a nice fix for that.
>>> In combination with my patch to always enable 'CONFIG_COMPILE_TEST'
>>> during 'randconfig' builds, we can at least hide these warnings for
>>> most users.
>>
>> This looks like it fixes the same issue that was already fixed and is
>> in Linus's tree.
>>
>>  http://lkml.kernel.org/r/9199446b-a141-c0c3-9678-a3f9107f2750@infradead.org
>>
>> See commit 68e76e034b6b1 ("tracing: Prevent PROFILE_ALL_BRANCHES when
>> FORTIFY_SOURCE=y")
>
> Ah, right. I missed that when I wrote the new changelog text for this old
> patch of mine. It also means I should rebase the patch so it applies
> on mainline, as I still want PROFILE_ALL_BRANCHES to be disabled
> in COMPILE_TEST kernels for the build speed aspect.

I retested on top of that patch and found a couple of other warnings show up
in an allmodconfig build with PROFILE_ALL_BRANCHES:

lib/zstd/decompress.c: In function 'ZSTD_decompressStream':
lib/zstd/decompress.c:416:2: error: argument 1 null where non-null
expected [-Werror=nonnull]
drivers/crypto/qat/qat_common/qat_algs.c: In function 'qat_alg_do_precomputes':
drivers/crypto/qat/qat_common/qat_algs.c:156:7: error: argument 1
range [18446744071562067968, 18446744073709551615] exceeds maximum
object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
drivers/isdn/hardware/eicon/message.c: In function 'mixer_notify_update':
drivers/isdn/hardware/eicon/message.c:11162:54: error: array subscript
is above array bounds [-Werror=array-bounds]
     ((CAPI_MSG *) msg)->info.facility_req.structs[1] =
LI_REQ_SILENT_UPDATE & 0xff;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/isdn/hardware/eicon/message.c:11163:54: error: array subscript
is above array bounds [-Werror=array-bounds]
     ((CAPI_MSG *) msg)->info.facility_req.structs[2] =
LI_REQ_SILENT_UPDATE >> 8;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/isdn/hardware/eicon/message.c:11164:54: error: array subscript
is above array bounds [-Werror=array-bounds]
     ((CAPI_MSG *) msg)->info.facility_req.structs[3] = 0;

All those are nonsense AFAICT, and we see them only because the "if()" override
ends up confusing gcc's value-range tracking in the same way it used to cause
lots of -Wmaybe-uninitialized warnings (which we just disable these days
with PROFILE_ALL_BRANCHES).

        Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt Feb. 16, 2018, 10:50 p.m. UTC | #4
On Fri, 16 Feb 2018 23:40:22 +0100
Arnd Bergmann <arnd@arndb.de> wrote:

>      ((CAPI_MSG *) msg)->info.facility_req.structs[1] =
> LI_REQ_SILENT_UPDATE & 0xff;
>      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/isdn/hardware/eicon/message.c:11163:54: error: array subscript
> is above array bounds [-Werror=array-bounds]
>      ((CAPI_MSG *) msg)->info.facility_req.structs[2] =
> LI_REQ_SILENT_UPDATE >> 8;
>      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/isdn/hardware/eicon/message.c:11164:54: error: array subscript
> is above array bounds [-Werror=array-bounds]
>      ((CAPI_MSG *) msg)->info.facility_req.structs[3] = 0;
> 
> All those are nonsense AFAICT, and we see them only because the "if()" override
> ends up confusing gcc's value-range tracking in the same way it used to cause
> lots of -Wmaybe-uninitialized warnings (which we just disable these days
> with PROFILE_ALL_BRANCHES).

I'm fine with your patch then.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman Feb. 17, 2018, 1:32 p.m. UTC | #5
On Fri, Feb 16, 2018 at 11:14:42PM +0100, Arnd Bergmann wrote:
> On Fri, Feb 16, 2018 at 11:03 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Fri, 16 Feb 2018 22:41:11 +0100
> > Arnd Bergmann <arnd@arndb.de> wrote:
> >
> >> This can easily double the time for compiling a driver but does not
> >> provide any benefit for the compile tester, so it's better left disabled.
> >>
> >> In addition, any 'inline' function that is not also 'static' and that
> >> contains an 'if' causes a warning like
> >>
> >> include/linux/string.h:212:2: note: in expansion of macro 'if'
> >>   if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
> >>   ^~
> >> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
> >>
> >> without this patch, and I could not come up with a nice fix for that.
> >> In combination with my patch to always enable 'CONFIG_COMPILE_TEST'
> >> during 'randconfig' builds, we can at least hide these warnings for
> >> most users.
> >
> > This looks like it fixes the same issue that was already fixed and is
> > in Linus's tree.
> >
> >  http://lkml.kernel.org/r/9199446b-a141-c0c3-9678-a3f9107f2750@infradead.org
> >
> > See commit 68e76e034b6b1 ("tracing: Prevent PROFILE_ALL_BRANCHES when
> > FORTIFY_SOURCE=y")
> 
> Ah, right. I missed that when I wrote the new changelog text for this old
> patch of mine. It also means I should rebase the patch so it applies
> on mainline, as I still want PROFILE_ALL_BRANCHES to be disabled
> in COMPILE_TEST kernels for the build speed aspect.
> 
> Greg, could you add the 68e76e034b6b1 commit to 4.14-stable and
> 4.15-stable in the meantime?

It's already in 4.15, so I'll just queue it up to 4.14.y.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada Feb. 20, 2018, 9:32 a.m. UTC | #6
2018-02-17 6:41 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> This can easily double the time for compiling a driver but does not
> provide any benefit for the compile tester, so it's better left disabled.
>
> In addition, any 'inline' function that is not also 'static' and that
> contains an 'if' causes a warning like
>
> include/linux/string.h:212:2: note: in expansion of macro 'if'
>   if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
>   ^~
> include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
>
> without this patch, and I could not come up with a nice fix for that.
> In combination with my patch to always enable 'CONFIG_COMPILE_TEST'
> during 'randconfig' builds, we can at least hide these warnings for
> most users.
>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


I took a look at this just in case
because the subject is prefixed with "Kconfig:",
but it is actually "trace:".

I expect "Kconfig:" for core changes of Kconfig.

Using precise patch prefix would get more attention from
right people.




> ---
>  kernel/trace/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index 434c840e2d82..faaf687b13b1 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -345,6 +345,7 @@ config PROFILE_ANNOTATED_BRANCHES
>  config PROFILE_ALL_BRANCHES
>         bool "Profile all if conditionals"
>         select TRACE_BRANCH_PROFILING
> +       depends on !COMPILE_TEST
>         help
>           This tracer profiles all branch conditions. Every if ()
>           taken in the kernel is recorded whether it hit or miss.
> --
> 2.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 434c840e2d82..faaf687b13b1 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -345,6 +345,7 @@  config PROFILE_ANNOTATED_BRANCHES
 config PROFILE_ALL_BRANCHES
 	bool "Profile all if conditionals"
 	select TRACE_BRANCH_PROFILING
+	depends on !COMPILE_TEST
 	help
 	  This tracer profiles all branch conditions. Every if ()
 	  taken in the kernel is recorded whether it hit or miss.