]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
arch/xtensa: always_inline get_current() and current_thread_info()
authorSuren Baghdasaryan <surenb@google.com>
Thu, 4 Jul 2024 13:25:06 +0000 (06:25 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 9 Jul 2024 22:41:10 +0000 (15:41 -0700)
Mark get_current() and current_thread_info() functions as always_inline to
fix the following modpost warning:

WARNING: modpost: vmlinux: section mismatch in reference: get_current+0xc (section: .text.unlikely) -> initcall_level_names (section: .init.data)

The warning happens when these functions are called from an __init
function and they don't get inlined (remain in the .text section) while
the value they return points into .init.data section.  Assuming
get_current() always returns a valid address, this situation can happen
only during init stage and accessing .init.data from .text section during
that stage should pose no issues.

Link: https://lkml.kernel.org/r/20240704132506.1011978-2-surenb@google.com
Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Chris Zankel <chris@zankel.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: kernel test robot <lkp@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/xtensa/include/asm/current.h
arch/xtensa/include/asm/thread_info.h

index 08010dbf5e09a3cbc0c325c91dbe0b19764ddf6a..df275d55478849ff57300dfaf4bfe96a7413ad83 100644 (file)
@@ -19,7 +19,7 @@
 
 struct task_struct;
 
-static inline struct task_struct *get_current(void)
+static __always_inline struct task_struct *get_current(void)
 {
        return current_thread_info()->task;
 }
index 326db1c1d5d8d4c44bacc1f27a4cc39ee4fe4742..e0dffcc43b9e641d74ca0178b83c33bbf027a71a 100644 (file)
@@ -91,7 +91,7 @@ struct thread_info {
 }
 
 /* how to get the thread information struct from C */
-static inline struct thread_info *current_thread_info(void)
+static __always_inline struct thread_info *current_thread_info(void)
 {
        struct thread_info *ti;
         __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"