Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600651 > unrolled thread

Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2017-03-14 17:20 +0100
Last post2017-03-16 18:40 +0100
Articles 7 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-14 17:20 +0100
    Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized Arnd Bergmann <arnd@arndb.de> - 2017-03-14 22:00 +0100
      Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized Arnd Bergmann <arnd@arndb.de> - 2017-03-16 15:30 +0100
        [PATCH] kbuild: fix compile time regression Arnd Bergmann <arnd@arndb.de> - 2017-03-16 16:10 +0100
          Re: [PATCH] kbuild: fix compile time regression Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-16 18:50 +0100
        Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-16 18:40 +0100
      Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-16 18:40 +0100

#1600651 — Re: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-14 17:20 +0100
SubjectRe: [PATCH] Kbuild: use cc-disable-warning consistently for maybe-uninitialized
Message-ID<tkXkZ-2CM-5@gated-at.bofh.it>
Hi Arnd,

2017-01-14 0:40 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> In commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
> for "make W=1""), I reverted another change that happened to fix a problem
> with old compilers, and now we get this report again with old compilers
> (prior to gcc-4.8) and GCOV enabled:
>
>    cc1: warnings being treated as errors
>    drivers/gpu/drm/i915/intel_ringbuffer.c: In function 'intel_ring_setup_status_page':
>    drivers/gpu/drm/i915/intel_ringbuffer.c:438: error: 'mmio.reg' may be used uninitialized in this function
>    At top level:
>>> cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
>
> The problem is that we turn off the warning conditionally in a number
> of places as we should, but one of them does it unconditionally.
> Instead, change it to call cc-disable-warning as we do elsewhere.
>
> The original patch that caused it was merged into linux-4.7, then
> 4.8 removed the change and 4.9 brought it back, so we probably want
> a backport to 4.9 once this is merged.
>
> Cc: stable@vger.kernel.org
> Fixes: a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"")
> Fixes: e72e2dfe7c16 ("gcov: disable -Wmaybe-uninitialized warning")
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Applied to linux-kbuild/fixes.


But, please let me ask one question.

When I was checking your commit a76bcf557ef4,
I noticed the following code:


KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
                       $(call cc-disable-warning,maybe-uninitialized,))



It was not clear to me where this comes from
because it is not the revert of Linus' commit.


My best guess is:
maybe-uninitialized was introduced by gcc 4.7,
but only reliable for gcc 4.9 or later.
So it should be disabled for gcc < 4.9


Is this correct?


Thanks!

-- 
Best Regards
Masahiro Yamada

[toc] | [next] | [standalone]


#1600894

FromArnd Bergmann <arnd@arndb.de>
Date2017-03-14 22:00 +0100
Message-ID<tl1HY-5G2-11@gated-at.bofh.it>
In reply to#1600651
On Tue, Mar 14, 2017 at 5:17 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Hi Arnd,
>
> 2017-01-14 0:40 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
>> In commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
>> for "make W=1""), I reverted another change that happened to fix a problem
>> with old compilers, and now we get this report again with old compilers
>> (prior to gcc-4.8) and GCOV enabled:
>>
>>    cc1: warnings being treated as errors
>>    drivers/gpu/drm/i915/intel_ringbuffer.c: In function 'intel_ring_setup_status_page':
>>    drivers/gpu/drm/i915/intel_ringbuffer.c:438: error: 'mmio.reg' may be used uninitialized in this function
>>    At top level:
>>>> cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
>>
>> The problem is that we turn off the warning conditionally in a number
>> of places as we should, but one of them does it unconditionally.
>> Instead, change it to call cc-disable-warning as we do elsewhere.
>>
>> The original patch that caused it was merged into linux-4.7, then
>> 4.8 removed the change and 4.9 brought it back, so we probably want
>> a backport to 4.9 once this is merged.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"")
>> Fixes: e72e2dfe7c16 ("gcov: disable -Wmaybe-uninitialized warning")
>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
>
> Applied to linux-kbuild/fixes.

Thanks!

> But, please let me ask one question.
>
> When I was checking your commit a76bcf557ef4,
> I noticed the following code:
>
>
> KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
>                        $(call cc-disable-warning,maybe-uninitialized,))
>
>
>
> It was not clear to me where this comes from
> because it is not the revert of Linus' commit.
>
>
> My best guess is:
> maybe-uninitialized was introduced by gcc 4.7,
> but only reliable for gcc 4.9 or later.
> So it should be disabled for gcc < 4.9
>
>
> Is this correct?

Yes. Actually this warning is by definition not reliable, but gcc-4.9
got a lot better than earlier versions, and the set of false positives
in 4.9 is different from the one in 4.8, which introduced the flag.
As most people have 4.9 or higher, it makes sense to address all
the warnings found by that version by modifying the code (either
fixing bugs or working around false positives), but to just disable it
for 4.8 and earlier.

In older compiler versions, -Wuninitialized controlled both the
"definitely uninitialized" and the "possibly uninitialized" warnings,
and also had a lot of false positives, but 4.7 and earlier also
prouce lots of other warnings. I try to get a warning free build with
4.8 and higher but don't even try for old versions at the moment,
though I have an idea for how we could do that too.

        Arnd

[toc] | [prev] | [next] | [standalone]


#1602331

FromArnd Bergmann <arnd@arndb.de>
Date2017-03-16 15:30 +0100
Message-ID<tlEzE-80N-23@gated-at.bofh.it>
In reply to#1600894
On Tue, Mar 14, 2017 at 9:52 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tue, Mar 14, 2017 at 5:17 PM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> Hi Arnd,
>>
>> 2017-01-14 0:40 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
>>> In commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
>>> for "make W=1""), I reverted another change that happened to fix a problem
>>> with old compilers, and now we get this report again with old compilers
>>> (prior to gcc-4.8) and GCOV enabled:
>>>
>>>    cc1: warnings being treated as errors
>>>    drivers/gpu/drm/i915/intel_ringbuffer.c: In function 'intel_ring_setup_status_page':
>>>    drivers/gpu/drm/i915/intel_ringbuffer.c:438: error: 'mmio.reg' may be used uninitialized in this function
>>>    At top level:
>>>>> cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
>>>
>>> The problem is that we turn off the warning conditionally in a number
>>> of places as we should, but one of them does it unconditionally.
>>> Instead, change it to call cc-disable-warning as we do elsewhere.
>>>
>>> The original patch that caused it was merged into linux-4.7, then
>>> 4.8 removed the change and 4.9 brought it back, so we probably want
>>> a backport to 4.9 once this is merged.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"")
>>> Fixes: e72e2dfe7c16 ("gcov: disable -Wmaybe-uninitialized warning")
>>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>>
>> Applied to linux-kbuild/fixes.

Hmm, after I've carried this patch for months, I now found that it
caused a build
time regression. I'm sending a fix for that too, please either apply the fix
on top, or fold it into the first patch.

     Arnd

[toc] | [prev] | [next] | [standalone]


#1602476 — [PATCH] kbuild: fix compile time regression

FromArnd Bergmann <arnd@arndb.de>
Date2017-03-16 16:10 +0100
Subject[PATCH] kbuild: fix compile time regression
Message-ID<tlFco-97-59@gated-at.bofh.it>
In reply to#1602331
I noticed that a patch I did causes the time for a clean rebuild to
go up significantly, from 13 to 18 seconds on ARM defconfig, and
in the worst case forcing a rebuild of every file each time.

The fix is very simple, using a ':=' assignment instead of '='
to force the cc-disable-warning call to only be evaluated once
instead of every time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 3a964fa3a787..e7d4d20deb4e 100644
--- a/Makefile
+++ b/Makefile
@@ -381,7 +381,7 @@ LDFLAGS_MODULE  =
 CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
 LDFLAGS_vmlinux =
-CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
+CFLAGS_GCOV	:= -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
 CFLAGS_KCOV	:= $(call cc-option,-fsanitize-coverage=trace-pc,)
 
 ifeq ($(COMPILER),clang)
-- 
2.9.0

[toc] | [prev] | [next] | [standalone]


#1602710 — Re: [PATCH] kbuild: fix compile time regression

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-16 18:50 +0100
SubjectRe: [PATCH] kbuild: fix compile time regression
Message-ID<tlHHc-1ID-23@gated-at.bofh.it>
In reply to#1602476
2017-03-16 23:31 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> I noticed that a patch I did causes the time for a clean rebuild to
> go up significantly, from 13 to 18 seconds on ARM defconfig, and
> in the worst case forcing a rebuild of every file each time.
>
> The fix is very simple, using a ':=' assignment instead of '='
> to force the cc-disable-warning call to only be evaluated once
> instead of every time.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 3a964fa3a787..e7d4d20deb4e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -381,7 +381,7 @@ LDFLAGS_MODULE  =
>  CFLAGS_KERNEL  =
>  AFLAGS_KERNEL  =
>  LDFLAGS_vmlinux =
> -CFLAGS_GCOV    = -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
> +CFLAGS_GCOV    := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
>  CFLAGS_KCOV    := $(call cc-option,-fsanitize-coverage=trace-pc,)
>
>  ifeq ($(COMPILER),clang)
> --


Squashed into the first patch.


-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [next] | [standalone]


#1602697

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-16 18:40 +0100
Message-ID<tlHxv-1ET-9@gated-at.bofh.it>
In reply to#1602331
Hi Arnd,

2017-03-16 23:23 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> On Tue, Mar 14, 2017 at 9:52 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Tue, Mar 14, 2017 at 5:17 PM, Masahiro Yamada
>> <yamada.masahiro@socionext.com> wrote:
>>> Hi Arnd,
>>>
>>> 2017-01-14 0:40 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
>>>> In commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
>>>> for "make W=1""), I reverted another change that happened to fix a problem
>>>> with old compilers, and now we get this report again with old compilers
>>>> (prior to gcc-4.8) and GCOV enabled:
>>>>
>>>>    cc1: warnings being treated as errors
>>>>    drivers/gpu/drm/i915/intel_ringbuffer.c: In function 'intel_ring_setup_status_page':
>>>>    drivers/gpu/drm/i915/intel_ringbuffer.c:438: error: 'mmio.reg' may be used uninitialized in this function
>>>>    At top level:
>>>>>> cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
>>>>
>>>> The problem is that we turn off the warning conditionally in a number
>>>> of places as we should, but one of them does it unconditionally.
>>>> Instead, change it to call cc-disable-warning as we do elsewhere.
>>>>
>>>> The original patch that caused it was merged into linux-4.7, then
>>>> 4.8 removed the change and 4.9 brought it back, so we probably want
>>>> a backport to 4.9 once this is merged.
>>>>
>>>> Cc: stable@vger.kernel.org
>>>> Fixes: a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"")
>>>> Fixes: e72e2dfe7c16 ("gcov: disable -Wmaybe-uninitialized warning")
>>>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>>
>>>
>>> Applied to linux-kbuild/fixes.
>
> Hmm, after I've carried this patch for months, I now found that it
> caused a build
> time regression. I'm sending a fix for that too, please either apply the fix
> on top, or fold it into the first patch.
>

It is good that I had forgot to push my branch.
I will squash the two.

I'd like to combine the two git-log.

The git-log of the squashed one will be like follows.
If you want to edit it more, please let me know. Thanks!


---------------------------------------->8-------------------------------------

build: use cc-disable-warning consistently for maybe-uninitialized

In commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
for "make W=1""), I reverted another change that happened to fix a problem
with old compilers, and now we get this report again with old compilers
(prior to gcc-4.8) and GCOV enabled:

   cc1: warnings being treated as errors
   drivers/gpu/drm/i915/intel_ringbuffer.c: In function
'intel_ring_setup_status_page':
   drivers/gpu/drm/i915/intel_ringbuffer.c:438: error: 'mmio.reg' may
be used uninitialized in this function
   At top level:
>> cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"

The problem is that we turn off the warning conditionally in a number
of places as we should, but one of them does it unconditionally.
Instead, change it to call cc-disable-warning as we do elsewhere.

The original patch that caused it was merged into linux-4.7, then
4.8 removed the change and 4.9 brought it back, so we probably want
a backport to 4.9 once this is merged.

Use a ':=' assignment instead of '=' to force the cc-disable-warning
call to only be evaluated once instead of every time.

Cc: stable@vger.kernel.org
Fixes: a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for
"make W=1"")
Fixes: e72e2dfe7c16 ("gcov: disable -Wmaybe-uninitialized warning")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---------------------------------------->8-------------------------------------




-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [next] | [standalone]


#1602704

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-16 18:40 +0100
Message-ID<tlHxw-1ET-25@gated-at.bofh.it>
In reply to#1600894
Hi Arnd,

2017-03-15 5:52 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> On Tue, Mar 14, 2017 at 5:17 PM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> Hi Arnd,
>>
>> 2017-01-14 0:40 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
>>> In commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
>>> for "make W=1""), I reverted another change that happened to fix a problem
>>> with old compilers, and now we get this report again with old compilers
>>> (prior to gcc-4.8) and GCOV enabled:
>>>
>>>    cc1: warnings being treated as errors
>>>    drivers/gpu/drm/i915/intel_ringbuffer.c: In function 'intel_ring_setup_status_page':
>>>    drivers/gpu/drm/i915/intel_ringbuffer.c:438: error: 'mmio.reg' may be used uninitialized in this function
>>>    At top level:
>>>>> cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
>>>
>>> The problem is that we turn off the warning conditionally in a number
>>> of places as we should, but one of them does it unconditionally.
>>> Instead, change it to call cc-disable-warning as we do elsewhere.
>>>
>>> The original patch that caused it was merged into linux-4.7, then
>>> 4.8 removed the change and 4.9 brought it back, so we probably want
>>> a backport to 4.9 once this is merged.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"")
>>> Fixes: e72e2dfe7c16 ("gcov: disable -Wmaybe-uninitialized warning")
>>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>>
>> Applied to linux-kbuild/fixes.
>
> Thanks!
>
>> But, please let me ask one question.
>>
>> When I was checking your commit a76bcf557ef4,
>> I noticed the following code:
>>
>>
>> KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
>>                        $(call cc-disable-warning,maybe-uninitialized,))
>>
>>
>>
>> It was not clear to me where this comes from
>> because it is not the revert of Linus' commit.
>>
>>
>> My best guess is:
>> maybe-uninitialized was introduced by gcc 4.7,
>> but only reliable for gcc 4.9 or later.
>> So it should be disabled for gcc < 4.9
>>
>>
>> Is this correct?
>
> Yes. Actually this warning is by definition not reliable, but gcc-4.9
> got a lot better than earlier versions, and the set of false positives
> in 4.9 is different from the one in 4.8, which introduced the flag.
> As most people have 4.9 or higher, it makes sense to address all
> the warnings found by that version by modifying the code (either
> fixing bugs or working around false positives), but to just disable it
> for 4.8 and earlier.
>
> In older compiler versions, -Wuninitialized controlled both the
> "definitely uninitialized" and the "possibly uninitialized" warnings,
> and also had a lot of false positives, but 4.7 and earlier also
> prouce lots of other warnings. I try to get a warning free build with
> 4.8 and higher but don't even try for old versions at the moment,
> though I have an idea for how we could do that too.
>

Thanks for clarification!




-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web