FAILED: patch "[PATCH] static_call: Fix static_call_set_init()" failed to apply to 5.11-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.11-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 68b1eddd421d2b16c6655eceb48918a1e896bbbc Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <[email protected]>
Date: Thu, 18 Mar 2021 11:27:19 +0100
Subject: [PATCH] static_call: Fix static_call_set_init()
It turns out that static_call_set_init() does not preserve the other flags; IOW. it clears TAIL if it was set.
Fixes 9183c3f9ed710 ("static_call: Add inline static call infrastructure")
Reported-by Sumit Garg <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Acked-by Jarkko Sakkinen <[email protected]>
Tested-by Sumit Garg <[email protected]>
kernel/static_call.c +10 -7
@@ -35,27 +35,30 @@ static inline void *static_call_addr(struct static_call_site *site)return (void *)((long )site->addr + (long )&site->addr); } +static inline unsigned long __static_call_key (const struct static_call_site *site) +{ +return (long )site->key + (long )&site->key; +}static inline struct static_call_key *static_call_key (const struct static_call_site *site) { -return (struct static_call_key *) - (((long )site->key + (long )&site->key) & ~STATIC_CALL_SITE_FLAGS ); +return (void *)(__static_call_key (site) & ~STATIC_CALL_SITE_FLAGS ); }/* These assume the key is word-aligned. */ static inline bool static_call_is_init (struct static_call_site *site) { -return ((long )site->key + (long )&site->key) &STATIC_CALL_SITE_INIT ; +return __static_call_key (site) &STATIC_CALL_SITE_INIT ; }static inline bool static_call_is_tail (struct static_call_site *site) { -return ((long )site->key + (long )&site->key) &STATIC_CALL_SITE_TAIL ; +return __static_call_key (site) &STATIC_CALL_SITE_TAIL ; }static inline void static_call_set_init (struct static_call_site *site) { - site->key = ((long )static_call_key (site) |STATIC_CALL_SITE_INIT ) - + site->key = (__static_call_key (site) |STATIC_CALL_SITE_INIT ) - (long )&site->key; }
@@ -190,7 +193,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) }arch_static_call_transform (site_addr,NULL , func, -static_call_is_tail (site)); +static_call_is_tail (site)); } }
@@ -349,7 +352,7 @@ static int static_call_add_module(struct module *mod)struct static_call_site *site;for (site = start; site != stop; site++) { -unsigned long s_key = (long )site->key + (long )&site->key; +unsigned long s_key =__static_call_key (site);unsigned long addr = s_key & ~STATIC_CALL_SITE_FLAGS ;unsigned long key;