Skip to content
Snippets Groups Projects
  1. Aug 11, 2024
  2. Aug 04, 2024
  3. Jul 28, 2024
  4. Jul 21, 2024
  5. Jul 20, 2024
  6. Jul 16, 2024
  7. Jul 14, 2024
  8. Jul 10, 2024
    • Arnd Bergmann's avatar
      kbuild: add syscall table generation to scripts/Makefile.asm-headers · fbb5c060
      Arnd Bergmann authored
      
      There are 11 copies of arch/*/kernel/syscalls/Makefile that all implement
      the same basic logic in a somewhat awkward way.
      
      I tried out various ways of unifying the existing copies and ended up
      with something that hooks into the logic for generating the redirections
      to asm-generic headers. This gives a nicer syntax of being able to list
      the generated files in $(syscall-y) inside of arch/*/include/asm/Kbuild
      instead of both $(generated-y) in that place and also in another
      Makefile.
      
      The configuration for which syscall.tbl file to use and which ABIs to
      enable is now done in arch/*/kernel/Makefile.syscalls. I have done
      patches for all architectures and made sure that the new generic
      rules implement a superset of all the architecture specific corner
      cases.
      
      ince the header file is not specific to asm-generic/*.h redirects
      now, I ended up renaming the file to scripts/Makefile.asm-headers.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      fbb5c060
    • Miguel Ojeda's avatar
      rust: simplify Clippy warning flags set · bb421b51
      Miguel Ojeda authored
      
      All Clippy lint groups that we enable, except `correctness`, have a
      default `warn` level, thus they may be removed now that we relaxed all
      lints to `warn`.
      
      Moreover, Clippy provides an `all` lint group that covers the groups
      we enable by default. Thus just use `all` instead -- the only change is
      that, if Clippy introduces a new lint group or splits an existing one,
      we will cover that one automatically.
      
      In addition, `let_unit_value` is in `style` since Rust 1.62.0, thus it
      does not need to be enabled manually.
      
      Reviewed-by: default avatarFinn Behrens <me@kloenk.dev>
      Tested-by: default avatarBenno Lossin <benno.lossin@proton.me>
      Tested-by: default avatarAndreas Hindborg <a.hindborg@samsung.com>
      Link: https://lore.kernel.org/r/20240709160615.998336-6-ojeda@kernel.org
      
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      bb421b51
    • Miguel Ojeda's avatar
      rust: relax most deny-level lints to warnings · f8f88aa2
      Miguel Ojeda authored
      Since we are starting to support several Rust toolchains, lints (including
      Clippy ones) now may behave differently and lint groups may include
      new lints.
      
      Therefore, to maximize the chances a given version works, relax some
      deny-level lints to warnings. It may also make our lives a bit easier
      while developing new code or refactoring.
      
      To be clear, the requirements for in-tree code are still the same, since
      Rust code still needs to be warning-free (patches should be clean under
      `WERROR=y`) and the set of lints is not changed.
      
      `unsafe_op_in_unsafe_fn` is left unmodified, i.e. as an error, since it is
      becoming the default in the language (warn-by-default in Rust 2024 [1] and
      ideally an error later on) and thus it should also be very well tested. In
      addition, it is simple enough that it should not have false positives
      (unlike e.g. `rust_2018_idioms`'s `explicit_outlives_requirements`).
      
      `non_ascii_idents` is left unmodified as well, i.e. as an error, since
      it is unlikely one gains any productivity during development if it
      were a warning (in fact, it may be worse, since it is likely one made
      a typo). In addition, it should not have false positives.
      
      Finally, put the two `-D` ones at the top and take the chance to do one
      per line.
      
      Link: https://github.com/rust-lang/rust/pull/112038
      
       [1]
      Reviewed-by: default avatarFinn Behrens <me@kloenk.dev>
      Tested-by: default avatarBenno Lossin <benno.lossin@proton.me>
      Tested-by: default avatarAndreas Hindborg <a.hindborg@samsung.com>
      Link: https://lore.kernel.org/r/20240709160615.998336-5-ojeda@kernel.org
      
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      f8f88aa2
  9. Jul 08, 2024
  10. Jul 07, 2024
  11. Jun 30, 2024
  12. Jun 23, 2024
  13. Jun 16, 2024
  14. Jun 09, 2024
  15. Jun 02, 2024
  16. May 26, 2024
  17. May 19, 2024
    • Samuel Holland's avatar
      arch: add ARCH_HAS_KERNEL_FPU_SUPPORT · 6cbd1d6d
      Samuel Holland authored
      Several architectures provide an API to enable the FPU and run
      floating-point SIMD code in kernel space.  However, the function names,
      header locations, and semantics are inconsistent across architectures, and
      FPU support may be gated behind other Kconfig options.
      
      provide a standard way for architectures to declare that kernel space
      FPU support is available. Architectures selecting this option must
      implement what is currently the most common API (kernel_fpu_begin() and
      kernel_fpu_end(), plus a new function kernel_fpu_available()) and
      provide the appropriate CFLAGS for compiling floating-point C code.
      
      Link: https://lkml.kernel.org/r/20240329072441.591471-2-samuel.holland@sifive.com
      
      
      Signed-off-by: default avatarSamuel Holland <samuel.holland@sifive.com>
      Suggested-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: WANG Xuerui <git@xen0n.name>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6cbd1d6d
  18. May 12, 2024
  19. May 09, 2024
    • Masahiro Yamada's avatar
      kbuild: add 'private' to target-specific variables · d98dba88
      Masahiro Yamada authored
      
      Currently, Kbuild produces inconsistent results in some cases.
      
      You can do an interesting experiment using the --shuffle option, which
      is supported by GNU Make 4.4 or later.
      
      Set CONFIG_KVM_INTEL=y and CONFIG_KVM_AMD=m (or vice versa), and repeat
      incremental builds w/wo --shuffle=reverse.
      
        $ make
          [ snip ]
          CC      arch/x86/kvm/kvm-asm-offsets.s
      
        $ make --shuffle=reverse
          [ snip ]
          CC [M]  arch/x86/kvm/kvm-asm-offsets.s
      
        $ make
          [ snip ]
          CC      arch/x86/kvm/kvm-asm-offsets.s
      
      arch/x86/kvm/kvm-asm-offsets.s is rebuilt every time w/wo the [M] marker.
      
      arch/x86/kvm/kvm-asm-offsets.s is built as built-in when it is built as
      a prerequisite of arch/x86/kvm/kvm-intel.o, which is built-in.
      
      arch/x86/kvm/kvm-asm-offsets.s is built as modular when it is built as
      a prerequisite of arch/x86/kvm/kvm-amd.o, which is a module.
      
      Another odd example is single target builds.
      
      When CONFIG_LKDTM=m, drivers/misc/lkdtm/rodata.o can be built as
      built-in or modular, depending on how it is built.
      
        $ make drivers/misc/lkdtm/lkdtm.o
          [ snip ]
          CC [M]  drivers/misc/lkdtm/rodata.o
      
        $ make drivers/misc/lkdtm/rodata.o
          [ snip ]
          CC      drivers/misc/lkdtm/rodata.o
      
      drivers/misc/lkdtm/rodata.o is built as modular when it is built as a
      prerequisite of another, but built as built-in when it is a final
      target.
      
      The same thing happens to drivers/memory/emif-asm-offsets.s when
      CONFIG_TI_EMIF_SRAM=m.
      
        $ make drivers/memory/ti-emif-sram.o
          [ snip ]
          CC [M]  drivers/memory/emif-asm-offsets.s
      
        $ make drivers/memory/emif-asm-offsets.s
          [ snip ]
          CC      drivers/memory/emif-asm-offsets.s
      
      This is because the part-of-module=y flag defined for the modules is
      inherited by its prerequisites.
      
      Target-specific variables are likely intended only for local use.
      This commit adds 'private' to them.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      d98dba88
    • Masahiro Yamada's avatar
      kbuild: remove redundant $(wildcard ) for rm-files · 770202a2
      Masahiro Yamada authored
      
      The $(wildcard ) is called in quiet_cmd_rmfiles.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      770202a2
    • Masahiro Yamada's avatar
      kbuild: use $(src) instead of $(srctree)/$(src) for source directory · b1992c37
      Masahiro Yamada authored
      
      Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
      checked-in source files. It is merely a convention without any functional
      difference. In fact, $(obj) and $(src) are exactly the same, as defined
      in scripts/Makefile.build:
      
          src := $(obj)
      
      When the kernel is built in a separate output directory, $(src) does
      not accurately reflect the source directory location. While Kbuild
      resolves this discrepancy by specifying VPATH=$(srctree) to search for
      source files, it does not cover all cases. For example, when adding a
      header search path for local headers, -I$(srctree)/$(src) is typically
      passed to the compiler.
      
      This introduces inconsistency between upstream and downstream Makefiles
      because $(src) is used instead of $(srctree)/$(src) for the latter.
      
      To address this inconsistency, this commit changes the semantics of
      $(src) so that it always points to the directory in the source tree.
      
      Going forward, the variables used in Makefiles will have the following
      meanings:
      
        $(obj)     - directory in the object tree
        $(src)     - directory in the source tree  (changed by this commit)
        $(objtree) - the top of the kernel object tree
        $(srctree) - the top of the kernel source tree
      
      Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced
      with $(src).
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      b1992c37
  20. May 05, 2024
  21. May 02, 2024
    • Nathan Chancellor's avatar
      kbuild: Remove support for Clang's ThinLTO caching · aba09154
      Nathan Chancellor authored
      
      There is an issue in clang's ThinLTO caching (enabled for the kernel via
      '--thinlto-cache-dir') with .incbin, which the kernel occasionally uses
      to include data within the kernel, such as the .config file for
      /proc/config.gz. For example, when changing the .config and rebuilding
      vmlinux, the copy of .config in vmlinux does not match the copy of
      .config in the build folder:
      
        $ echo 'CONFIG_LTO_NONE=n
        CONFIG_LTO_CLANG_THIN=y
        CONFIG_IKCONFIG=y
        CONFIG_HEADERS_INSTALL=y' >kernel/configs/repro.config
      
        $ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 clean defconfig repro.config vmlinux
        ...
      
        $ grep CONFIG_HEADERS_INSTALL .config
        CONFIG_HEADERS_INSTALL=y
      
        $ scripts/extract-ikconfig vmlinux | grep CONFIG_HEADERS_INSTALL
        CONFIG_HEADERS_INSTALL=y
      
        $ scripts/config -d HEADERS_INSTALL
      
        $ make -kj"$(nproc)" ARCH=x86_64 LLVM=1 vmlinux
        ...
          UPD     kernel/config_data
          GZIP    kernel/config_data.gz
          CC      kernel/configs.o
        ...
          LD      vmlinux
        ...
      
        $ grep CONFIG_HEADERS_INSTALL .config
        # CONFIG_HEADERS_INSTALL is not set
      
        $ scripts/extract-ikconfig vmlinux | grep CONFIG_HEADERS_INSTALL
        CONFIG_HEADERS_INSTALL=y
      
      Without '--thinlto-cache-dir' or when using full LTO, this issue does
      not occur.
      
      Benchmarking incremental builds on a few different machines with and
      without the cache shows a 20% increase in incremental build time without
      the cache when measured by touching init/main.c and running 'make all'.
      
      ARCH=arm64 defconfig + CONFIG_LTO_CLANG_THIN=y on an arm64 host:
      
        Benchmark 1: With ThinLTO cache
          Time (mean ± σ):     56.347 s ±  0.163 s    [User: 83.768 s, System: 24.661 s]
          Range (min … max):   56.109 s … 56.594 s    10 runs
      
        Benchmark 2: Without ThinLTO cache
          Time (mean ± σ):     67.740 s ±  0.479 s    [User: 718.458 s, System: 31.797 s]
          Range (min … max):   67.059 s … 68.556 s    10 runs
      
        Summary
          With ThinLTO cache ran
            1.20 ± 0.01 times faster than Without ThinLTO cache
      
      ARCH=x86_64 defconfig + CONFIG_LTO_CLANG_THIN=y on an x86_64 host:
      
        Benchmark 1: With ThinLTO cache
          Time (mean ± σ):     85.772 s ±  0.252 s    [User: 91.505 s, System: 8.408 s]
          Range (min … max):   85.447 s … 86.244 s    10 runs
      
        Benchmark 2: Without ThinLTO cache
          Time (mean ± σ):     103.833 s ±  0.288 s    [User: 232.058 s, System: 8.569 s]
          Range (min … max):   103.286 s … 104.124 s    10 runs
      
        Summary
          With ThinLTO cache ran
            1.21 ± 0.00 times faster than Without ThinLTO cache
      
      While it is unfortunate to take this performance improvement off the
      table, correctness is more important. If/when this is fixed in LLVM, it
      can potentially be brought back in a conditional manner. Alternatively,
      a developer can just disable LTO if doing incremental compiles quickly
      is important, as a full compile cycle can still take over a minute even
      with the cache and it is unlikely that LTO will result in functional
      differences for a kernel change.
      
      Cc: stable@vger.kernel.org
      Fixes: dc5723b0 ("kbuild: add support for Clang LTO")
      Reported-by: default avatarYifan Hong <elsk@google.com>
      Closes: https://github.com/ClangBuiltLinux/linux/issues/2021
      
      
      Reported-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Closes: https://lore.kernel.org/r/20220327115526.cc4b0ff55fc53c97683c3e4d@kernel.org/
      
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      aba09154
    • Rob Herring's avatar
      dt-bindings: kbuild: Add separate target/dependency for processed-schema.json · 604a57ba
      Rob Herring authored
      
      Running dtbs_check and dt_compatible_check targets really only depend
      on processed-schema.json, but the dependency is 'dt_binding_check'. That
      was sort worked around with the CHECK_DT_BINDING variable in order to
      skip some of the work that 'dt_binding_check' does. It still runs the
      full checks of the schemas which is not necessary and adds 10s of
      seconds to the build time. That's significant when checking only a few
      DTBs and with recent changes that have improved the validation time by
      6-7x.
      
      Add a new target, dt_binding_schema, which just builds
      processed-schema.json and can be used as the dependency for other
      targets. The scripts_dtc dependency isn't needed either as the examples
      aren't built for it.
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Tested-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      604a57ba
  22. Apr 28, 2024
  23. Apr 21, 2024
  24. Apr 14, 2024
  25. Apr 07, 2024
  26. Mar 31, 2024
  27. Mar 24, 2024
  28. Mar 10, 2024
  29. Mar 09, 2024
  30. Mar 03, 2024
  31. Feb 29, 2024
    • Miguel Ojeda's avatar
      kbuild: mark `rustc` (and others) invocations as recursive · ecab4115
      Miguel Ojeda authored
      `rustc` (like Cargo) may take advantage of the jobserver at any time
      (e.g. for backend parallelism, or eventually frontend too). In the kernel,
      we call `rustc` with `-Ccodegen-units=1` (and `-Zthreads` is 1 so far),
      so we do not expect parallelism. However, in the upcoming Rust 1.76.0, a
      warning is emitted by `rustc` [1] when it cannot connect to the jobserver
      it was passed (in many cases, but not all: compiling and `--print sysroot`
      do, but `--version` does not). And given GNU Make always passes
      the jobserver in the environment variable (even when a line is deemed
      non-recursive), `rustc` will end up complaining about it (in particular
      in Make 4.3 where there is only the simple pipe jobserver style).
      
      One solution is to remove the jobserver from `MAKEFLAGS`. However, we
      can mark the lines with calls to `rustc` (and Cargo) as recursive, which
      looks simpler. This is being documented as a recommendation in `rustc`
      [2] and allows us to be ready for the time we may use parallelism inside
      `rustc` (potentially now, if a user passes `-Zthreads`). Thus do so.
      
      Similarly, do the same for `rustdoc` and `cargo` calls.
      
      Finally, there is one case that the solution does not cover, which is the
      `$(shell ...)` call we have. Thus, for that one, set an empty `MAKEFLAGS`
      environment variable.
      
      Link: https://github.com/rust-lang/rust/issues/120515
      
       [1]
      Acked-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Link: https://github.com/rust-lang/rust/pull/121564 [2]
      Link: https://lore.kernel.org/r/20240217002638.57373-1-ojeda@kernel.org
      
      
      [ Reworded to add link to PR documenting the recommendation. ]
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      ecab4115
Loading