1. 06 Jan, 2020 16 commits
    • Thomas Hebb's avatar
      kconfig: fix nesting of symbol help text · a9609686
      Thomas Hebb authored
      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: default avatarThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      a9609686
    • Thomas Hebb's avatar
      kconfig: distinguish between dependencies and visibility in help text · 3460d0bc
      Thomas Hebb authored
      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: default avatarThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      3460d0bc
    • Thomas Hebb's avatar
      kconfig: list all definitions of a symbol in help text · edda15f2
      Thomas Hebb authored
      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: default avatarThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      edda15f2
    • Tetsuo Handa's avatar
      kconfig: Add yes2modconfig and mod2yesconfig targets. · 89b90609
      Tetsuo Handa authored
      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: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      89b90609
    • Masahiro Yamada's avatar
      kconfig: use $(PERL) in Makefile · c8138a57
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c8138a57
    • Masahiro Yamada's avatar
      kconfig: fix too deep indentation in Makefile · 1d135237
      Masahiro Yamada authored
      The indentation for if ... else ... fi is too deep. Fix it.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      1d135237
    • Masahiro Yamada's avatar
      kconfig: localmodconfig: fix indentation for closing brace · 68f0d627
      Masahiro Yamada authored
      This is the closing brace for the foreach loop. Fix the misleading
      indentation.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      68f0d627
    • Masahiro Yamada's avatar
      kconfig: localmodconfig: remove unused $config · 5edcef84
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5edcef84
    • Masahiro Yamada's avatar
      kconfig: squash prop_alloc() into menu_add_prop() · adf7c5bd
      Masahiro Yamada authored
      prop_alloc() is only called from menu_add_prop(). Squash it.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      adf7c5bd
    • Masahiro Yamada's avatar
      kconfig: remove sym from struct property · 6397d96b
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      6397d96b
    • Masahiro Yamada's avatar
      kconfig: remove 'prompt' argument from menu_add_prop() · 2ffeef61
      Masahiro Yamada authored
      This function no longer uses the 'prompt' argument.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      2ffeef61
    • Masahiro Yamada's avatar
      kconfig: move prompt handling to menu_add_prompt() from menu_add_prop() · 024352ff
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      024352ff
    • Masahiro Yamada's avatar
      kconfig: remove 'prompt' symbol · 1be6e791
      Masahiro Yamada authored
      Now that 'prompt' is only reduced from T_WORD_QUOTE without any action,
      use T_WORD_QUOTE directly.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      1be6e791
    • Masahiro Yamada's avatar
      kconfig: drop T_WORD from the RHS of 'prompt' symbol · 801b27db
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      801b27db
    • Masahiro Yamada's avatar
      kconfig: use parent->dep as the parentdep of 'menu' · de026ca9
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      de026ca9
    • Masahiro Yamada's avatar
      kconfig: remove the rootmenu check in menu_add_prop() · f64048a2
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f64048a2
  2. 05 Jan, 2020 7 commits
    • Linus Torvalds's avatar
      Linux 5.5-rc5 · c79f46a2
      Linus Torvalds authored
      c79f46a2
    • Linus Torvalds's avatar
      Merge tag 'riscv/for-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 768fc661
      Linus Torvalds authored
      Pull RISC-V fixes from Paul Walmsley:
       "Several fixes for RISC-V:
      
         - Fix function graph trace support
      
         - Prefix the CSR IRQ_* macro names with "RV_", to avoid collisions
           with macros elsewhere in the Linux kernel tree named "IRQ_TIMER"
      
         - Use __pa_symbol() when computing the physical address of a kernel
           symbol, rather than __pa()
      
         - Mark the RISC-V port as supporting GCOV
      
        One DT addition:
      
         - Describe the L2 cache controller in the FU540 DT file
      
        One documentation update:
      
         - Add patch acceptance guideline documentation"
      
      * tag 'riscv/for-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        Documentation: riscv: add patch acceptance guidelines
        riscv: prefix IRQ_ macro names with an RV_ namespace
        clocksource: riscv: add notrace to riscv_sched_clock
        riscv: ftrace: correct the condition logic in function graph tracer
        riscv: dts: Add DT support for SiFive L2 cache controller
        riscv: gcov: enable gcov for RISC-V
        riscv: mm: use __pa_symbol for kernel symbols
      768fc661
    • Paul Walmsley's avatar
      Documentation: riscv: add patch acceptance guidelines · 0e194d9d
      Paul Walmsley authored
      Formalize, in kernel documentation, the patch acceptance policy for
      arch/riscv.  In summary, it states that as maintainers, we plan to
      only accept patches for new modules or extensions that have been
      frozen or ratified by the RISC-V Foundation.
      
      We've been following these guidelines for the past few months.  In the
      meantime, we've received quite a bit of feedback that it would be
      helpful to have these guidelines formally documented.
      
      Based on a suggestion from Matthew Wilcox, we also add a link to this
      file to Documentation/process/index.rst, to make this document easier
      to find.  The format of this document has also been changed to align
      to the format outlined in the maintainer entry profiles, in accordance
      with comments from Jon Corbet and Dan Williams.
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      Reviewed-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Krste Asanovic <krste@berkeley.edu>
      Cc: Andrew Waterman <waterman@eecs.berkeley.edu>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      0e194d9d
    • Paul Walmsley's avatar
      riscv: prefix IRQ_ macro names with an RV_ namespace · 2f3035da
      Paul Walmsley authored
      "IRQ_TIMER", used in the arch/riscv CSR header file, is a sufficiently
      generic macro name that it's used by several source files across the
      Linux code base.  Some of these other files ultimately include the
      arch/riscv CSR include file, causing collisions.  Fix by prefixing the
      RISC-V csr.h IRQ_ macro names with an RV_ prefix.
      
      Fixes: a4c3733d ("riscv: abstract out CSR names for supervisor vs machine mode")
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Acked-by: default avatarOlof Johansson <olof@lixom.net>
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      2f3035da
    • Zong Li's avatar
      clocksource: riscv: add notrace to riscv_sched_clock · 9d05c18e
      Zong Li authored
      When enabling ftrace graph tracer, it gets the tracing clock in
      ftrace_push_return_trace().  Eventually, it invokes riscv_sched_clock()
      to get the clock value.  If riscv_sched_clock() isn't marked with
      'notrace', it will call ftrace_push_return_trace() and cause infinite
      loop.
      
      The result of failure as follow:
      
      command: echo function_graph >current_tracer
      [   46.176787] Unable to handle kernel paging request at virtual address ffffffe04fb38c48
      [   46.177309] Oops [#1]
      [   46.177478] Modules linked in:
      [   46.177770] CPU: 0 PID: 256 Comm: $d Not tainted 5.5.0-rc1 #47
      [   46.177981] epc: ffffffe00035e59a ra : ffffffe00035e57e sp : ffffffe03a7569b0
      [   46.178216]  gp : ffffffe000d29b90 tp : ffffffe03a756180 t0 : ffffffe03a756968
      [   46.178430]  t1 : ffffffe00087f408 t2 : ffffffe03a7569a0 s0 : ffffffe03a7569f0
      [   46.178643]  s1 : ffffffe00087f408 a0 : 0000000ac054cda4 a1 : 000000000087f411
      [   46.178856]  a2 : 0000000ac054cda4 a3 : 0000000000373ca0 a4 : ffffffe04fb38c48
      [   46.179099]  a5 : 00000000153e22a8 a6 : 00000000005522ff a7 : 0000000000000005
      [   46.179338]  s2 : ffffffe03a756a90 s3 : ffffffe00032811c s4 : ffffffe03a756a58
      [   46.179570]  s5 : ffffffe000d29fe0 s6 : 0000000000000001 s7 : 0000000000000003
      [   46.179809]  s8 : 0000000000000003 s9 : 0000000000000002 s10: 0000000000000004
      [   46.180053]  s11: 0000000000000000 t3 : 0000003fc815749c t4 : 00000000000efc90
      [   46.180293]  t5 : ffffffe000d29658 t6 : 0000000000040000
      [   46.180482] status: 0000000000000100 badaddr: ffffffe04fb38c48 cause: 000000000000000f
      Signed-off-by: default avatarZong Li <zong.li@sifive.com>
      Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      [paul.walmsley@sifive.com: cleaned up patch description]
      Fixes: 92e0d143 ("clocksource/drivers/riscv_timer: Provide the sched_clock")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      9d05c18e
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 36487907
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "17 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        hexagon: define ioremap_uc
        ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less
        ocfs2: call journal flush to mark journal as empty after journal recovery when mount
        mm/hugetlb: defer freeing of huge pages if in non-task context
        mm/gup: fix memory leak in __gup_benchmark_ioctl
        mm/oom: fix pgtables units mismatch in Killed process message
        fs/posix_acl.c: fix kernel-doc warnings
        hexagon: work around compiler crash
        hexagon: parenthesize registers in asm predicates
        fs/namespace.c: make to_mnt_ns() static
        fs/nsfs.c: include headers for missing declarations
        fs/direct-io.c: include fs/internal.h for missing prototype
        mm: move_pages: return valid node id in status if the page is already on the target node
        memcg: account security cred as well to kmemcg
        kcov: fix struct layout for kcov_remote_arg
        mm/zsmalloc.c: fix the migrated zspage statistics.
        mm/memory_hotplug: shrink zones when offlining memory
      36487907
    • Linus Torvalds's avatar
      Merge tag 'apparmor-pr-2020-01-04' of... · a125bcda
      Linus Torvalds authored
      Merge tag 'apparmor-pr-2020-01-04' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
      
      Pull apparmor fixes from John Johansen:
      
       - performance regression: only get a label reference if the fast path
         check fails
      
       - fix aa_xattrs_match() may sleep while holding a RCU lock
      
       - fix bind mounts aborting with -ENOMEM
      
      * tag 'apparmor-pr-2020-01-04' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor:
        apparmor: fix aa_xattrs_match() may sleep while holding a RCU lock
        apparmor: only get a label reference if the fast path check fails
        apparmor: fix bind mounts aborting with -ENOMEM
      a125bcda
  3. 04 Jan, 2020 17 commits