1. 20 Mar, 2024 3 commits
    • Masahiro Yamada's avatar
      kconfig: tests: test dependency after shuffling choices · f2fd2aad
      Masahiro Yamada authored
      Commit c8fb7d7e ("kconfig: fix broken dependency in randconfig-
      generated .config") fixed the issue, but I did not add a test case.
      
      This commit adds a test case that emulates the reported situation.
      The test would fail without c8fb7d7e.
      
      To handle the choice "choose X", FOO must be calculated beforehand.
      FOO depends on A, which is a member of another choice "choose A or B".
      Kconfig _temporarily_ assumes the value of A to proceed. The choice
      "choose A or B" will be shuffled later, but the result may or may not
      meet "FOO depends on A". Kconfig should invalidate the symbol values
      and recompute them.
      
      In the real example for ARCH=arm64, the choice "Instrumentation type"
      needs the value of CPU_BIG_ENDIAN. The choice "Endianness" will be
      shuffled later.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f2fd2aad
    • Masahiro Yamada's avatar
      kconfig: tests: add a test for randconfig with dependent choices · 47ad1689
      Masahiro Yamada authored
      Since commit 3b9a19e0 ("kconfig: loop as long as we changed some
      symbols in randconfig"), conf_set_all_new_symbols() is repeated until
      there is no more choice left to be shuffled. The motivation was to
      shuffle a choice nested in another choice.
      
      Although commit 09d5873e ("kconfig: allow only 'config', 'comment',
      and 'if' inside 'choice'") disallowed the nested choice structure,
      we must still keep 3b9a19e0 because there are still cases where
      conf_set_all_new_symbols() must iterate.
      
      scripts/kconfig/tests/choice_randomize/Kconfig is the test case.
      The second choice depends on 'B', which is the member of the first
      choice.
      
      With 3b9a19e0 reverted, we would never get the pattern specified by
      scripts/kconfig/tests/choice_randomize/expected_config2.
      
      A real example can be found in lib/Kconfig.debug. Without 3b9a19e0,
      the randconfig would not shuffle the "Compressed Debug information"
      choice, which depends on DEBUG_INFO, which is derived from another
      choice "Debug information".
      
      My goal is to refactor Kconfig so that randconfig will work more
      simply, without using the loop.
      
      For now, let's add a test case to ensure all dependent choices are
      shuffled, as it is a somewhat tricky case for the current Kconfig.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      47ad1689
    • Masahiro Yamada's avatar
      kconfig: tests: support KCONFIG_SEED for the randconfig runner · c9aa7d86
      Masahiro Yamada authored
      This will help get consistent results for randconfig tests.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c9aa7d86
  2. 18 Mar, 2024 6 commits
  3. 11 Mar, 2024 1 commit
    • Masahiro Yamada's avatar
      kbuild: remove GCC's default -Wpacked-bitfield-compat flag · 44929bfa
      Masahiro Yamada authored
      Commit 4a5838ad ("kbuild: Add extra gcc checks") added the
      -Wpacked-bitfield-compat flag, but there is no need to add it
      explicitly.
      
      GCC manual says:
        "This warning is enabled by default. Use -Wno-packed-bitfield-compat
         to disable this warning."
      
      The test code in the manual:
      
        struct foo
        {
          char a:4;
          char b:8;
        } __attribute__ ((packed));
      
      ... emits "note: offset of packed bit-field ‘b’ has changed in GCC 4.4"
      without W=3.
      
      Let's remove it, as it is a default with GCC.
      
      Clang does not support this flag, so its removal will not affect Clang
      builds.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      44929bfa
  4. 10 Mar, 2024 3 commits
    • Masahiro Yamada's avatar
      kbuild: unexport abs_srctree and abs_objtree · e2bad142
      Masahiro Yamada authored
      Commit 25b146c5 ("kbuild: allow Kbuild to start from any directory")
      exported abs_srctree and abs_objtree to avoid recomputation after the
      sub-make. However, this approach turned out to be fragile.
      
      Commit 5fa94ceb ("kbuild: set correct abs_srctree and abs_objtree
      for package builds") moved them above "ifneq ($(sub_make_done),1)",
      eliminating the need for exporting them.
      
      These are only needed in the top Makefile. If an absolute path is
      required in sub-directories, you can use $(abspath ) or $(realpath )
      as needed.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      e2bad142
    • Nathan Chancellor's avatar
      kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 · 75b5ab13
      Nathan Chancellor authored
      Clang enables -Wenum-enum-conversion and -Wenum-compare-conditional
      under -Wenum-conversion. A recent change in Clang strengthened these
      warnings and they appear frequently in common builds, primarily due to
      several instances in common headers but there are quite a few drivers
      that have individual instances as well.
      
        include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
          508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
              |                            ~~~~~~~~~~~~~~~~~~~~~ ^
          509 |                            item];
              |                            ~~~~
      
        drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:955:24: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional]
          955 |                 flags |= is_new_rate ? IWL_MAC_BEACON_CCK
              |                                      ^ ~~~~~~~~~~~~~~~~~~
          956 |                           : IWL_MAC_BEACON_CCK_V1;
              |                             ~~~~~~~~~~~~~~~~~~~~~
        drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1120:21: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional]
         1120 |                                                0) > 10 ?
              |                                                        ^
         1121 |                         IWL_MAC_BEACON_FILS :
              |                         ~~~~~~~~~~~~~~~~~~~
         1122 |                         IWL_MAC_BEACON_FILS_V1;
              |                         ~~~~~~~~~~~~~~~~~~~~~~
      
      Doing arithmetic between or returning two different types of enums could
      be a bug, so each of the instance of the warning needs to be evaluated.
      Unfortunately, as mentioned above, there are many instances of this
      warning in many different configurations, which can break the build when
      CONFIG_WERROR is enabled.
      
      To avoid introducing new instances of the warnings while cleaning up the
      disruption for the majority of users, disable these warnings for the
      default build while leaving them on for W=1 builds.
      
      Cc: stable@vger.kernel.org
      Closes: https://github.com/ClangBuiltLinux/linux/issues/2002
      Link: https://github.com/llvm/llvm-project/commit/8c2ae42b3e1c6aa7c18f873edcebff7c0b45a37eAcked-by: default avatarYonghong Song <yonghong.song@linux.dev>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      75b5ab13
    • Masahiro Yamada's avatar
      kconfig: remove named choice support · c83f0209
      Masahiro Yamada authored
      Commit 5a1aa8a1 ("kconfig: add named choice group") did not provide
      enough explanation regarding its benefits. A use case was found in
      another project [1] sometime later, this feature has never been used in
      the kernel.
      
      [1]: https://lore.kernel.org/all/201012150034.01356.yann.morin.1998@anciens.enib.fr/Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      c83f0209
  5. 09 Mar, 2024 3 commits
  6. 25 Feb, 2024 1 commit
    • Petr Pavlu's avatar
      kbuild: Use -fmin-function-alignment when available · 5270316c
      Petr Pavlu authored
      GCC recently added option -fmin-function-alignment, which should appear
      in GCC 14. Unlike -falign-functions, this option causes all functions to
      be aligned at the specified value, including the cold ones.
      
      In particular, when an arm64 kernel is built with
      DYNAMIC_FTRACE_WITH_CALL_OPS=y, the 8-byte function alignment is
      required for correct functionality. This was done by -falign-functions=8
      and having workarounds in the kernel to force the compiler to follow
      this alignment. The new -fmin-function-alignment option directly
      guarantees it.
      
      Detect availability of -fmin-function-alignment and use it instead of
      -falign-functions when present. Introduce CC_HAS_SANE_FUNCTION_ALIGNMENT
      and enable __cold to work as expected when it is set.
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5270316c
  7. 23 Feb, 2024 4 commits
  8. 20 Feb, 2024 10 commits
  9. 19 Feb, 2024 9 commits