1. 04 2月, 2020 2 次提交
    • M
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada 提交于
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
    • M
      kconfig: fix broken dependency in randconfig-generated .config · c8fb7d7e
      Masahiro Yamada 提交于
      Running randconfig on arm64 using KCONFIG_SEED=0x40C5E904 (e.g. on v5.5)
      produces the .config with CONFIG_EFI=y and CONFIG_CPU_BIG_ENDIAN=y,
      which does not meet the !CONFIG_CPU_BIG_ENDIAN dependency.
      
      This is because the user choice for CONFIG_CPU_LITTLE_ENDIAN vs
      CONFIG_CPU_BIG_ENDIAN is set by randomize_choice_values() after the
      value of CONFIG_EFI is calculated.
      
      When this happens, the has_changed flag should be set.
      
      Currently, it takes the result from the last iteration. It should
      accumulate all the results of the loop.
      
      Fixes: 3b9a19e0 ("kconfig: loop as long as we changed some symbols in randconfig")
      Reported-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      c8fb7d7e
  2. 01 2月, 2020 2 次提交
  3. 29 1月, 2020 8 次提交
  4. 28 1月, 2020 1 次提交
  5. 23 1月, 2020 1 次提交
  6. 22 1月, 2020 1 次提交
    • M
      kbuild: use -S instead of -E for precise cc-option test in Kconfig · 3bed1b7b
      Masahiro Yamada 提交于
      Currently, -E (stop after the preprocessing stage) is used to check
      whether the given compiler flag is supported.
      
      While it is faster than -S (or -c), it can be false-positive. You need
      to run the compilation proper to check the flag more precisely.
      
      For example, -E and -S disagree about the support of
      "--param asan-instrument-allocas=1".
      
      $ gcc -Werror --param asan-instrument-allocas=1 -E -x c /dev/null -o /dev/null
      $ echo $?
      0
      
      $ gcc -Werror --param asan-instrument-allocas=1 -S -x c /dev/null -o /dev/null
      cc1: error: invalid --param name ‘asan-instrument-allocas’; did you mean ‘asan-instrument-writes’?
      $ echo $?
      1
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      3bed1b7b
  7. 21 1月, 2020 1 次提交
  8. 20 1月, 2020 1 次提交
    • A
      ARM: 8950/1: ftrace/recordmcount: filter relocation types · 927d780e
      Alex Sverdlin 提交于
      Scenario 1, ARMv7
      =================
      
      If code in arch/arm/kernel/ftrace.c would operate on mcount() pointer
      the following may be generated:
      
      00000230 <prealloc_fixed_plts>:
       230:   b5f8            push    {r3, r4, r5, r6, r7, lr}
       232:   b500            push    {lr}
       234:   f7ff fffe       bl      0 <__gnu_mcount_nc>
                              234: R_ARM_THM_CALL     __gnu_mcount_nc
       238:   f240 0600       movw    r6, #0
                              238: R_ARM_THM_MOVW_ABS_NC      __gnu_mcount_nc
       23c:   f8d0 1180       ldr.w   r1, [r0, #384]  ; 0x180
      
      FTRACE currently is not able to deal with it:
      
      WARNING: CPU: 0 PID: 0 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1ad/0x230()
      ...
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.116-... #1
      ...
      [<c0314e3d>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
      [<c03115e9>] (show_stack) from [<c051a7f1>] (dump_stack+0x81/0xa8)
      [<c051a7f1>] (dump_stack) from [<c0321c5d>] (warn_slowpath_common+0x69/0x90)
      [<c0321c5d>] (warn_slowpath_common) from [<c0321cf3>] (warn_slowpath_null+0x17/0x1c)
      [<c0321cf3>] (warn_slowpath_null) from [<c038ee9d>] (ftrace_bug+0x1ad/0x230)
      [<c038ee9d>] (ftrace_bug) from [<c038f1f9>] (ftrace_process_locs+0x27d/0x444)
      [<c038f1f9>] (ftrace_process_locs) from [<c08915bd>] (ftrace_init+0x91/0xe8)
      [<c08915bd>] (ftrace_init) from [<c0885a67>] (start_kernel+0x34b/0x358)
      [<c0885a67>] (start_kernel) from [<00308095>] (0x308095)
      ---[ end trace cb88537fdc8fa200 ]---
      ftrace failed to modify [<c031266c>] prealloc_fixed_plts+0x8/0x60
       actual: 44:f2:e1:36
      ftrace record flags: 0
       (0)   expected tramp: c03143e9
      
      Scenario 2, ARMv4T
      ==================
      
      ftrace: allocating 14435 entries in 43 pages
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 0 at kernel/trace/ftrace.c:2029 ftrace_bug+0x204/0x310
      CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.5 #1
      Hardware name: Cirrus Logic EDB9302 Evaluation Board
      [<c0010a24>] (unwind_backtrace) from [<c000ecb0>] (show_stack+0x20/0x2c)
      [<c000ecb0>] (show_stack) from [<c03c72e8>] (dump_stack+0x20/0x30)
      [<c03c72e8>] (dump_stack) from [<c0021c18>] (__warn+0xdc/0x104)
      [<c0021c18>] (__warn) from [<c0021d7c>] (warn_slowpath_null+0x4c/0x5c)
      [<c0021d7c>] (warn_slowpath_null) from [<c0095360>] (ftrace_bug+0x204/0x310)
      [<c0095360>] (ftrace_bug) from [<c04dabac>] (ftrace_init+0x3b4/0x4d4)
      [<c04dabac>] (ftrace_init) from [<c04cef4c>] (start_kernel+0x20c/0x410)
      [<c04cef4c>] (start_kernel) from [<00000000>] (  (null))
      ---[ end trace 0506a2f5dae6b341 ]---
      ftrace failed to modify
      [<c000c350>] perf_trace_sys_exit+0x5c/0xe8
       actual:   1e:ff:2f:e1
      Initializing ftrace call sites
      ftrace record flags: 0
       (0)
       expected tramp: c000fb24
      
      The analysis for this problem has been already performed previously,
      refer to the link below.
      
      Fix the above problems by allowing only selected reloc types in
      __mcount_loc. The list itself comes from the legacy recordmcount.pl
      script.
      
      Link: https://lore.kernel.org/lkml/56961010.6000806@pengutronix.de/
      Cc: stable@vger.kernel.org
      Fixes: ed60453f ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount")
      Signed-off-by: NAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      927d780e
  9. 16 1月, 2020 1 次提交
  10. 15 1月, 2020 3 次提交
  11. 14 1月, 2020 2 次提交
  12. 10 1月, 2020 1 次提交
    • B
      kconfig: fix an "implicit declaration of function" warning · ba82f52e
      Bartosz Golaszewski 提交于
      strncasecmp() & strcasecmp() functions are declared in strings.h, not
      string.h. On most environments the former is implicitly included by
      the latter but on some setups, building menuconfig results in the
      following warning:
      
        HOSTCC  scripts/kconfig/mconf.o
      scripts/kconfig/mconf.c: In function ‘search_conf’:
      scripts/kconfig/mconf.c:423:6: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
        if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
            ^~~~~~~~~~~
      scripts/kconfig/mconf.c: In function ‘main’:
      scripts/kconfig/mconf.c:1021:8: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
         if (!strcasecmp(mode, "single_menu"))
              ^~~~~~~~~~
      
      Fix it by explicitly including strings.h.
      Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      ba82f52e
  13. 07 1月, 2020 16 次提交
    • T
      kconfig: fix nesting of symbol help text · a9609686
      Thomas Hebb 提交于
      When we generate the help text of a symbol (e.g. when a user presses '?'
      in menuconfig), we do two things:
      
       1. We iterate through every prompt that belongs to that symbol,
          printing its text and its location in the menu tree.
       2. We print symbol-wide information that's not linked to a particular
          prompt, such as what it selects/is selected by and what it
          implies/is implied by.
      
      Each prompt we print for 1 starts with a line that's not indented
      indicating where the prompt is defined, then continues with indented
      lines that describe properties of that particular definition.
      
      Once we get to 2, however, we print all the global data indented as
      well! Visually, this makes it look like the symbol-wide data is
      associated with the last prompt we happened to print rather than
      the symbol as a whole.
      
      Fix this by removing the indentation for symbol-wide information.
      
      Before:
      
        Symbol: CPU_FREQ [=n]
        Type  : bool
        Defined at drivers/cpufreq/Kconfig:4
          Prompt: CPU Frequency scaling
          Location:
            -> CPU Power Management
              -> CPU Frequency scaling
          Selects: SRCU [=n]
          Selected by [n]:
          - ARCH_SA1100 [=n] && <choice>
      
      After:
      
        Symbol: CPU_FREQ [=n]
        Type  : bool
        Defined at drivers/cpufreq/Kconfig:4
          Prompt: CPU Frequency scaling
          Location:
            -> CPU Power Management
              -> CPU Frequency scaling
        Selects: SRCU [=n]
        Selected by [n]:
          - ARCH_SA1100 [=n] && <choice>
      Signed-off-by: NThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a9609686
    • T
      kconfig: distinguish between dependencies and visibility in help text · 3460d0bc
      Thomas Hebb 提交于
      Kconfig makes a distinction between dependencies (defined by "depends
      on" expressions and enclosing "if" blocks) and visibility (which
      includes all dependencies, but also includes inline "if" expressions of
      individual properties as well as, for prompts, "visible if" expressions
      of enclosing menus).
      
      Before commit bcdedcc1 ("menuconfig: print more info for symbol
      without prompts"), the "Depends on" lines of a symbol's help text
      indicated the visibility of the prompt property they appeared under.
      After bcdedcc1, there was always only a single "Depends on" line,
      which indicated the visibility of the first P_SYMBOL property of the
      symbol. Since P_SYMBOLs never have inline if expressions, this was in
      effect the same as the dependencies of the menu item that the P_SYMBOL
      was attached to.
      
      Neither of these situations accurately conveyed the dependencies of a
      symbol--the first because it was actually the visibility, and the second
      because it only showed the dependencies from a single definition.
      
      With this series, we are back to printing separate dependencies for each
      definition, but we print the actual dependencies (rather than the
      visibility) in the "Depends on" line. However, it can still be useful to
      know the visibility of a prompt, so this patch adds a "Visible if" line
      that shows the visibility only if the visibility is different from the
      dependencies (which it isn't for most prompts in Linux).
      
      Before:
      
        Symbol: THUMB2_KERNEL [=n]
        Type  : bool
        Defined at arch/arm/Kconfig:1417
          Prompt: Compile the kernel in Thumb-2 mode
          Depends on: (CPU_V7 [=y] || CPU_V7M [=n]) && !CPU_V6 [=n] && !CPU_V6K [=n]
          Location:
            -> Kernel Features
          Selects: ARM_UNWIND [=n]
      
      After:
      
         Symbol: THUMB2_KERNEL [=n]
         Type  : bool
         Defined at arch/arm/Kconfig:1417
           Prompt: Compile the kernel in Thumb-2 mode
           Depends on: (CPU_V7 [=y] || CPU_V7M [=n]) && !CPU_V6 [=n] && !CPU_V6K [=n]
           Visible if: (CPU_V7 [=y] || CPU_V7M [=n]) && !CPU_V6 [=n] && !CPU_V6K [=n] && !CPU_THUMBONLY [=n]
           Location:
             -> Kernel Features
           Selects: ARM_UNWIND [=n]
      Signed-off-by: NThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      3460d0bc
    • T
      kconfig: list all definitions of a symbol in help text · edda15f2
      Thomas Hebb 提交于
      In Kconfig, each symbol (representing a config option) can be defined in
      multiple places. Each definition may or may not have a prompt, which
      allows the option to be set via an interface like menuconfig. Each
      definition has a set of dependencies, which determine whether its prompt
      is visible and whether other pieces of the definition, like a default
      value, take effect.
      
      Historically, a symbol's help text (i.e. what's shown when a user
      presses '?' in menuconfig) contained some symbol-wide information not
      tied to any particular definition (e.g. what other symbols it selects)
      as well as the location (file name and line number) and dependencies of
      each prompt. Notably, the help text did not show the location or
      dependencies of definitions without prompts.
      
      Because this made it hard to reason about symbols that had no prompts,
      commit bcdedcc1 ("menuconfig: print more info for symbol without
      prompts") changed the help text so that, instead of containing the
      location and dependencies of each prompt, it contained the location and
      dependencies of the symbol's first definition, regardless of whether or
      not that definition had a prompt.
      
      For symbols with only one definition, that change makes sense. However,
      it breaks down for symbols with multiple definitions: each definition
      has its own set of dependencies (the `dep` field of `struct menu`), and
      those dependencies are ORed together to get the symbol's dependency list
      (the `dir_dep` field of `struct symbol`). By printing only the
      dependencies of the first definition, the help text misleads users into
      believing that an option is more narrowly-applicable than it actually
      is.
      
      For an extreme example of this, we can look at the SYS_TEXT_BASE symbol
      in the Das U-Boot project (version 2019.10), which also uses Kconfig. (I
      unfortunately could not find an illustrative example in Linux.) This
      config option specifies the load address of the built binary and, as
      such, is applicable to basically every configuration possible. And yet,
      without this patch, its help text is as follows:
      
        Symbol: SYS_TEXT_BASE [=]
        Type  : hex
        Prompt: U-Boot base address
          Location:
            -> ARM architecture
        Prompt: Text Base
          Location:
            -> Boot images
          Defined at arch/arm/mach-aspeed/Kconfig:9
          Depends on: ARM [=n] && ARCH_ASPEED [=n]
      
      The help text indicates that the option is applicable only for a
      specific unselected architecture (aspeed), because that architecture's
      promptless definition (which just sets a default value), happens to be
      the first one seen. No definition or dependency information is printed
      for either of the two prompts listed.
      
      Because source locations and dependencies are fundamentally properties
      of definitions and not of symbols, we should treat them as such. This
      patch brings back the pre-bcdedcc1 behavior for definitions with
      prompts but also separately prints the location and dependencies of
      those without prompts, solving the original problem in a different way.
      With this change, our SYS_TEXT_BASE example becomes
      
         Symbol: SYS_TEXT_BASE [=]
         Type  : hex
         Defined at arch/arm/mach-stm32mp/Kconfig:83
           Prompt: U-Boot base address
           Depends on: ARM [=n] && ARCH_STM32MP [=n]
           Location:
             -> ARM architecture
         Defined at Kconfig:532
           Prompt: Text Base
           Depends on: !NIOS2 [=n] && !XTENSA [=n] && !EFI_APP [=n]
           Location:
             -> Boot images
         Defined at arch/arm/mach-aspeed/Kconfig:9
           Depends on: ARM [=n] && ARCH_ASPEED [=n]
         Defined  at arch/arm/mach-socfpga/Kconfig:25
           Depends on: ARM [=n] && ARCH_SOCFPGA [=n]
         <snip>
         Defined at board/sifive/fu540/Kconfig:15
           Depends on: RISCV [=n] && TARGET_SIFIVE_FU540 [=n]
      
      which is a much more accurate representation.
      
      Note that there is one notable difference between what gets printed for
      prompts after this change and what got printed before bcdedcc1: the
      "Depends on" line now accurately represents the prompt's dependencies
      instead of conflating those with the prompt's visibility (which can
      include extra conditions). See the patch later in this series titled
      "kconfig: distinguish between dependencies and visibility in help text"
      for more details and better handling of that nuance.
      Signed-off-by: NThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      edda15f2
    • T
      kconfig: Add yes2modconfig and mod2yesconfig targets. · 89b90609
      Tetsuo Handa 提交于
      Since kernel configs provided by syzbot are close to "make allyesconfig",
      it takes long time to rebuild. This is especially waste of time when we
      need to rebuild for many times (e.g. doing manual printk() inspection,
      bisect operations).
      
      We can save time if we can exclude modules which are irrelevant to each
      problem. But "make localmodconfig" cannot exclude modules which are built
      into vmlinux because /sbin/lsmod output is used as the source of modules.
      
      Therefore, this patch adds "make yes2modconfig" which converts from =y
      to =m if possible. After confirming that the interested problem is still
      reproducible, we can try "make localmodconfig" (and/or manually tune
      based on "Modules linked in:" line) in order to exclude modules which are
      irrelevant to the interested problem. While we are at it, this patch also
      adds "make mod2yesconfig" which converts from =m to =y in case someone
      wants to convert from =m to =y after "make localmodconfig".
      Signed-off-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      89b90609
    • M
      kconfig: use $(PERL) in Makefile · c8138a57
      Masahiro Yamada 提交于
      The top Makefile defines and exports the variable 'PERL'. Use it in
      case somebody wants to specify a particular version of perl from the
      command line.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      c8138a57
    • M
      kconfig: fix too deep indentation in Makefile · 1d135237
      Masahiro Yamada 提交于
      The indentation for if ... else ... fi is too deep. Fix it.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      1d135237
    • M
      kconfig: localmodconfig: fix indentation for closing brace · 68f0d627
      Masahiro Yamada 提交于
      This is the closing brace for the foreach loop. Fix the misleading
      indentation.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      68f0d627
    • M
      kconfig: localmodconfig: remove unused $config · 5edcef84
      Masahiro Yamada 提交于
      This is unused since commit cdfc4795 ("kconfig: search for a config
      to base the local(mod|yes)config on").
      
      Having unused $config is confusing because $config is used as a local
      variable in various sub-routines.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5edcef84
    • M
      kconfig: squash prop_alloc() into menu_add_prop() · adf7c5bd
      Masahiro Yamada 提交于
      prop_alloc() is only called from menu_add_prop(). Squash it.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      adf7c5bd
    • M
      kconfig: remove sym from struct property · 6397d96b
      Masahiro Yamada 提交于
      struct property can reference to the symbol that it is associated with
      by prop->menu->sym.
      
      Fix up the one usage of prop->sym, and remove sym from struct property.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      6397d96b
    • M
      kconfig: remove 'prompt' argument from menu_add_prop() · 2ffeef61
      Masahiro Yamada 提交于
      This function no longer uses the 'prompt' argument.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      2ffeef61
    • M
      kconfig: move prompt handling to menu_add_prompt() from menu_add_prop() · 024352ff
      Masahiro Yamada 提交于
      menu_add_prompt() is the only function that calls menu_add_prop() with
      non-NULL prompt.
      
      So, the code inside the if-conditional block of menu_add_prop() can be
      moved to menu_add_prompt().
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      024352ff
    • M
      kconfig: remove 'prompt' symbol · 1be6e791
      Masahiro Yamada 提交于
      Now that 'prompt' is only reduced from T_WORD_QUOTE without any action,
      use T_WORD_QUOTE directly.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      1be6e791
    • M
      kconfig: drop T_WORD from the RHS of 'prompt' symbol · 801b27db
      Masahiro Yamada 提交于
      Commit 8636a1f9 ("treewide: surround Kconfig file paths with double
      quotes") killed use-cases to reduce an unquoted string into the 'prompt'
      symbol.
      
      Kconfig still allows to use an unquoted string in the context of menu,
      source, or prompt.
      
      So, you can omit quoting if the prompt is a single word:
      
          bool foo
      
      ..., but I do not think this is so useful.
      
      Let's require quoting:
      
          bool "foo"
      
      All the Kconfig files in the kernel are written in this way.
      
      Remove the T_WORD from the right-hand side of the symbol 'prompt'.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      801b27db
    • M
      kconfig: use parent->dep as the parentdep of 'menu' · de026ca9
      Masahiro Yamada 提交于
      In menu_finalize(), the dependency of a menu entry is propagated
      downwards.
      
      For the 'menu', parent->dep and parent->prompt->visible.expr have
      the same expression. Both accumulate the 'depends on' of itself and
      upper menu entries.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      de026ca9
    • M
      kconfig: remove the rootmenu check in menu_add_prop() · f64048a2
      Masahiro Yamada 提交于
      This reverts commit ba6ff60d ("kconfig: don't emit warning upon
      rootmenu's prompt redefinition").
      
      At that time, rootmenu.prompt was always set first, then it was set
      again if a "mainmenu" statement was specified in the Kconfig file.
      
      This is no longer the case since commit 0724a7c3 ("kconfig: Don't
      leak main menus during parsing"). Remove the unneeded check.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      f64048a2