kernel: context_tracking: use extern function instead of static inline function for user_enter/exit()
PATCH 1/1 kernel: context_tracking: use extern function instead of static inline function for user_enter/exit()
The related assemble code can not find the static inline function. The related commit "ad65782 context_tracking: Optimize main APIs off case with static key" causes this issue.
The related error (for arm, with allmodconfig):
LD init/built-in.o
arch/arm/kernel/built-in.o: In function `ret_fast_syscall':
arch/arm/kernel/entry-common.S:42: undefined reference to user_enter' arch/arm/kernel/built-in.o: In function no_work_pending':
arch/arm/kernel/entry-common.S:77: undefined reference to user_enter' arch/arm/kernel/built-in.o: In function vector_swi':
arch/arm/kernel/entry-common.S:376: undefined reference to user_exit' arch/arm/kernel/built-in.o: In function __dabt_usr':
arch/arm/kernel/entry-armv.S:365: undefined reference to user_exit' arch/arm/kernel/built-in.o: In function __irq_usr':
arch/arm/kernel/entry-armv.S:375: undefined reference to user_exit' arch/arm/kernel/built-in.o: In function __und_usr':
arch/arm/kernel/entry-armv.S:388: undefined reference to user_exit' arch/arm/kernel/built-in.o: In function __pabt_usr':
arch/arm/kernel/entry-armv.S:662: undefined reference to `user_exit'
--- include/linux/context_tracking.h | 14 ++------------ kernel/context_tracking.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-)
include/linux/context_tracking.h +2 -12
@@ -10,23 +10,13 @@#ifdef CONFIG_CONTEXT_TRACKING extern void context_tracking_cpu_set (int cpu); +extern void user_enter (void ); +extern void user_exit (void );extern void context_tracking_user_enter (void );extern void context_tracking_user_exit (void );extern void __context_tracking_task_switch (struct task_struct *prev,struct task_struct *next); -static inline void user_enter (void ) -{ -if (static_key_false (&context_tracking_enabled)) -context_tracking_user_enter (); - -} -static inline void user_exit (void ) -{ -if (static_key_false (&context_tracking_enabled)) -context_tracking_user_exit (); -} -static inline enum ctx_state exception_enter (void ) {enum ctx_state prev_ctx;
kernel/context_tracking.c +12 -0
@@ -29,6 +29,18 @@ EXPORT_SYMBOL_GPL(context_tracking_enabled); DEFINE_PER_CPU(struct context_tracking, context_tracking);EXPORT_SYMBOL_GPL (context_tracking); +void user_enter (void ) +{ +if (static_key_false (&context_tracking_enabled)) +context_tracking_user_enter (); +} + +void user_exit (void ) +{ +if (static_key_false (&context_tracking_enabled)) +context_tracking_user_exit (); +} +void context_tracking_cpu_set (int cpu) {if (!per_cpu (context_tracking.active, cpu)) {
Signature · 1 line
1.7.7.6
Quoted 50 lines · Chen Gang
Signed-off-by Chen Gang <[email protected]>--- include/linux/context_tracking.h | 14 ++------------ kernel/context_tracking.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-)include/linux/context_tracking.h +2
-12@@ -10,23 +10,13 @@#ifdef CONFIG_CONTEXT_TRACKING extern void context_tracking_cpu_set (int cpu); +extern void user_enter (void ); +extern void user_exit (void );extern void context_tracking_user_enter (void );extern void context_tracking_user_exit (void );extern void __context_tracking_task_switch (struct task_struct *prev,struct task_struct *next); -static inline void user_enter (void ) -{ -if (static_key_false (&context_tracking_enabled)) -context_tracking_user_enter (); - -} -static inline void user_exit (void ) -{ -if (static_key_false (&context_tracking_enabled)) -context_tracking_user_exit (); -} -static inline enum ctx_state exception_enter (void ) {enum ctx_state prev_ctx;kernel/context_tracking.c +5
-0@@ -29,6 +29,18 @@ EXPORT_SYMBOL_GPL(context_tracking_enabled); DEFINE_PER_CPU(struct context_tracking, context_tracking);EXPORT_SYMBOL_GPL (context_tracking); +void user_enter (void ) +{ +if (static_key_false (&context_tracking_enabled)) +context_tracking_user_enter (); +}
kernel/context_tracking.c EXPORT_SYMBOL_GPL(context_tracking_enabled); · line 46
Quoted 10 lines
kernel/context_tracking.c +7
-0+ +void user_exit (void ) +{ +if (static_key_false (&context_tracking_enabled)) +context_tracking_user_exit (); +} +void context_tracking_cpu_set (int cpu) {if (!per_cpu (context_tracking.active, cpu)) {
Ug, you just put an unneeded function call into a fast path because of a failure with a particular arch.
If you need the assembly to call this code, then make yourself a wrapper function to call that does the user_enter/exit() calls.
void arch_user_enter(void)
{
user_enter();
}-- Steve
Quoted 66 lines · Steven Rostedt
Quoted 50 lines · Chen Gang
Signed-off-by Chen Gang <[email protected]>--- include/linux/context_tracking.h | 14 ++------------ kernel/context_tracking.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-)include/linux/context_tracking.h +2
-12@@ -10,23 +10,13 @@#ifdef CONFIG_CONTEXT_TRACKING extern void context_tracking_cpu_set (int cpu); +extern void user_enter (void ); +extern void user_exit (void );extern void context_tracking_user_enter (void );extern void context_tracking_user_exit (void );extern void __context_tracking_task_switch (struct task_struct *prev,struct task_struct *next); -static inline void user_enter (void ) -{ -if (static_key_false (&context_tracking_enabled)) -context_tracking_user_enter (); - -} -static inline void user_exit (void ) -{ -if (static_key_false (&context_tracking_enabled)) -context_tracking_user_exit (); -} -static inline enum ctx_state exception_enter (void ) {enum ctx_state prev_ctx;kernel/context_tracking.c +5
-0@@ -29,6 +29,18 @@ EXPORT_SYMBOL_GPL(context_tracking_enabled); DEFINE_PER_CPU(struct context_tracking, context_tracking);EXPORT_SYMBOL_GPL (context_tracking); +void user_enter (void ) +{ +if (static_key_false (&context_tracking_enabled)) +context_tracking_user_enter (); +}kernel/context_tracking.c EXPORT_SYMBOL_GPL(context_tracking_enabled); · line 46
Quoted 10 lines
kernel/context_tracking.c +7
-0+ +void user_exit (void ) +{ +if (static_key_false (&context_tracking_enabled)) +context_tracking_user_exit (); +} +void context_tracking_cpu_set (int cpu) {if (!per_cpu (context_tracking.active, cpu)) {Ug, you just put an unneeded function call into a fast path because of a failure with a particular arch.
Quoted 8 lines
If you need the assembly to call this code, then make yourself a wrapper function to call that does the user_enter/exit() calls.
void
arch_user_enter(void){ user_enter(); }
OK, thanks. That sounds reasonable to me. I will send related patch to arm guys. :-)
Thanks.
Signature · 1 line
Chen Gang
Quoted 8 lines · Chen Gang
Quoted 5 lines
void
arch_user_enter(void){ user_enter(); }OK, thanks. That sounds reasonable to me. I will send related patch to arm guys. :-)
If you do so, don't call it "arch_user_enter()", maybe call it "asm_user_enter()", as "arch_*" is something used to be called by the generic code. My mistake in using that as an example.
-- Steve
Quoted 8 lines · Steven Rostedt
Quoted 6 lines · Chen Gang
Quoted 5 lines
void
arch_user_enter(void){ user_enter(); }
Quoted 7 lines
Quoted 2 lines
OK, thanks. That sounds reasonable to me. I will send related patch to arm guys. :-)
If you do so, don't call it "
arch_user_enter()", maybe call it "asm_user_enter()", as "arch_*" is something used to be called by the generic code. My mistake in using that as an example.
Oh, yes, what you said is an example, I need reference it, but should not depend on it.
Hmm... for me "asm_user_enter" seems still a little 'generic' (e.g. "asm-generic", "arch/*/include/asm/"), maybe just use common extern functions' name is enough (e.g. "wrap_user_enter").
But all together, I feel your original fix patch is well enough to me, it seems don't need additional trying. :-)
Quoted 5 lines
-- Steve
Thanks.
Signature · 1 line
Chen Gang
Quoted 23 lines · Chen Gang
The related assemble code can not find the static inline function. The related commit "ad65782
context_tracking: Optimize main APIs off case with static key" causes this issue.The related error (for arm, with allmodconfig):
LD
init/built-in.o
arch/arm/kernel/built-in.o: In function `ret_fast_syscall':
arch/arm/kernel/entry-common.S:42: undefined reference touser_enter' arch/arm/kernel/built-in.o: In functionno_work_pending':
arch/arm/kernel/entry-common.S:77: undefined reference touser_enter' arch/arm/kernel/built-in.o: In functionvector_swi':
arch/arm/kernel/entry-common.S:376: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__dabt_usr':
arch/arm/kernel/entry-armv.S:365: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__irq_usr':
arch/arm/kernel/entry-armv.S:375: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__und_usr':
arch/arm/kernel/entry-armv.S:388: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__pabt_usr':
arch/arm/kernel/entry-armv.S:662: undefined reference to `user_exit'
Quoted 1 line
Signed-off-by Chen Gang <[email protected]>
Doesn't 0c06a5d4b13cd66c833805a0d1db76b977944aac
("arm: Fix build error with context tracking calls") fix the issue for you? Or may be it's another problem I missed?
Thanks.
Quoted 24 lines · Frederic Weisbecker
Quoted 23 lines · Chen Gang
The related assemble code can not find the static inline function. The related commit "ad65782
context_tracking: Optimize main APIs off case with static key" causes this issue.The related error (for arm, with allmodconfig):
LD
init/built-in.o
arch/arm/kernel/built-in.o: In function `ret_fast_syscall':
arch/arm/kernel/entry-common.S:42: undefined reference touser_enter' arch/arm/kernel/built-in.o: In functionno_work_pending':
arch/arm/kernel/entry-common.S:77: undefined reference touser_enter' arch/arm/kernel/built-in.o: In functionvector_swi':
arch/arm/kernel/entry-common.S:376: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__dabt_usr':
arch/arm/kernel/entry-armv.S:365: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__irq_usr':
arch/arm/kernel/entry-armv.S:375: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__und_usr':
arch/arm/kernel/entry-armv.S:388: undefined reference touser_exit' arch/arm/kernel/built-in.o: In function__pabt_usr':
arch/arm/kernel/entry-armv.S:662: undefined reference to `user_exit'
Quoted 6 lines
Quoted 1 line
Signed-off-by Chen Gang <[email protected]>Doesn't
0c06a5d4b13cd66c833805a0d1db76b977944aac
("arm: Fix build error with context tracking calls") fix the issue for you? Or may be it's another problem I missed?
Oh, yes it is, it is my fault, I still use original next-20130927 tree (I really need reference another next tree or torvalds tree). :-)
Next, I will/should reference another next tree, at least.
Thanks again.
Quoted 3 lines
Thanks.
Signature · 1 line
Chen Gang