static_call_inline: Provide trampoline address when updating sites
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 3 Dec 2024 19:44:49 +0000 (20:44 +0100)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 26 Feb 2025 15:39:43 +0000 (21:09 +0530)
In preparation of support of inline static calls on powerpc, provide
trampoline address when updating sites, so that when the destination
function is too far for a direct function call, the call site is
patched with a call to the trampoline.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/5efe0cffc38d6f69b1ec13988a99f1acff551abf.1733245362.git.christophe.leroy@csgroup.eu
arch/x86/kernel/static_call.c
kernel/static_call_inline.c

index 9e51242ed125eec595641b3af9ca3bf7547a0f79..a59c72e7764522bb0e19fae79b51e0d12f9ca0bf 100644 (file)
@@ -158,7 +158,7 @@ void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
 {
        mutex_lock(&text_mutex);
 
-       if (tramp) {
+       if (tramp && !site) {
                __static_call_validate(tramp, true, true);
                __static_call_transform(tramp, __sc_insn(!func, true), func, false);
        }
index bb7d066a7c397926ad387094adea9a02dd626e20..a297790b733382c2fca587da47cb0cd488d8c9c4 100644 (file)
@@ -206,7 +206,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func)
                                continue;
                        }
 
-                       arch_static_call_transform(site_addr, NULL, func,
+                       arch_static_call_transform(site_addr, tramp, func,
                                                   static_call_is_tail(site));
                }
        }