1. 29 9月, 2022 13 次提交
    • M
      scripts/mkcompile_h: move LC_ALL=C to '$LD -v' · c7b594f5
      Masahiro Yamada 提交于
      Minimize the scope of LC_ALL=C like before commit 87c94bfb ("kbuild:
      override build timestamp & version").
      
      Give LC_ALL=C to '$LD -v' to get the consistent version output, as commit
      bcbcf50f ("kbuild: fix ld-version.sh to not be affected by locale")
      mentioned the LD version is affected by locale.
      
      While I was here, I merged two sed invocations.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      c7b594f5
    • M
      kbuild: generate include/generated/compile.h in top Makefile · a55f283e
      Masahiro Yamada 提交于
      Now that UTS_VERSION was separated out, this header can be generated
      much earlier, and probably the top Makefile is a better place to do it
      than init/Makefile.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a55f283e
    • M
      kbuild: build init/built-in.a just once · 2df8220c
      Masahiro Yamada 提交于
      Kbuild builds init/built-in.a twice; first during the ordinary
      directory descending, second from scripts/link-vmlinux.sh.
      
      We do this because UTS_VERSION contains the build version and the
      timestamp. We cannot update it during the normal directory traversal
      since we do not yet know if we need to update vmlinux. UTS_VERSION is
      temporarily calculated, but omitted from the update check. Otherwise,
      vmlinux would be rebuilt every time.
      
      When Kbuild results in running link-vmlinux.sh, it increments the
      version number in the .version file and takes the timestamp at that
      time to really fix UTS_VERSION.
      
      However, updating the same file twice is a footgun. To avoid nasty
      timestamp issues, all build artifacts that depend on init/built-in.a
      are atomically generated in link-vmlinux.sh, where some of them do not
      need rebuilding.
      
      To fix this issue, this commit changes as follows:
      
      [1] Split UTS_VERSION out to include/generated/utsversion.h from
          include/generated/compile.h
      
          include/generated/utsversion.h is generated just before the
          vmlinux link. It is generated under include/generated/ because
          some decompressors (s390, x86) use UTS_VERSION.
      
      [2] Split init_uts_ns and linux_banner out to init/version-timestamp.c
          from init/version.c
      
          init_uts_ns and linux_banner contain UTS_VERSION. During the ordinary
          directory descending, they are compiled with __weak and used to
          determine if vmlinux needs relinking. Just before the vmlinux link,
          they are compiled without __weak to embed the real version and
          timestamp.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      2df8220c
    • M
      init/version.c: remove #include <linux/version.h> · 561daaac
      Masahiro Yamada 提交于
      This is unneeded since commit 073a9ecb ("init/version.c: remove
      Version_<LINUX_VERSION_CODE> symbol").
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      561daaac
    • M
      kbuild: move 'PHONY += modules_prepare' to the common part · 7f371813
      Masahiro Yamada 提交于
      Unify the code between in-tree builds and external module builds.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      7f371813
    • M
      kbuild: refactor single builds of *.ko · f110e5a2
      Masahiro Yamada 提交于
      Remove the potentially invalid modules.order instead of using
      the temporary file.
      
      Also, KBUILD_MODULES is don't care for single builds. No need to
      cancel it.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      f110e5a2
    • M
      kbuild: remove duplicated dependency between modules and modules_check · f75a0334
      Masahiro Yamada 提交于
      The dependency, "modules: modules_check" is specified twice.
      Commit 1a998be6 ("kbuild: check module name conflict for external
      modules as well") missed to clean it up.
      
      'PHONY += modules' also appears twice.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      f75a0334
    • M
      nios2: move core-y in arch/nios2/Makefile to arch/nios2/Kbuild · e30d4487
      Masahiro Yamada 提交于
      Use obj-y to clean up Makefile.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      e30d4487
    • M
      kbuild: do not deduplicate modules.order · d724b578
      Masahiro Yamada 提交于
      The AWK code was added to deduplicate modules.order in case $(obj-m)
      contains the same module multiple times, but it is actually unneeded
      since commit b2c88554 ("kbuild: update modules.order only when
      contained modules are updated").
      
      The list is already deduplicated before being processed by AWK because
      $^ is the deduplicated list of prerequisites.
      (Please note the real-prereqs macro uses $^)
      
      Yet, modules.order will contain duplication if two different Makefiles
      build the same module:
      
        foo/Makefile:
      
            obj-m += bar/baz.o
      
        foo/bar/Makefile:
      
            obj-m += baz.o
      
      However, the parallel builds cannot properly handle this case in the
      first place. So, it is better to let it fail (as already done by
      scripts/modules-check.sh).
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      d724b578
    • M
      kbuild: check sha1sum just once for each atomic header · b10fdeea
      Masahiro Yamada 提交于
      It is unneeded to check the sha1sum every time.
      
      Create the timestamp files to manage it.
      
      Add '.' to clean-dirs because 'make clean' must visit ./Kbuild to
      clean up the timestamp files.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      b10fdeea
    • M
      kbuild: hard-code KBUILD_ALLDIRS in scripts/Makefile.package · a3c4d4ab
      Masahiro Yamada 提交于
      My future plan is to list subdirectories in ./Kbuild. When it occurs,
      $(vmlinux-alldirs) will not contain all subdirectories.
      
      Let's hard-code the directory list until I get around to implementing
      a more sophisticated way for generating a source tarball.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: NNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      a3c4d4ab
    • M
      kbuild: add phony targets to ./Kbuild · ed7ceac1
      Masahiro Yamada 提交于
      missing-syscalls and old-atomics are meant to be phony targets.
      Adding them to always-y is odd. (always-y should generate something).
      
      Add a new phony target 'prepare', which depends on all the other.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      ed7ceac1
    • M
      kbuild: remove the target in signal traps when interrupted · a7f3257d
      Masahiro Yamada 提交于
      When receiving some signal, GNU Make automatically deletes the target if
      it has already been changed by the interrupted recipe.
      
      If the target is possibly incomplete due to interruption, it must be
      deleted so that it will be remade from scratch on the next run of make.
      Otherwise, the target would remain corrupted permanently because its
      timestamp had already been updated.
      
      Thanks to this behavior of Make, you can stop the build any time by
      pressing Ctrl-C, and just run 'make' to resume it.
      
      Kbuild also relies on this feature, but it is equivalently important
      for any build systems that make decisions based on timestamps (if you
      want to support Ctrl-C reliably).
      
      However, this does not always work as claimed; Make immediately dies
      with Ctrl-C if its stderr goes into a pipe.
      
        [Test Makefile]
      
          foo:
                  echo hello > $@
                  sleep 3
                  echo world >> $@
      
        [Test Result]
      
          $ make                         # hit Ctrl-C
          echo hello > foo
          sleep 3
          ^Cmake: *** Deleting file 'foo'
          make: *** [Makefile:3: foo] Interrupt
      
          $ make 2>&1 | cat              # hit Ctrl-C
          echo hello > foo
          sleep 3
          ^C$                            # 'foo' is often left-over
      
      The reason is because SIGINT is sent to the entire process group.
      In this example, SIGINT kills 'cat', and 'make' writes the message to
      the closed pipe, then dies with SIGPIPE before cleaning the target.
      
      A typical bad scenario (as reported by [1], [2]) is to save build log
      by using the 'tee' command:
      
          $ make 2>&1 | tee log
      
      This can be problematic for any build systems based on Make, so I hope
      it will be fixed in GNU Make. The maintainer of GNU Make stated this is
      a long-standing issue and difficult to fix [3]. It has not been fixed
      yet as of writing.
      
      So, we cannot rely on Make cleaning the target. We can do it by
      ourselves, in signal traps.
      
      As far as I understand, Make takes care of SIGHUP, SIGINT, SIGQUIT, and
      SITERM for the target removal. I added the traps for them, and also for
      SIGPIPE just in case cmd_* rule prints something to stdout or stderr
      (but I did not observe an actual case where SIGPIPE was triggered).
      
      [Note 1]
      
      The trap handler might be worth explaining.
      
          rm -f $@; trap - $(sig); kill -s $(sig) $$
      
      This lets the shell kill itself by the signal it caught, so the parent
      process can tell the child has exited on the signal. Generally, this is
      a proper manner for handling signals, in case the calling program (like
      Bash) may monitor WIFSIGNALED() and WTERMSIG() for WCE although this may
      not be a big deal here because GNU Make handles SIGHUP, SIGINT, SIGQUIT
      in WUE and SIGTERM in IUE.
      
        IUE - Immediate Unconditional Exit
        WUE - Wait and Unconditional Exit
        WCE - Wait and Cooperative Exit
      
      For details, see "Proper handling of SIGINT/SIGQUIT" [4].
      
      [Note 2]
      
      Reverting 392885ee ("kbuild: let fixdep directly write to .*.cmd
      files") would directly address [1], but it only saves if_changed_dep.
      As reported in [2], all commands that use redirection can potentially
      leave an empty (i.e. broken) target.
      
      [Note 3]
      
      Another (even safer) approach might be to always write to a temporary
      file, and rename it to $@ at the end of the recipe.
      
         <command>  > $(tmp-target)
         mv $(tmp-target) $@
      
      It would require a lot of Makefile changes, and result in ugly code,
      so I did not take it.
      
      [Note 4]
      
      A little more thoughts about a pattern rule with multiple targets (or
      a grouped target).
      
          %.x %.y: %.z
                  <recipe>
      
      When interrupted, GNU Make deletes both %.x and %.y, while this solution
      only deletes $@. Probably, this is not a big deal. The next run of make
      will execute the rule again to create $@ along with the other files.
      
      [1]: https://lore.kernel.org/all/YLeot94yAaM4xbMY@gmail.com/
      [2]: https://lore.kernel.org/all/20220510221333.2770571-1-robh@kernel.org/
      [3]: https://lists.gnu.org/archive/html/help-make/2021-06/msg00001.html
      [4]: https://www.cons.org/cracauer/sigint.html
      
      Fixes: 392885ee ("kbuild: let fixdep directly write to .*.cmd files")
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Reported-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: NIngo Molnar <mingo@kernel.org>
      Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
      a7f3257d
  2. 26 9月, 2022 2 次提交
    • L
      Linux 6.0-rc7 · f76349cf
      Linus Torvalds 提交于
      f76349cf
    • L
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 5e049663
      Linus Torvalds 提交于
      Pull ext4 fixes from Ted Ts'o:
       "Regression and bug fixes:
      
         - Performance regression fix from 5.18 on a Rasberry Pi
      
         - Fix extent parsing bug which triggers a BUG_ON when a (corrupted)
           extent tree has has a non-root node when zero entries.
      
         - Fix a livelock where in the right (wrong) circumstances a large
           number of nfsd threads can try to write to a nearly full file
           system, and retry for hours(!)"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: limit the number of retries after discarding preallocations blocks
        ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0
        ext4: use buckets for cr 1 block scan instead of rbtree
        ext4: use locality group preallocation for small closed files
        ext4: make directory inode spreading reflect flexbg size
        ext4: avoid unnecessary spreading of allocations among groups
        ext4: make mballoc try target group first even with mb_optimize_scan
      5e049663
  3. 25 9月, 2022 6 次提交
  4. 24 9月, 2022 17 次提交
  5. 23 9月, 2022 2 次提交