[arm-platforms:hack/m1-pmu 8/8] drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject

5 messages, 5 authors, 2021-11-14 · open the first message on its own page

[arm-platforms:hack/m1-pmu 8/8] drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject

From: kernel test robot <hidden>
Date: 2021-11-14 08:28:34

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git hack/m1-pmu
head:   a905c66ae0b391425e9ad7f261ad7b4c33af2c07
commit: a905c66ae0b391425e9ad7f261ad7b4c33af2c07 [8/8] drivers/perf: Add Apple icestorm/firestorm CPU PMU driver
config: arm64-randconfig-r036-20211114 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=a905c66ae0b391425e9ad7f261ad7b4c33af2c07
        git remote add arm-platforms https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
        git fetch --no-tags arm-platforms hack/m1-pmu
        git checkout a905c66ae0b391425e9ad7f261ad7b4c33af2c07
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All warnings (new ones prefixed by >>):
quoted
drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [M1_PMU_PERFCTR_UNKNOWN_01]     = BIT(7),
                                             ^~~~~~
   include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
   #define BIT(nr)                 (UL(1) << (nr))
                                   ^~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:101:32: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [M1_PMU_PERFCTR_CPU_CYCLES]     = ANY_BUT_0_1 | BIT(0),
                                             ^~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:102:34: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [M1_PMU_PERFCTR_INSTRUCTIONS]   = BIT(7) | BIT(1),
                                             ^~~~~~~~~~~~~~~
   include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
   #define BIT(nr)                 (UL(1) << (nr))
                                   ^
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:103:32: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [M1_PMU_PERFCTR_UNKNOWN_8d]     = ONLY_5_6_7,
                                             ^~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:28:22: note: expanded from macro 'ONLY_5_6_7'
   #define ONLY_5_6_7                      GENMASK(7, 5)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:104:32: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [M1_PMU_PERFCTR_UNKNOWN_8e]     = ONLY_5_6_7,
                                             ^~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:28:22: note: expanded from macro 'ONLY_5_6_7'
   #define ONLY_5_6_7                      GENMASK(7, 5)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:105:32: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [M1_PMU_PERFCTR_UNKNOWN_8f]     = ONLY_5_6_7,
                                             ^~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:28:22: note: expanded from macro 'ONLY_5_6_7'
   #define ONLY_5_6_7                      GENMASK(7, 5)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:25:23: note: expanded from macro 'ANY_BUT_0_1'
   #define ANY_BUT_0_1                     GENMASK(9, 2)
                                           ^~~~~~~~~~~~~
   include/linux/bits.h:38:2: note: expanded from macro 'GENMASK'
           (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))


vim +100 drivers/perf/apple_m1_cpu_pmu.c

    91	
    92	/*
    93	 * Per-event affinity table. Most events can be installed on counter
    94	 * 2-9, but there are a numbre of exceptions. Note that this table
    95	 * has been created experimentally, and I wouldn't be surprised if more
    96	 * counters had strange affinities.
    97	 */
    98	static const u16 m1_pmu_event_affinity[M1_PMU_PERFCTR_LAST + 1] = {
    99		[0 ... M1_PMU_PERFCTR_LAST]	= ANY_BUT_0_1,
 > 100		[M1_PMU_PERFCTR_UNKNOWN_01]	= BIT(7),
   101		[M1_PMU_PERFCTR_CPU_CYCLES]	= ANY_BUT_0_1 | BIT(0),
   102		[M1_PMU_PERFCTR_INSTRUCTIONS]	= BIT(7) | BIT(1),
   103		[M1_PMU_PERFCTR_UNKNOWN_8d]	= ONLY_5_6_7,
   104		[M1_PMU_PERFCTR_UNKNOWN_8e]	= ONLY_5_6_7,
   105		[M1_PMU_PERFCTR_UNKNOWN_8f]	= ONLY_5_6_7,
   106		[M1_PMU_PERFCTR_UNKNOWN_90]	= ONLY_5_6_7,
   107		[M1_PMU_PERFCTR_UNKNOWN_93]	= ONLY_5_6_7,
   108		[M1_PMU_PERFCTR_UNKNOWN_94]	= ONLY_5_6_7,
   109		[M1_PMU_PERFCTR_UNKNOWN_95]	= ONLY_5_6_7,
   110		[M1_PMU_PERFCTR_UNKNOWN_96]	= ONLY_5_6_7,
   111		[M1_PMU_PERFCTR_UNKNOWN_97]	= BIT(7),
   112		[M1_PMU_PERFCTR_UNKNOWN_98]	= ONLY_5_6_7,
   113		[M1_PMU_PERFCTR_UNKNOWN_99]	= ONLY_5_6_7,
   114		[M1_PMU_PERFCTR_UNKNOWN_9a]	= BIT(7),
   115		[M1_PMU_PERFCTR_UNKNOWN_9b]	= ONLY_5_6_7,
   116		[M1_PMU_PERFCTR_UNKNOWN_9c]	= ONLY_5_6_7,
   117		[M1_PMU_PERFCTR_UNKNOWN_9f]	= BIT(7),
   118		[M1_PMU_PERFCTR_UNKNOWN_bf]	= ONLY_5_6_7,
   119		[M1_PMU_PERFCTR_UNKNOWN_c0]	= ONLY_5_6_7,
   120		[M1_PMU_PERFCTR_UNKNOWN_c1]	= ONLY_5_6_7,
   121		[M1_PMU_PERFCTR_UNKNOWN_c4]	= ONLY_5_6_7,
   122		[M1_PMU_PERFCTR_UNKNOWN_c5]	= ONLY_5_6_7,
   123		[M1_PMU_PERFCTR_UNKNOWN_c6]	= ONLY_5_6_7,
   124		[M1_PMU_PERFCTR_UNKNOWN_c8]	= ONLY_5_6_7,
   125		[M1_PMU_PERFCTR_UNKNOWN_ca]	= ONLY_5_6_7,
   126		[M1_PMU_PERFCTR_UNKNOWN_cb]	= ONLY_5_6_7,
   127		[M1_PMU_PERFCTR_UNKNOWN_f5]	= ONLY_2_4_6,
   128		[M1_PMU_PERFCTR_UNKNOWN_f6]	= ONLY_2_4_6,
   129		[M1_PMU_PERFCTR_UNKNOWN_f7]	= ONLY_2_4_6,
   130		[M1_PMU_PERFCTR_UNKNOWN_f8]	= ONLY_2_TO_7,
   131		[M1_PMU_PERFCTR_UNKNOWN_fd]	= ONLY_2_4_6,
   132	};
   133	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Re: [arm-platforms:hack/m1-pmu 8/8] drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject

From: Marc Zyngier <maz@kernel.org>
Date: 2021-11-14 10:12:09

On 2021-11-14 08:25, kernel test robot wrote:
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
hack/m1-pmu
head:   a905c66ae0b391425e9ad7f261ad7b4c33af2c07
commit: a905c66ae0b391425e9ad7f261ad7b4c33af2c07 [8/8] drivers/perf:
Add Apple icestorm/firestorm CPU PMU driver
config: arm64-randconfig-r036-20211114 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project
c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
reproduce (this is a W=1 build):
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        #
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=a905c66ae0b391425e9ad7f261ad7b4c33af2c07
        git remote add arm-platforms
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
        git fetch --no-tags arm-platforms hack/m1-pmu
        git checkout a905c66ae0b391425e9ad7f261ad7b4c33af2c07
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All warnings (new ones prefixed by >>):
quoted
quoted
drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer 
overrides prior initialization of this subobject 
[-Winitializer-overrides]
           [M1_PMU_PERFCTR_UNKNOWN_01]     = BIT(7),
                                             ^~~~~~
   include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
   #define BIT(nr)                 (UL(1) << (nr))
                                   ^~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization 
is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
Oh please, not that thing again. I've commented on this many times,
and this warning is just bogus. Initialisation override is a necessity,
and working around this warning leads to something that is far less
maintainable, and thus more *dangerous* than this.

I really wish this warning was simply turned off, because it only
leads to the robot emails to be ignored do to the number of false 
positives.

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [arm-platforms:hack/m1-pmu 8/8] drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2021-11-14 11:09:16

On Sun, 14 Nov 2021 at 11:11, Marc Zyngier [off-list ref] wrote:
On 2021-11-14 08:25, kernel test robot wrote:
quoted
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
hack/m1-pmu
head:   a905c66ae0b391425e9ad7f261ad7b4c33af2c07
commit: a905c66ae0b391425e9ad7f261ad7b4c33af2c07 [8/8] drivers/perf:
Add Apple icestorm/firestorm CPU PMU driver
config: arm64-randconfig-r036-20211114 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project
c3dddeeafb529e769cde87bd29ef6271ac6bfa5c)
reproduce (this is a W=1 build):
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        #
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=a905c66ae0b391425e9ad7f261ad7b4c33af2c07
        git remote add arm-platforms
https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
        git fetch --no-tags arm-platforms hack/m1-pmu
        git checkout a905c66ae0b391425e9ad7f261ad7b4c33af2c07
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All warnings (new ones prefixed by >>):
quoted
quoted
drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer
overrides prior initialization of this subobject
[-Winitializer-overrides]
           [M1_PMU_PERFCTR_UNKNOWN_01]     = BIT(7),
                                             ^~~~~~
   include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
   #define BIT(nr)                 (UL(1) << (nr))
                                   ^~~~~~~~~~~~~~~
   drivers/perf/apple_m1_cpu_pmu.c:99:32: note: previous initialization
is here
           [0 ... M1_PMU_PERFCTR_LAST]     = ANY_BUT_0_1,
                                             ^~~~~~~~~~~
Oh please, not that thing again. I've commented on this many times,
and this warning is just bogus. Initialisation override is a necessity,
and working around this warning leads to something that is far less
maintainable, and thus more *dangerous* than this.

I really wish this warning was simply turned off, because it only
leads to the robot emails to be ignored do to the number of false
positives.
Agreed, very annoying indeed. Should we just do
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index d53825503874..feeed72fe011 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -36,6 +36,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
 KBUILD_CFLAGS += -Wno-missing-field-initializers
 KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -Wno-type-limits
+KBUILD_CFLAGS += $(call cc-option, -Wno-initializer-overrides)

 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
@@ -45,7 +46,6 @@ else
 # Suppress them by using -Wno... except for W=1.

 ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += -Wno-initializer-overrides
 KBUILD_CFLAGS += -Wno-format
 KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -Wno-format-zero-length
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [arm-platforms:hack/m1-pmu 8/8] drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject

From: Miguel Ojeda <hidden>
Date: 2021-11-14 12:25:57

On Sun, Nov 14, 2021 at 12:07 PM Ard Biesheuvel [off-list ref] wrote:
+KBUILD_CFLAGS += $(call cc-option, -Wno-initializer-overrides)
I don't think we would need `cc-option`.

Cheers,
Miguel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [arm-platforms:hack/m1-pmu 8/8] drivers/perf/apple_m1_cpu_pmu.c:100:32: warning: initializer overrides prior initialization of this subobject

From: Nathan Chancellor <nathan@kernel.org>
Date: 2021-11-14 21:43:58

On Sun, Nov 14, 2021 at 01:24:16PM +0100, Miguel Ojeda wrote:
On Sun, Nov 14, 2021 at 12:07 PM Ard Biesheuvel [off-list ref] wrote:
quoted
+KBUILD_CFLAGS += $(call cc-option, -Wno-initializer-overrides)
I don't think we would need `cc-option`.
-Winitializer-overrides is the clang version of the flag, as opposed to
-Woverride-init for gcc. A compatibility flag was added in clang 8 so if
this is changed to

KBUILD_CFLAGS += -Wno-override-init

it should work for both compilers.

Cheers,
Nathan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help