From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sumit Garg <sumit.garg@linaro.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Jarkko Sakkinen <jarkko@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/urgent] static_call: Fix static_call_set_init()
Date: Fri, 19 Mar 2021 12:25:08 -0000 [thread overview]
Message-ID: <161615670851.398.10212740171410293456.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210318113610.519406371@infradead.org>
The following commit has been merged into the locking/urgent branch of tip:
Commit-ID: 68b1eddd421d2b16c6655eceb48918a1e896bbbc
Gitweb: https://git.kernel.org/tip/68b1eddd421d2b16c6655eceb48918a1e896bbbc
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 18 Mar 2021 11:27:19 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 19 Mar 2021 13:16:44 +01:00
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 <sumit.garg@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lkml.kernel.org/r/20210318113610.519406371@infradead.org
---
kernel/static_call.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/kernel/static_call.c b/kernel/static_call.c
index ae82529..080c8a9 100644
--- a/kernel/static_call.c
+++ b/kernel/static_call.c
@@ -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;
next prev parent reply other threads:[~2021-03-19 12:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 11:31 [PATCH 0/3] static_call() vs __exit fixes Peter Zijlstra
2021-03-18 11:31 ` [PATCH 1/3] static_call: Fix static_call_set_init() Peter Zijlstra
2021-03-19 12:25 ` tip-bot2 for Peter Zijlstra [this message]
2021-03-18 11:31 ` [PATCH 2/3] static_call: Align static_call_is_init() patching condition Peter Zijlstra
2021-03-19 12:25 ` [tip: locking/urgent] " tip-bot2 for Peter Zijlstra
2021-03-19 13:31 ` [PATCH 2/3] " Rasmus Villemoes
2021-03-19 14:13 ` Peter Zijlstra
2021-03-19 14:40 ` Rasmus Villemoes
2021-03-19 15:44 ` Rasmus Villemoes
2021-03-22 16:59 ` Peter Zijlstra
2021-03-18 11:31 ` [PATCH 3/3] static_call: Fix static_call_update() sanity check Peter Zijlstra
2021-03-18 11:42 ` Peter Zijlstra
2021-03-18 16:13 ` Josh Poimboeuf
2021-03-18 16:58 ` Peter Zijlstra
2021-03-19 12:57 ` Peter Zijlstra
2021-03-19 18:00 ` Steven Rostedt
2021-03-19 19:34 ` Peter Zijlstra
2021-03-19 20:57 ` Steven Rostedt
2021-03-22 14:50 ` Jessica Yu
2021-03-22 16:54 ` Peter Zijlstra
2021-03-22 17:36 ` Jessica Yu
2021-03-22 13:07 ` Jessica Yu
2021-03-22 14:06 ` Peter Zijlstra
2021-03-19 12:25 ` [tip: locking/urgent] " tip-bot2 for Peter Zijlstra
2021-03-18 12:15 ` [PATCH 0/3] static_call() vs __exit fixes Sumit Garg
2021-03-18 19:38 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=161615670851.398.10212740171410293456.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sumit.garg@linaro.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).