1. 08 Nov, 2023 3 commits
    • Nathan Chancellor's avatar
      LoongArch: Mark __percpu functions as always inline · 71945968
      Nathan Chancellor authored
      A recent change to the optimization pipeline in LLVM reveals some
      fragility around the inlining of LoongArch's __percpu functions, which
      manifests as a BUILD_BUG() failure:
      
        In file included from kernel/sched/build_policy.c:17:
        In file included from include/linux/sched/cputime.h:5:
        In file included from include/linux/sched/signal.h:5:
        In file included from include/linux/rculist.h:11:
        In file included from include/linux/rcupdate.h:26:
        In file included from include/linux/irqflags.h:18:
        arch/loongarch/include/asm/percpu.h:97:3: error: call to '__compiletime_assert_51' declared with 'error' attribute: BUILD_BUG failed
           97 |                 BUILD_BUG();
              |                 ^
        include/linux/build_bug.h:59:21: note: expanded from macro 'BUILD_BUG'
           59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
              |                     ^
        include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
           39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
              |                                     ^
        include/linux/compiler_types.h:425:2: note: expanded from macro 'compiletime_assert'
          425 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
              |         ^
        include/linux/compiler_types.h:413:2: note: expanded from macro '_compiletime_assert'
          413 |         __compiletime_assert(condition, msg, prefix, suffix)
              |         ^
        include/linux/compiler_types.h:406:4: note: expanded from macro '__compiletime_assert'
          406 |                         prefix ## suffix();                             \
              |                         ^
        <scratch space>:86:1: note: expanded from here
           86 | __compiletime_assert_51
              | ^
        1 error generated.
      
      If these functions are not inlined (which the compiler is free to do
      even with functions marked with the standard 'inline' keyword), the
      BUILD_BUG() in the default case cannot be eliminated since the compiler
      cannot prove it is never used, resulting in a build failure due to the
      error attribute.
      
      Mark these functions as __always_inline to guarantee inlining so that
      the BUILD_BUG() only triggers when the default case genuinely cannot be
      eliminated due to an unexpected size.
      
      Cc:  <stable@vger.kernel.org>
      Closes: https://github.com/ClangBuiltLinux/linux/issues/1955
      Fixes: 46859ac8 ("LoongArch: Add multi-processor (SMP) support")
      Link: https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16eSuggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      71945968
    • WANG Rui's avatar
      LoongArch: Disable module from accessing external data directly · 21eb2bfe
      WANG Rui authored
      The distance between vmlinux and the module is too far so that PC-REL
      cannot be accessed directly, only GOT.
      
      When compiling module with GCC, the option `-mdirect-extern-access` is
      disabled by default. The Clang option `-fdirect-access-external-data` is
      enabled by default, so it needs to be explicitly disabled.
      Signed-off-by: default avatarWANG Rui <wangrui@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      21eb2bfe
    • Huacai Chen's avatar
      LoongArch: Support PREEMPT_DYNAMIC with static keys · 80c7889d
      Huacai Chen authored
      Since commit 4e90d052 ("riscv: support PREEMPT_DYNAMIC with
      static keys"), the infrastructure is complete and we can simply select
      HAVE_PREEMPT_DYNAMIC_KEY to enable PREEMPT_DYNAMIC on LoongArch because
      we already support static keys.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      80c7889d
  2. 01 Nov, 2023 1 commit
  3. 30 Oct, 2023 1 commit
  4. 28 Oct, 2023 15 commits
  5. 27 Oct, 2023 15 commits
  6. 26 Oct, 2023 5 commits