]> Git Repo - linux.git/commitdiff
Merge tag 'mm-nonmm-stable-2024-05-22-17-30' of git://git.kernel.org/pub/scm/linux...
authorLinus Torvalds <[email protected]>
Thu, 23 May 2024 01:59:29 +0000 (18:59 -0700)
committerLinus Torvalds <[email protected]>
Thu, 23 May 2024 01:59:29 +0000 (18:59 -0700)
Pull more non-mm updates from Andrew Morton:

 - A series ("kbuild: enable more warnings by default") from Arnd
   Bergmann which enables a number of additional build-time warnings. We
   fixed all the fallout which we could find, there may still be a few
   stragglers.

 - Samuel Holland has developed the series "Unified cross-architecture
   kernel-mode FPU API". This does a lot of consolidation of
   per-architecture kernel-mode FPU usage and enables the use of newer
   AMD GPUs on RISC-V.

 - Tao Su has fixed some selftests build warnings in the series
   "Selftests: Fix compilation warnings due to missing _GNU_SOURCE
   definition".

 - This pull also includes a nilfs2 fixup from Ryusuke Konishi.

* tag 'mm-nonmm-stable-2024-05-22-17-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (23 commits)
  nilfs2: make block erasure safe in nilfs_finish_roll_forward()
  selftests/harness: use 1024 in place of LINE_MAX
  Revert "selftests/harness: remove use of LINE_MAX"
  selftests/fpu: allow building on other architectures
  selftests/fpu: move FP code to a separate translation unit
  drm/amd/display: use ARCH_HAS_KERNEL_FPU_SUPPORT
  drm/amd/display: only use hard-float, not altivec on powerpc
  riscv: add support for kernel-mode FPU
  x86: implement ARCH_HAS_KERNEL_FPU_SUPPORT
  powerpc: implement ARCH_HAS_KERNEL_FPU_SUPPORT
  LoongArch: implement ARCH_HAS_KERNEL_FPU_SUPPORT
  lib/raid6: use CC_FLAGS_FPU for NEON CFLAGS
  arm64: crypto: use CC_FLAGS_FPU for NEON CFLAGS
  arm64: implement ARCH_HAS_KERNEL_FPU_SUPPORT
  ARM: crypto: use CC_FLAGS_FPU for NEON CFLAGS
  ARM: implement ARCH_HAS_KERNEL_FPU_SUPPORT
  arch: add ARCH_HAS_KERNEL_FPU_SUPPORT
  x86/fpu: fix asm/fpu/types.h include guard
  kbuild: enable -Wcast-function-type-strict unconditionally
  kbuild: enable -Wformat-truncation on clang
  ...

1  2 
Documentation/core-api/index.rst
arch/loongarch/Kconfig
arch/loongarch/Makefile
arch/riscv/Kconfig
arch/riscv/Makefile
arch/x86/Makefile
lib/Kconfig.debug
tools/testing/selftests/kselftest_harness.h

index 89c5176657631bc289f6de845f917c91c61c4b7b,974beccd671f64a94968fdefd4ffcdab86516f0c..f147854700e4429568897317fea2f3bffb597a79
@@@ -48,6 -48,7 +48,7 @@@ Library functionality that is used thro
     errseq
     wrappers/atomic_t
     wrappers/atomic_bitops
+    floating-point
  
  Low level entry and exit
  ========================
@@@ -102,7 -103,6 +103,7 @@@ more memory-management documentation i
     dma-api-howto
     dma-attributes
     dma-isa-lpc
 +   swiotlb
     mm-api
     genalloc
     pin_user_pages
diff --combined arch/loongarch/Kconfig
index a2774ad5e916081f1b91d6037bb59a7cb62fb6c5,b94223f589083c79b1c75e668ffbb8d33f93b0d3..e38139c576ee90aa1ee18ff034582043b53fe1dd
@@@ -16,9 -16,9 +16,10 @@@ config LOONGARC
        select ARCH_HAS_ACPI_TABLE_UPGRADE      if ACPI
        select ARCH_HAS_CPU_FINALIZE_INIT
        select ARCH_HAS_CURRENT_STACK_POINTER
 +      select ARCH_HAS_FAST_MULTIPLIER
        select ARCH_HAS_FORTIFY_SOURCE
        select ARCH_HAS_KCOV
+       select ARCH_HAS_KERNEL_FPU_SUPPORT if CPU_HAS_FPU
        select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
        select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
        select ARCH_HAS_PTE_SPECIAL
@@@ -57,7 -57,6 +58,7 @@@
        select ARCH_SUPPORTS_ACPI
        select ARCH_SUPPORTS_ATOMIC_RMW
        select ARCH_SUPPORTS_HUGETLBFS
 +      select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
        select ARCH_SUPPORTS_LTO_CLANG
        select ARCH_SUPPORTS_LTO_CLANG_THIN
        select ARCH_SUPPORTS_NUMA_BALANCING
        select ARCH_USE_CMPXCHG_LOCKREF
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
 +      select ARCH_WANT_DEFAULT_BPF_JIT
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
        select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
        select ARCH_WANTS_NO_INSTR
 +      select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select BUILDTIME_TABLE_SORT
        select COMMON_CLK
        select CPU_PM
        select PCI_QUIRKS
        select PERF_USE_VMALLOC
        select RTC_LIB
 -      select SMP
        select SPARSE_IRQ
        select SYSCTL_ARCH_UNALIGN_ALLOW
        select SYSCTL_ARCH_UNALIGN_NO_WARN
@@@ -423,7 -421,6 +424,7 @@@ config EFI_STU
  
  config SCHED_SMT
        bool "SMT scheduler support"
 +      depends on SMP
        default y
        help
          Improves scheduler's performance when there are multiple
diff --combined arch/loongarch/Makefile
index 4347915721bd9bb549df58c38331cd70fa7cb9a8,efb5440a43ec4c0d7e2992ce894f219a49230d40..8674e7e24c4a63bd33caf7f84c48b4f2ae87e370
@@@ -26,6 -26,9 +26,9 @@@ endi
  32bit-emul            = elf32loongarch
  64bit-emul            = elf64loongarch
  
+ CC_FLAGS_FPU          := -mfpu=64
+ CC_FLAGS_NO_FPU               := -msoft-float
  ifdef CONFIG_UNWINDER_ORC
  orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h
  orc_hash_sh := $(srctree)/scripts/orc_hash.sh
@@@ -59,7 -62,7 +62,7 @@@ ld-emul                       = $(64bit-emul
  cflags-y              += -mabi=lp64s
  endif
  
- cflags-y                      += -pipe -msoft-float
+ cflags-y                      += -pipe $(CC_FLAGS_NO_FPU)
  LDFLAGS_vmlinux                       += -static -n -nostdlib
  
  # When the assembler supports explicit relocation hint, we must use it.
@@@ -101,7 -104,7 +104,7 @@@ ifdef CONFIG_OBJTOO
  KBUILD_CFLAGS                 += -fno-jump-tables
  endif
  
 -KBUILD_RUSTFLAGS                      += --target=$(objtree)/scripts/target.json
 +KBUILD_RUSTFLAGS              += --target=loongarch64-unknown-none-softfloat
  KBUILD_RUSTFLAGS_MODULE               += -Crelocation-model=pic
  
  ifeq ($(CONFIG_RELOCATABLE),y)
diff --combined arch/riscv/Kconfig
index 0bdcc383644d9936f44959d1dcea5d3b8165a67b,8f10a2fb5f86f556f7913a1f77d2adaf27a0f097..5468ccfd72237da9202beedf76da9f631ceb69f4
@@@ -23,11 -23,11 +23,12 @@@ config RISC
        select ARCH_HAS_DEBUG_VIRTUAL if MMU
        select ARCH_HAS_DEBUG_VM_PGTABLE
        select ARCH_HAS_DEBUG_WX
 +      select ARCH_HAS_FAST_MULTIPLIER
        select ARCH_HAS_FORTIFY_SOURCE
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_GIGANTIC_PAGE
        select ARCH_HAS_KCOV
+       select ARCH_HAS_KERNEL_FPU_SUPPORT if 64BIT && FPU
        select ARCH_HAS_MEMBARRIER_CALLBACKS
        select ARCH_HAS_MEMBARRIER_SYNC_CORE
        select ARCH_HAS_MMIOWB
        select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
        select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
        select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
 +      select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USES_CFI_TRAPS if CFI_CLANG
 -      select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if SMP && MMU
 +      select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if MMU
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_GENERAL_HUGETLB if !RISCV_ISA_SVNAPOT
@@@ -73,7 -72,7 +74,7 @@@
        select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
        select BUILDTIME_TABLE_SORT if MMU
 -      select CLINT_TIMER if !MMU
 +      select CLINT_TIMER if RISCV_M_MODE
        select CLONE_BACKWARDS
        select COMMON_CLK
        select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_RETHOOK if !XIP_KERNEL
        select HAVE_RSEQ
 +      select HAVE_RUST if 64BIT
        select HAVE_SAMPLE_FTRACE_DIRECT
        select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
        select HAVE_STACKPROTECTOR
@@@ -234,12 -232,8 +235,12 @@@ config ARCH_MMAP_RND_COMPAT_BITS_MA
  
  # set if we run in machine mode, cleared if we run in supervisor mode
  config RISCV_M_MODE
 -      bool
 -      default !MMU
 +      bool "Build a kernel that runs in machine mode"
 +      depends on !MMU
 +      default y
 +      help
 +        Select this option if you want to run the kernel in M-mode,
 +        without the assistance of any other firmware.
  
  # set if we are running in S-mode and can use SBI calls
  config RISCV_SBI
@@@ -256,9 -250,8 +257,9 @@@ config MM
  
  config PAGE_OFFSET
        hex
 -      default 0xC0000000 if 32BIT && MMU
 -      default 0x80000000 if !MMU
 +      default 0x80000000 if !MMU && RISCV_M_MODE
 +      default 0x80200000 if !MMU
 +      default 0xc0000000 if 32BIT
        default 0xff60000000000000 if 64BIT
  
  config KASAN_SHADOW_OFFSET
@@@ -606,6 -599,7 +607,6 @@@ config TOOLCHAIN_HAS_VECTOR_CRYPT
  config RISCV_ISA_ZBB
        bool "Zbb extension support for bit manipulation instructions"
        depends on TOOLCHAIN_HAS_ZBB
 -      depends on MMU
        depends on RISCV_ALTERNATIVE
        default y
        help
@@@ -637,6 -631,7 +638,6 @@@ config RISCV_ISA_ZICBO
  
  config RISCV_ISA_ZICBOZ
        bool "Zicboz extension support for faster zeroing of memory"
 -      depends on MMU
        depends on RISCV_ALTERNATIVE
        default y
        help
diff --combined arch/riscv/Makefile
index c537764ee3c90c9e6ef47ddf3920fd6577621ad5,0577d34fb1a74e5e2f6aa47b80d0ffaa6d3b5620..ec47787acd89274be87100d0f2046350ada4d9ef
@@@ -34,9 -34,6 +34,9 @@@ ifeq ($(CONFIG_ARCH_RV64I),y
        KBUILD_AFLAGS += -mabi=lp64
  
        KBUILD_LDFLAGS += -melf64lriscv
 +
 +      KBUILD_RUSTFLAGS += -Ctarget-cpu=generic-rv64 --target=riscv64imac-unknown-none-elf \
 +                          -Cno-redzone
  else
        BITS := 32
        UTS_MACHINE := riscv32
@@@ -71,10 -68,6 +71,10 @@@ riscv-march-$(CONFIG_FPU)           := $(riscv-m
  riscv-march-$(CONFIG_RISCV_ISA_C)     := $(riscv-march-y)c
  riscv-march-$(CONFIG_RISCV_ISA_V)     := $(riscv-march-y)v
  
 +ifneq ($(CONFIG_RISCV_ISA_C),y)
 +      KBUILD_RUSTFLAGS += -Ctarget-feature=-c
 +endif
 +
  ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC
  KBUILD_CFLAGS += -Wa,-misa-spec=2.2
  KBUILD_AFLAGS += -Wa,-misa-spec=2.2
@@@ -91,6 -84,9 +91,9 @@@ KBUILD_CFLAGS += -march=$(shell echo $(
  
  KBUILD_AFLAGS += -march=$(riscv-march-y)
  
+ # For C code built with floating-point support, exclude V but keep F and D.
+ CC_FLAGS_FPU  := -march=$(shell echo $(riscv-march-y) | sed -E 's/(rv32ima|rv64ima)([^v_]*)v?/\1\2/')
  KBUILD_CFLAGS += -mno-save-restore
  KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
  
@@@ -140,15 -136,7 +143,15 @@@ boot             := arch/riscv/boo
  ifeq ($(CONFIG_XIP_KERNEL),y)
  KBUILD_IMAGE := $(boot)/xipImage
  else
 +ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN_K210),yy)
 +KBUILD_IMAGE := $(boot)/loader.bin
 +else
 +ifeq ($(CONFIG_EFI_ZBOOT),)
  KBUILD_IMAGE  := $(boot)/Image.gz
 +else
 +KBUILD_IMAGE := $(boot)/vmlinuz.efi
 +endif
 +endif
  endif
  
  libs-y += arch/riscv/lib/
@@@ -168,6 -156,17 +171,6 @@@ endi
  vdso-install-y                        += arch/riscv/kernel/vdso/vdso.so.dbg
  vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg
  
 -ifneq ($(CONFIG_XIP_KERNEL),y)
 -ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN_K210),yy)
 -KBUILD_IMAGE := $(boot)/loader.bin
 -else
 -ifeq ($(CONFIG_EFI_ZBOOT),)
 -KBUILD_IMAGE := $(boot)/Image.gz
 -else
 -KBUILD_IMAGE := $(boot)/vmlinuz.efi
 -endif
 -endif
 -endif
  BOOT_TARGETS := Image Image.gz loader loader.bin xipImage vmlinuz.efi
  
  all:  $(notdir $(KBUILD_IMAGE))
diff --combined arch/x86/Makefile
index e71e5252763f051e86f260bcd83eaee294464f7f,164498b3382ae25a7ba90a2c2c537473b76a17f1..801fd85c3ef693d10e55e535072f24eb7cf1ee50
@@@ -74,6 -74,26 +74,26 @@@ KBUILD_CFLAGS += -mno-sse -mno-mmx -mno
  KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
  KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
  
+ #
+ # CFLAGS for compiling floating point code inside the kernel.
+ #
+ CC_FLAGS_FPU := -msse -msse2
+ ifdef CONFIG_CC_IS_GCC
+ # Stack alignment mismatch, proceed with caution.
+ # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
+ # (8B stack alignment).
+ # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
+ #
+ # The "-msse" in the first argument is there so that the
+ # -mpreferred-stack-boundary=3 build error:
+ #
+ #  -mpreferred-stack-boundary=3 is not between 4 and 12
+ #
+ # can be triggered. Otherwise gcc doesn't complain.
+ CC_FLAGS_FPU += -mhard-float
+ CC_FLAGS_FPU += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
+ endif
  ifeq ($(CONFIG_X86_KERNEL_IBT),y)
  #
  # Kernel IBT has S_CET.NOTRACK_EN=0, as such the compilers must not generate
@@@ -258,7 -278,7 +278,7 @@@ drivers-$(CONFIG_PCI)            += arc
  # suspend and hibernation support
  drivers-$(CONFIG_PM) += arch/x86/power/
  
 -drivers-$(CONFIG_FB_CORE) += arch/x86/video/
 +drivers-$(CONFIG_VIDEO) += arch/x86/video/
  
  ####
  # boot loader support. Several targets are kept for legacy purposes
diff --combined lib/Kconfig.debug
index 4bcdb2fd17d8ee5e3d7ea1b8c24b05208f5b267f,f4384fd60a769d00d2ab49ca57a31d04931ae29b..59b6765d86b8fc6a5f8c55b6daaae545c1c14f7f
@@@ -2482,6 -2482,7 +2482,6 @@@ config TEST_LK
  
  config TEST_BITOPS
        tristate "Test module for compilation of bitops operations"
 -      depends on m
        help
          This builds the "test_bitops" module that is much like the
          TEST_LKM module except that it does a basic exercise of the
@@@ -2925,7 -2926,7 +2925,7 @@@ config TEST_FREE_PAGE
  
  config TEST_FPU
        tristate "Test floating point operations in kernel space"
-       depends on X86 && !KCOV_INSTRUMENT_ALL
+       depends on ARCH_HAS_KERNEL_FPU_SUPPORT && !KCOV_INSTRUMENT_ALL
        help
          Enable this option to add /sys/kernel/debug/selftest_helpers/test_fpu
          which will trigger a sequence of floating point operations. This is used
index 3c8f2965c2850c8fa0a95259433857e4a324641b,98749f5a2e5635cf53ceb34b1cf3b2f79d5396a5..b634969cbb6f13b3ebfb9f5b7b178d487ecb4b14
@@@ -51,7 -51,7 +51,7 @@@
  #define __KSELFTEST_HARNESS_H
  
  #ifndef _GNU_SOURCE
 -static_assert(0, "kselftest harness requires _GNU_SOURCE to be defined");
 +#define _GNU_SOURCE
  #endif
  #include <asm/types.h>
  #include <ctype.h>
@@@ -1216,7 -1216,7 +1216,7 @@@ void __run_test(struct __fixture_metada
                struct __test_metadata *t)
  {
        struct __test_xfail *xfail;
-       char *test_name;
+       char test_name[1024];
        const char *diagnostic;
  
        /* reset test struct */
        memset(t->env, 0, sizeof(t->env));
        memset(t->results->reason, 0, sizeof(t->results->reason));
  
-       if (asprintf(&test_name, "%s%s%s.%s", f->name,
-               variant->name[0] ? "." : "", variant->name, t->name) == -1) {
-               ksft_print_msg("ERROR ALLOCATING MEMORY\n");
-               t->exit_code = KSFT_FAIL;
-               _exit(t->exit_code);
-       }
+       snprintf(test_name, sizeof(test_name), "%s%s%s.%s",
+                f->name, variant->name[0] ? "." : "", variant->name, t->name);
  
        ksft_print_msg(" RUN           %s ...\n", test_name);
  
  
        ksft_test_result_code(t->exit_code, test_name,
                              diagnostic ? "%s" : NULL, diagnostic);
-       free(test_name);
  }
  
  static int test_harness_run(int argc, char **argv)
This page took 0.166083 seconds and 4 git commands to generate.