1. 17 7月, 2019 1 次提交
  2. 14 7月, 2019 1 次提交
    • K
      *: convert stream-like files -> stream_open, even if they use noop_llseek · 3975b097
      Kirill Smelkov 提交于
      This patch continues 10dce8af (fs: stream_open - opener for
      stream-like files so that read and write can run simultaneously without
      deadlock) and c5bf68fe (*: convert stream-like files from
      nonseekable_open -> stream_open) and teaches steam_open.cocci to
      consider files as being stream-like not only if they have
      .llseek=no_llseek, but also if they have .llseek=noop_llseek.
      
      This is safe to do: the comment about noop_llseek says
      
      	This is an implementation of ->llseek useable for the rare special case when
      	userspace expects the seek to succeed but the (device) file is actually not
      	able to perform the seek. In this case you use noop_llseek() instead of
      	falling back to the default implementation of ->llseek.
      
      and in general noop_llseek was massively added to drivers in 6038f373
      (llseek: automatically add .llseek fop) when changing default for NULL .llseek
      from NOP to no_llseek with the idea to avoid breaking compatibility, if
      maybe some user-space program was using lseek on a device without caring
      about the result, but caring if it was an error or not.
      
      Amended semantic patch produces two changes when applied tree-wide:
      
              drivers/hid/hid-sensor-custom.c:690:8-24: WARNING: hid_sensor_custom_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
              drivers/input/mousedev.c:564:1-17: ERROR: mousedev_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
      
      Cc: Julia Lawall <Julia.Lawall@lip6.fr>
      Cc: Jan Blunck <jblunck@suse.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NKirill Smelkov <kirr@nexedi.com>
      3975b097
  3. 13 7月, 2019 6 次提交
  4. 11 7月, 2019 2 次提交
    • M
      kconfig: remove meaningless if-conditional in conf_read() · e3cd5136
      Masahiro Yamada 提交于
      sym_is_choice(sym) has already been checked by previous if-block:
      
          if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
                  continue;
      
      Hence, the following code is redundant, and the comment is misleading:
      
          if (!sym_is_choice(sym))
                  continue;
          /* fall through */
      
      It always takes 'continue', never falls though.
      
      Clean up the dead code.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      e3cd5136
    • M
      kbuild: use -- separater intead of $(filter-out ...) for cc-cross-prefix · d4a74bbf
      Masahiro Yamada 提交于
      arch/mips/Makefile passes prefixes that start with '-' to cc-cross-prefix
      when $(tool-archpref) evaluates to the empty string.
      
      They are filtered-out before the $(shell ...) invocation. Otherwise,
      'command -v' would be confused.
      
        $ command -v -linux-gcc
        bash: command: -l: invalid option
        command: usage: command [-pVv] command [arg ...]
      
      Since commit 913ab978 ("kbuild: use more portable 'command -v' for
      cc-cross-prefix"), cc-cross-prefix throws away the stderr output, so
      the console is not polluted in any way.
      
      This is not a big deal in practice, but I see a slightly better taste
      in adding '--' to teach it that '-linux-gcc' is an argument instead of
      a command option.
      
      This will cause extra forking of subshell, but it will not be noticeable
      performance regression.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      d4a74bbf
  5. 10 7月, 2019 3 次提交
    • H
      kbuild: fix compression errors getting ignored · b956c7a6
      Harald Seiler 提交于
      A missing compression utility or other errors were not picked up by make
      and an empty kernel image was produced.  By removing the &&, errors will
      no longer be ignored.
      Signed-off-by: NHarald Seiler <hws@denx.de>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      b956c7a6
    • M
      kbuild: add a flag to force absolute path for srctree · 95fd3f87
      Masahiro Yamada 提交于
      In old days, Kbuild always used an absolute path for $(srctree).
      
      Since commit 890676c6 ("kbuild: Use relative path when building in
      the source tree"), $(srctree) is '.' when O= was not passed from the
      command line.
      
      Yet, using absolute paths is useful in some cases even without O=, for
      instance, to create a cscope file with absolute path tags.
      
      'O=.' was known to work as a workaround to force Kbuild to use absolute
      paths even when you are building in the source tree.
      
      Since commit 25b146c5 ("kbuild: allow Kbuild to start from any
      directory"), Kbuild is too clever to be tricked. Even if you pass 'O=.'
      Kbuild notices you are building in the source tree, then use '.' for
      $(srctree).
      
      So, 'make O=. cscope' is no help to create absolute path tags.
      
      We cannot force one or the other according to commit e93bc1a0
      ("Revert "kbuild: specify absolute paths for cscope""). Both of
      relative path and absolute path have pros and cons.
      
      This commit adds a new flag KBUILD_ABS_SRCTREE to allow users to
      choose the absolute path for $(srctree).
      
      'make KBUILD_ABS_SRCTREE=1 cscope' will work as a replacement of
      'make O=. cscope'.
      Reported-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      95fd3f87
    • M
      kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree · 051f278e
      Masahiro Yamada 提交于
      Commit 25b146c5 ("kbuild: allow Kbuild to start from any directory")
      deprecated KBUILD_SRCTREE.
      
      It is only used in tools/testing/selftest/ to distinguish out-of-tree
      build. Replace it with a new boolean flag, building_out_of_srctree.
      
      I also replaced the conditional ($(srctree),.) because the next commit
      will allow an absolute path to be used for $(srctree) even when building
      in the source tree.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      051f278e
  6. 09 7月, 2019 4 次提交
    • M
      scripts/tags.sh: remove unused environment variables from comments · b3b3eb9d
      Masahiro Yamada 提交于
      This script has no reference to ${ARCH}, ${src}, ${obj}.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      b3b3eb9d
    • M
      scripts/tags.sh: drop SUBARCH support for ARM · d1db881d
      Masahiro Yamada 提交于
      Our goal is to have more and more sub-architectures to join the
      ARM multi-platform, and support them in a single configuration.
      
      Remove the ARM SUBARCH support because it is ugly.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      d1db881d
    • M
      kbuild: support header-test-pattern-y · 1e21cbfa
      Masahiro Yamada 提交于
      In my view, most of headers can be self-contained. So, it would be
      tedious to add every header to header-test-y explicitly. We usually
      end up with "all headers with some exceptions".
      
      There are two types in exceptions:
      
      [1] headers that are never compiled as standalone units
      
        For examples, include/linux/compiler-gcc.h is not intended for
        direct inclusion. We should always exclude such ones.
      
      [2] headers that are conditionally compiled as standalone units
      
        Some headers can be compiled only for particular architectures.
        For example, include/linux/arm-cci.h can be compiled only for
        arm/arm64 because it requires <asm/arm-cci.h> to exist.
        Clang can compile include/soc/nps/mtm.h only for arc because
        it contains an arch-specific register in inline assembler.
      
      So, you can write Makefile like this:
      
        header-test-                += linux/compiler-gcc.h
        header-test-$(CONFIG_ARM)   += linux/arm-cci.h
        header-test-$(CONFIG_ARM64) += linux/arm-cci.h
        header-test-$(CONFIG_ARC)   += soc/nps/mtm.h
      
      The new syntax header-test-pattern-y will be useful to specify
      "the rest".
      
      The typical usage is like this:
      
        header-test-pattern-y += */*.h
      
      This will add all the headers in sub-directories to the test coverage,
      excluding $(header-test-). In this regards, header-test-pattern-y
      behaves like a weaker variant of header-test-y.
      
      Caveat:
      The patterns in header-test-pattern-y are prefixed with $(srctree)/$(src)/
      but not $(objtree)/$(obj)/. Stale generated headers are often left over
      when you traverse the git history without cleaning. Wildcard patterns for
      $(objtree) may match to stale headers, which could fail to compile.
      One pitfall is $(srctree)/$(src)/ and $(objtree)/$(obj)/ point to the
      same directory for in-tree building. So, header-test-pattern-y should
      be used with care since it can potentially match to stale headers.
      
      Caveat2:
      You could use wildcard for header-test-. For example,
      
        header-test- += asm-generic/%
      
      ... will exclude headers in asm-generic directory. Unfortunately, the
      wildcard character is '%' instead of '*' here because this is evaluated
      by $(filter-out ...) whereas header-test-pattern-y is evaluated by
      $(wildcard ...). This is a kludge, but seems useful in some places...
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NJani Nikula <jani.nikula@intel.com>
      1e21cbfa
    • M
      kbuild: do not create wrappers for header-test-y · c93a0368
      Masahiro Yamada 提交于
      header-test-y does not work with headers in sub-directories.
      
      For example, you may want to write a Makefile, like this:
      
      include/linux/Kbuild:
      
        header-test-y += mtd/nand.h
      
      This entry will create a wrapper include/linux/mtd/nand.hdrtest.c
      with the following content:
      
        #include "mtd/nand.h"
      
      To make this work, we need to add $(srctree)/include/linux to the
      header search path. It would be tedious to add ccflags-y.
      
      Instead, we could change the *.hdrtest.c rule to wrap:
      
        #include "nand.h"
      
      This works for in-tree build since #include "..." searches in the
      relative path from the header with this directive. For O=... build,
      we need to add $(srctree)/include/linux/mtd to the header search path,
      which will be even more tedious.
      
      After all, I thought it would be handier to compile headers directly
      without creating wrappers.
      
      I added a new build rule to compile %.h into %.h.s
      
      The target is %.h.s instead of %.h.o because it is slightly faster.
      Also, as for GCC, an empty assembly is smaller than an empty object.
      
      I wrote the build rule:
      
        $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
      
      instead of:
      
        $(CC) $(c_flags) -S -o $@ -x c $<
      
      Both work fine with GCC, but the latter is bad for Clang.
      
      This comes down to the difference in the -Wunused-function policy.
      GCC does not warn about unused 'static inline' functions at all.
      Clang does not warn about the ones in included headers, but does
      about the ones in the source. So, we should handle headers as
      headers, not as source files.
      
      In fact, this has been hidden since commit abb2ea7d ("compiler,
      clang: suppress warning for unused static inline functions"), but we
      should not rely on that.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NJani Nikula <jani.nikula@intel.com>
      Tested-by: NJani Nikula <jani.nikula@intel.com>
      c93a0368
  7. 08 7月, 2019 5 次提交
  8. 06 7月, 2019 1 次提交
  9. 01 7月, 2019 5 次提交
    • N
      recordmcount: Fix spurious mcount entries on powerpc · 80e5302e
      Naveen N. Rao 提交于
      An impending change to enable HAVE_C_RECORDMCOUNT on powerpc leads to
      warnings such as the following:
      
        # modprobe kprobe_example
        ftrace-powerpc: Not expected bl: opcode is 3c4c0001
        WARNING: CPU: 0 PID: 227 at kernel/trace/ftrace.c:2001 ftrace_bug+0x90/0x318
        Modules linked in:
        CPU: 0 PID: 227 Comm: modprobe Not tainted 5.2.0-rc6-00678-g1c329100b942 #2
        NIP:  c000000000264318 LR: c00000000025d694 CTR: c000000000f5cd30
        REGS: c000000001f2b7b0 TRAP: 0700   Not tainted  (5.2.0-rc6-00678-g1c329100b942)
        MSR:  900000010282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE,TM[E]>  CR: 28228222  XER: 00000000
        CFAR: c0000000002642fc IRQMASK: 0
        <snip>
        NIP [c000000000264318] ftrace_bug+0x90/0x318
        LR [c00000000025d694] ftrace_process_locs+0x4f4/0x5e0
        Call Trace:
        [c000000001f2ba40] [0000000000000004] 0x4 (unreliable)
        [c000000001f2bad0] [c00000000025d694] ftrace_process_locs+0x4f4/0x5e0
        [c000000001f2bb90] [c00000000020ff10] load_module+0x25b0/0x30c0
        [c000000001f2bd00] [c000000000210cb0] sys_finit_module+0xc0/0x130
        [c000000001f2be20] [c00000000000bda4] system_call+0x5c/0x70
        Instruction dump:
        419e0018 2f83ffff 419e00bc 2f83ffea 409e00cc 4800001c 0fe00000 3c62ff96
        39000001 39400000 386386d0 480000c4 <0fe00000> 3ce20003 39000001 3c62ff96
        ---[ end trace 4c438d5cebf78381 ]---
        ftrace failed to modify
        [<c0080000012a0008>] 0xc0080000012a0008
         actual:   01:00:4c:3c
        Initializing ftrace call sites
        ftrace record flags: 2000000
         (0)
         expected tramp: c00000000006af4c
      
      Looking at the relocation records in __mcount_loc shows a few spurious
      entries:
      
        RELOCATION RECORDS FOR [__mcount_loc]:
        OFFSET           TYPE              VALUE
        0000000000000000 R_PPC64_ADDR64    .text.unlikely+0x0000000000000008
        0000000000000008 R_PPC64_ADDR64    .text.unlikely+0x0000000000000014
        0000000000000010 R_PPC64_ADDR64    .text.unlikely+0x0000000000000060
        0000000000000018 R_PPC64_ADDR64    .text.unlikely+0x00000000000000b4
        0000000000000020 R_PPC64_ADDR64    .init.text+0x0000000000000008
        0000000000000028 R_PPC64_ADDR64    .init.text+0x0000000000000014
      
      The first entry in each section is incorrect. Looking at the
      relocation records, the spurious entries correspond to the
      R_PPC64_ENTRY records:
      
        RELOCATION RECORDS FOR [.text.unlikely]:
        OFFSET           TYPE              VALUE
        0000000000000000 R_PPC64_REL64     .TOC.-0x0000000000000008
        0000000000000008 R_PPC64_ENTRY     *ABS*
        0000000000000014 R_PPC64_REL24     _mcount
        <snip>
      
      The problem is that we are not validating the return value from
      get_mcountsym() in sift_rel_mcount(). With this entry, mcountsym is 0,
      but Elf_r_sym(relp) also ends up being 0. Fix this by ensuring
      mcountsym is valid before processing the entry.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Tested-by: NSatheesh Rajendran <sathnaga@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      80e5302e
    • M
      fixdep: check return value of printf() and putchar() · 6f9ac9f4
      Masahiro Yamada 提交于
      When there is not enough space on your storage device, the build will
      fail with 'No space left on device' error message.
      
      The reason is obvious from the message, so you will free up some disk
      space, then you will resume the build.
      
      However, sometimes you may still see a mysterious error message:
      
        unterminated call to function 'wildcard': missing ')'.
      
      If you run out of the disk space, fixdep may end up with generating
      incomplete .*.cmd files.
      
      For example, if the disk-full error occurs while fixdep is running
      print_dep(), the .*.cmd might be truncated like this:
      
         $(wildcard include/config/
      
      When you run 'make' next time, this broken .*.cmd will be included,
      then Make will terminate parsing since it is a wrong syntax.
      
      Once this happens, you need to run 'make clean' or delete the broken
      .*.cmd file manually.
      
      Even if you do not see any error message, the .*.cmd files after any
      error could be potentially incomplete, and unreliable. You may miss
      the re-compilation due to missing header dependency.
      
      If printf() cannot output the string for disk shortage or whatever
      reason, it returns a negative value, but currently fixdep does not
      check it at all. Consequently, fixdep *successfully* generates a
      broken .*.cmd file. Make never notices that since fixdep exits with 0,
      which means success.
      
      Given the intended usage of fixdep, it must respect the return value
      of not only malloc(), but also printf() and putchar().
      
      This seems a long-standing issue since the introduction of fixdep.
      
      In old days, Kbuild tried to provide an extra safety by letting fixdep
      output to a temporary file and renaming it after everything is done:
      
        scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\
        rm -f $(depfile);                                                    \
        mv -f $(dot-target).tmp $(dot-target).cmd)
      
      It was no help to avoid the current issue; fixdep successfully created
      a truncated tmp file, which would be renamed to a .*.cmd file.
      
      This problem should be fixed by propagating the error status to the
      build system because:
      
      [1] Since commit 9c2af1c7 ("kbuild: add .DELETE_ON_ERROR special
          target"), Make will delete the target automatically on any failure
          in the recipe.
      
      [2] Since commit 392885ee ("kbuild: let fixdep directly write to
          .*.cmd files"), .*.cmd file is included only when the corresponding
          target already exists.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      6f9ac9f4
    • M
      kbuild: save $(strip ...) for calling if_changed and friends · c2341e2a
      Masahiro Yamada 提交于
      The string returned by $(filter-out ...) does not contain any leading
      or trailing spaces.
      
      With the previous commit, 'any-prereq' no longer contains any
      excessive spaces.
      
      Nor does 'cmd-check' since it expands to a $(filter-out ...) call.
      
      So, only the space that matters is the one between 'any-prereq'
      and 'cmd-check'.
      
      By removing it from the code, we can save $(strip ...) evaluation.
      This refactoring is possible because $(any-prereq)$(cmd-check) is only
      passed to the first argument of $(if ...), so we are only interested
      in whether or not it is empty.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      c2341e2a
    • M
      kbuild: save $(strip ...) for calling any-prepreq · 93f31bbd
      Masahiro Yamada 提交于
      The string returned by $(filter-out ...) does not contain any leading
      or trailing spaces.
      
      So, only the space that matters is the one between
      
        $(filter-out $(PHONY),$?)
      
      and
      
        $(filter-out $(PHONY) $(wildcard $^),$^)
      
      By removing it from the code, we can save $(strip ...) evaluation.
      This refactoring is possible because $(any-prereq) is only passed to
      the first argument of $(if ...), so we are only interested in whether
      or not it is empty.
      
      This is also the prerequisite for the next commit.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      93f31bbd
    • M
      kbuild: rename arg-check to cmd-check · 50bcca6a
      Masahiro Yamada 提交于
      I prefer 'cmd-check' for consistency.
      
      We have 'echo-cmd', 'cmd', 'cmd_and_fixdep', etc. in this file.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      50bcca6a
  10. 27 6月, 2019 2 次提交
    • M
      scripts/sphinx-pre-install: fix out-of-tree build · 8c69b77a
      Mike Rapoport 提交于
      Build of htmldocs fails for out-of-tree builds:
      
      $ make V=1 O=~/build/kernel/ htmldocs
      make -C /home/rppt/build/kernel -f /home/rppt/git/linux-docs/Makefile htmldocs
      make[1]: Entering directory '/home/rppt/build/kernel'
      make -f /home/rppt/git/linux-docs/scripts/Makefile.build obj=scripts/basic
      rm -f .tmp_quiet_recordmcount
      make -f /home/rppt/git/linux-docs/scripts/Makefile.build obj=Documentation htmldocs
      Can't open Documentation/conf.py at /home/rppt/git/linux-docs/scripts/sphinx-pre-install line 230.
      /home/rppt/git/linux-docs/Documentation/Makefile:80: recipe for target 'htmldocs' failed
      make[2]: *** [htmldocs] Error 2
      
      The scripts/sphinx-pre-install is trying to open files in the current
      directory which is $KBUILD_OUTPUT rather than in $srctree.
      
      Fix it.
      Signed-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Reviewed-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      8c69b77a
    • J
      kernel-doc: Don't try to mark up function names · 344fdb28
      Jonathan Corbet 提交于
      We now have better automarkup in sphinx itself and, besides, this markup
      was incorrect and left :c:func: gunk in the processed docs.  Sort of
      discouraging that nobody ever noticed...:)
      
      As a first step toward the removal of impenetrable regex magic from
      kernel-doc it's a tiny one, but you have to start somewhere.
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      344fdb28
  11. 25 6月, 2019 1 次提交
  12. 24 6月, 2019 4 次提交
  13. 22 6月, 2019 1 次提交
    • R
      scripts/dtc: Update to upstream version v1.5.0-30-g702c1b6c0e73 · 12869ecd
      Rob Herring 提交于
      Pull in SPDX tag conversion from upstream dtc. This will replace the
      conversion done in the kernel tree copy in v5.2-rc2.
      
      This adds the following commits from upstream:
      
      702c1b6c0e73 README.license: Update to reflect SPDX tag usage
      4097bbffcf1d dtc: Add GPLv2 SPDX tags to files missing license text
      94f87cd5b7c5 libfdt: Add dual GPL/BSD SPDX tags to files missing license text
      c4ffc05574b1 tests: Replace license boilerplate with SPDX tags
      a5ac29baacd2 pylibfdt: Replace dual GPLv2/BSD license boilerplate with SPDX tags
      7fb0f4db2eb7 libfdt: Replace GPL/BSD boilerplate/reference with SPDX tags
      acfe84f2c47e dtc: Replace GPLv2 boilerplate/reference with SPDX tags
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      12869ecd
  14. 21 6月, 2019 4 次提交