1. 08 7月, 2019 5 次提交
  2. 04 7月, 2019 1 次提交
  3. 01 7月, 2019 6 次提交
    • 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: split modules.order build rule out of 'modules' target · 68980b47
      Masahiro Yamada 提交于
      modules.order is a real target. Split its build rule out like
      modules.builtin
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      68980b47
    • M
      kbuild: fix missed rebuild of modules.builtin · 50ef0cdf
      Masahiro Yamada 提交于
      Unlike modules.order, modules.builtin is not rebuilt every time.
      Once modules.builtin is created, it will not be updated until
      auto.conf or tristate.conf is changed.
      
      So, it does not  notice a change in Makefile, for example, the rename
      of modules.
      
      Kbuild must always descend into directories for modules.builtin too.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      50ef0cdf
    • 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
  4. 24 6月, 2019 7 次提交
  5. 15 6月, 2019 13 次提交
    • J
      kbuild: add support for ensuring headers are self-contained · e846f0dc
      Jani Nikula 提交于
      Sometimes it's useful to be able to explicitly ensure certain headers
      remain self-contained, i.e. that they are compilable as standalone
      units, by including and/or forward declaring everything they depend on.
      
      Add special target header-test-y where individual Makefiles can add
      headers to be tested if CONFIG_HEADER_TEST is enabled. This will
      generate a dummy C file per header that gets built as part of extra-y.
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      e846f0dc
    • M
      kbuild: deb-pkg: do not run headers_check · 0315bb7a
      Masahiro Yamada 提交于
      It is absolutely fine to add extra sanity checks in package scripts,
      but it is not necessary to do so.
      
      This is already covered by the daily compile-testing (0day bot etc.)
      because headers_check is run as a part of the normal build process
      when CONFIG_HEADERS_CHECK=y.
      
      Replace it with the newly-added "make headers".
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      0315bb7a
    • M
      kbuild: simplify scripts/headers_install.sh · 555187a8
      Masahiro Yamada 提交于
      Now that headers_install.sh is invoked per file, remove the for-loop
      in the shell script.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      555187a8
    • M
      kbuild: move hdr-inst shorthand to top Makefile · a5bae54c
      Masahiro Yamada 提交于
      Now that hdr-inst is used only in the top Makefile, move it there
      from scripts/Kbuild.include.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      a5bae54c
    • M
      kbuild: re-implement Makefile.headersinst without recursion · d5470d14
      Masahiro Yamada 提交于
      Since commit fcc8487d ("uapi: export all headers under uapi
      directories"), the headers in uapi directories are all exported by
      default although exceptional cases are still allowed by the syntax
      'no-export-headers'.
      
      The traditional directory descending has been kept (in a somewhat
      hacky way), but it is actually unneeded.
      
      Get rid of it to simplify the code.
      
      Also, handle files one by one instead of the previous per-directory
      processing. This will emit much more log, but I like it.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      d5470d14
    • M
      kbuild: add 'headers' target to build up uapi headers in usr/include · 59b2bd05
      Masahiro Yamada 提交于
      In Linux build system, build targets and installation targets are
      separated.
      
      Examples are:
      
       - 'make vmlinux' -> 'make install'
       - 'make modules' -> 'make modules_install'
       - 'make dtbs'    -> 'make dtbs_install'
       - 'make vdso'    -> 'make vdso_install'
      
      The intention is to run the build targets under the normal privilege,
      then the installation targets under the root privilege since we need
      the write permission to the system directories.
      
      We have 'make headers_install' but the corresponding 'make headers'
      stage does not exist. The purpose of headers_install is to provide
      the kernel interface to C library. So, nobody would try to install
      headers to /usr/include directly.
      
      If 'sudo make INSTALL_HDR_PATH=/usr/include headers_install' were run,
      some build artifacts in the kernel tree would be owned by root because
      some of uapi headers are generated by 'uapi-asm-generic', 'archheaders'
      targets.
      
      Anyway, I believe it makes sense to split the header installation into
      two stages.
      
       [1] 'make headers'
          Process headers in uapi directories by scripts/headers_install.sh
          and copy them to usr/include
      
       [2] 'make headers_install'
          Copy '*.h' verbatim from usr/include to $(INSTALL_HDR_PATH)/include
      
      For the backward compatibility, 'headers_install' depends on 'headers'.
      
      Some samples expect uapi headers in usr/include. So, the 'headers'
      target is useful to build up them in the fixed location usr/include
      irrespective of INSTALL_HDR_PATH.
      
      Another benefit is to stop polluting the final destination with the
      time-stamp files '.install' and '.check'. Maybe you can see them in
      your toolchains.
      
      Lastly, my main motivation is to prepare for compile-testing uapi
      headers. To build something, we have to save an object and .*.cmd
      somewhere. The usr/include/ will be the work directory for that.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      59b2bd05
    • M
      kbuild: build all prerequisites of headers_install simultaneously · bdd7714b
      Masahiro Yamada 提交于
      Currently, scripts/unifdef is compiled after scripts_basic,
      uapi-asm-generic, archheaders, and archscripts.
      
      The proper dependency is just scripts_basic. There is no problem
      to compile scripts/unifdef and other headers at the same time.
      
      Split scripts_unifdef out in order to allow more parallel building.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      bdd7714b
    • M
      kbuild: remove build_unifdef target in scripts/Makefile · 2b8481be
      Masahiro Yamada 提交于
      Since commit 2aedcd09 ("kbuild: suppress annoying "... is up to date."
      message"), if_changed and friends nicely suppress "is up to date" messages.
      
      We do not need per-Makefile tricks.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      2b8481be
    • M
      kbuild: add CONFIG_HEADERS_INSTALL and loosen the dependency of samples · e949f4c2
      Masahiro Yamada 提交于
      Commit 5318321d ("samples: disable CONFIG_SAMPLES for UML") used
      a big hammer to fix the build errors under the samples/ directory.
      Only some samples actually include uapi headers from usr/include.
      
      Introduce CONFIG_HEADERS_INSTALL since 'depends on HEADERS_INSTALL' is
      clearer than 'depends on !UML'. If this option is enabled, uapi headers
      are installed before starting directory descending.
      
      I added 'depends on HEADERS_INSTALL' to per-sample CONFIG options.
      This allows UML to compile some samples.
      
      $ make ARCH=um allmodconfig samples/
        [ snip ]
        CC [M]  samples/configfs/configfs_sample.o
        CC [M]  samples/kfifo/bytestream-example.o
        CC [M]  samples/kfifo/dma-example.o
        CC [M]  samples/kfifo/inttype-example.o
        CC [M]  samples/kfifo/record-example.o
        CC [M]  samples/kobject/kobject-example.o
        CC [M]  samples/kobject/kset-example.o
        CC [M]  samples/trace_events/trace-events-sample.o
        CC [M]  samples/trace_printk/trace-printk.o
        AR      samples/vfio-mdev/built-in.a
        AR      samples/built-in.a
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      e949f4c2
    • M
      kbuild: fix Kconfig prompt of CONFIG_HEADERS_CHECK · c6509a24
      Masahiro Yamada 提交于
      Prior to commit 257edce6 ("kbuild: exploit parallel building for
      CONFIG_HEADERS_CHECK"), the sanity check of exported headers was done
      as a side-effect of build rule of vmlinux.
      
      That commit is good, but I missed to update the prompt of the Kconfig
      entry. For the sake of preciseness, lets' say "when building 'all'".
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      c6509a24
    • M
      kbuild: make gdb_script depend on prepare0 instead of prepare · 7a739ce5
      Masahiro Yamada 提交于
      'gdb_script' needs headers generated by ./Kbuild, which is visited
      by 'prepare0'. None of 'gdb_script' depends on 'prepare'.
      
      Loosen the dependency.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      7a739ce5
    • M
      kbuild: remove stale dependency between Documentation/ and headers_install · 3a51f908
      Masahiro Yamada 提交于
      Commit 8e2faea8 ("Make Documenation depend on headers_install")
      dates back to 2014, which is before Sphinx was introduced for the
      kernel documentation.
      
      Since none of DOC_TARGET requires headers_install, it is strange to
      run it only for the single target "Documentation/".
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      3a51f908
    • M
      kbuild: remove headers_{install,check}_all · f3c8d4c7
      Masahiro Yamada 提交于
      headers_install_all does not make much sense any more because different
      architectures export different set of uapi/linux/ headers. As you see
      in include/uapi/linux/Kbuild, the installation of a.out.h, kvm.h, and
      kvm_para.h is arch-dependent. So, headers_install_all repeats the
      installation/removal of them.
      
      If somebody really thinks it is useful to do headers_install for all
      architectures, it would be possible by small shell-scripting, but
      the top Makefile does not have to provide entry targets just for that
      purpose.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      f3c8d4c7
  6. 09 6月, 2019 8 次提交
    • M
      kbuild: Remove -Waggregate-return from scripts/Makefile.extrawarn · 869ee58b
      Mathieu Malaterre 提交于
      It makes little sense to pass -Waggregate-return these days since large
      part of the linux kernel rely on returning struct(s). For instance:
      
        ../include/linux/timekeeping.h: In function 'show_uptime':
        ../include/linux/ktime.h:91:34: error: function call has aggregate value [-Werror=aggregate-return]
         #define ktime_to_timespec64(kt)  ns_to_timespec64((kt))
                                          ^~~~~~~~~~~~~~~~~~~~~~
        ../include/linux/timekeeping.h:166:8: note: in expansion of macro 'ktime_to_timespec64'
          *ts = ktime_to_timespec64(ktime_get_coarse_boottime());
      
      Remove this warning from W=2 completely.
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      869ee58b
    • L
      Linux 5.2-rc4 · d1fdb6d8
      Linus Torvalds 提交于
      d1fdb6d8
    • L
      Merge tag 'ceph-for-5.2-rc4' of git://github.com/ceph/ceph-client · 2759e05c
      Linus Torvalds 提交于
      Pull ceph fixes from Ilya Dryomov:
       "A change to call iput() asynchronously to avoid a possible deadlock
        when iput_final() needs to wait for in-flight I/O (e.g. readahead) and
        a fixup for a cleanup that went into -rc1"
      
      * tag 'ceph-for-5.2-rc4' of git://github.com/ceph/ceph-client:
        ceph: fix error handling in ceph_get_caps()
        ceph: avoid iput_final() while holding mutex or in dispatch thread
        ceph: single workqueue for inode related works
      2759e05c
    • L
      Merge tag 'for-linus-5.2b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 8e61f6f7
      Linus Torvalds 提交于
      Pull xen fix from Juergen Gross:
       "Just one fix for the Xen block frontend driver avoiding allocations
        with order > 0"
      
      * tag 'for-linus-5.2b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen-blkfront: switch kcalloc to kvcalloc for large array allocation
      8e61f6f7
    • L
      Merge tag 's390-5.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 3d4645bf
      Linus Torvalds 提交于
      Pull s390 fixes from Heiko Carstens:
      
       - fix stack unwinder: the stack unwinder rework has on off-by-one bug
         which prevents following stack backchains over more than one context
         (e.g. irq -> process).
      
       - fix address space detection in exception handler: if user space
         switches to access register mode, which is not supported anymore, the
         exception handler may resolve to the wrong address space.
      
      * tag 's390-5.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/unwind: correct stack switching during unwind
        s390/mm: fix address space detection in exception handling
      3d4645bf
    • L
      Merge tag 'mips_fixes_5.2_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · d0cc617a
      Linus Torvalds 提交于
      Pull MIPS fixes from Paul Burton:
      
       - Declare ginvt() __always_inline due to its use of an argument as an
         inline asm immediate.
      
       - A VDSO build fix following Kbuild changes made this cycle.
      
       - A fix for boot failures on txx9 systems following memory
         initialization changes made this cycle.
      
       - Bounds check virt_addr_valid() to prevent it spuriously indicating
         that bogus addresses are valid, in turn fixing hardened usercopy
         failures that have been present since v4.12.
      
       - Build uImage.gz for pistachio systems by default, since this is the
         image we need in order to actually boot on a board.
      
       - Remove an unused variable in our uprobes code.
      
      * tag 'mips_fixes_5.2_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
        MIPS: uprobes: remove set but not used variable 'epc'
        MIPS: pistachio: Build uImage.gz by default
        MIPS: Make virt_addr_valid() return bool
        MIPS: Bounds check virt_addr_valid
        MIPS: TXx9: Fix boot crash in free_initmem()
        MIPS: remove a space after -I to cope with header search paths for VDSO
        MIPS: mark ginvt() as __always_inline
      d0cc617a
    • L
      Merge tag 'spdx-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · 9331b674
      Linus Torvalds 提交于
      Pull yet more SPDX updates from Greg KH:
       "Another round of SPDX header file fixes for 5.2-rc4
      
        These are all more "GPL-2.0-or-later" or "GPL-2.0-only" tags being
        added, based on the text in the files. We are slowly chipping away at
        the 700+ different ways people tried to write the license text. All of
        these were reviewed on the spdx mailing list by a number of different
        people.
      
        We now have over 60% of the kernel files covered with SPDX tags:
      	$ ./scripts/spdxcheck.py -v 2>&1 | grep Files
      	Files checked:            64533
      	Files with SPDX:          40392
      	Files with errors:            0
      
        I think the majority of the "easy" fixups are now done, it's now the
        start of the longer-tail of crazy variants to wade through"
      
      * tag 'spdx-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (159 commits)
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 450
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 449
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 448
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 446
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 444
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 443
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 442
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 440
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 438
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 437
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 436
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 435
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 434
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 433
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 432
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 431
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 430
        treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 429
        ...
      9331b674
    • L
      Merge tag 'char-misc-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 1ce2c851
      Linus Torvalds 提交于
      Pull char/misc driver fixes from Greg KH:
       "Here are some small char and misc driver fixes for 5.2-rc4 to resolve
        a number of reported issues.
      
        The most "notable" one here is the kernel headers in proc^Wsysfs
        fixes. Those changes move the header file info into sysfs and fixes
        the build issues that you reported.
      
        Other than that, a bunch of small habanalabs driver fixes, some fpga
        driver fixes, and a few other tiny driver fixes.
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'char-misc-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        habanalabs: Read upper bits of trace buffer from RWPHI
        habanalabs: Fix virtual address access via debugfs for 2MB pages
        fpga: zynqmp-fpga: Correctly handle error pointer
        habanalabs: fix bug in checking huge page optimization
        habanalabs: Avoid using a non-initialized MMU cache mutex
        habanalabs: fix debugfs code
        uapi/habanalabs: add opcode for enable/disable device debug mode
        habanalabs: halt debug engines on user process close
        test_firmware: Use correct snprintf() limit
        genwqe: Prevent an integer overflow in the ioctl
        parport: Fix mem leak in parport_register_dev_model
        fpga: dfl: expand minor range when registering chrdev region
        fpga: dfl: Add lockdep classes for pdata->lock
        fpga: dfl: afu: Pass the correct device to dma_mapping_error()
        fpga: stratix10-soc: fix use-after-free on s10_init()
        w1: ds2408: Fix typo after 49695ac4 (reset on output_write retry with readback)
        kheaders: Do not regenerate archive if config is not changed
        kheaders: Move from proc to sysfs
        lkdtm/bugs: Adjust recursion test to avoid elision
        lkdtm/usercopy: Moves the KERNEL_DS test to non-canonical
      1ce2c851