aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/jump_label.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2011-09-29 14:10:05 -0400
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2011-10-25 14:54:15 -0400
commit37348804e0289087d21ae8bff4c0732030a3c6ac (patch)
treedacd987e7e2778b30fccc4e580f852d9dcbd83b2 /kernel/jump_label.c
parent189c3fd68c7016e37c1ffd7a00009e2c944a9d06 (diff)
jump_label: if a key has already been initialized, don't nop it out
If a key has been enabled before jump_label_init() is called, don't nop it out. This removes arch_jump_label_text_poke_early() (which can only nop out a site) and uses arch_jump_label_transform() instead. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: Jason Baron <jbaron@redhat.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'kernel/jump_label.c')
-rw-r--r--kernel/jump_label.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index a8ce45097f3d..059202d5b77a 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -121,13 +121,6 @@ static void __jump_label_update(struct jump_label_key *key,
121 } 121 }
122} 122}
123 123
124/*
125 * Not all archs need this.
126 */
127void __weak arch_jump_label_text_poke_early(jump_label_t addr)
128{
129}
130
131static __init int jump_label_init(void) 124static __init int jump_label_init(void)
132{ 125{
133 struct jump_entry *iter_start = __start___jump_table; 126 struct jump_entry *iter_start = __start___jump_table;
@@ -139,12 +132,15 @@ static __init int jump_label_init(void)
139 jump_label_sort_entries(iter_start, iter_stop); 132 jump_label_sort_entries(iter_start, iter_stop);
140 133
141 for (iter = iter_start; iter < iter_stop; iter++) { 134 for (iter = iter_start; iter < iter_stop; iter++) {
142 arch_jump_label_text_poke_early(iter->code); 135 struct jump_label_key *iterk;
143 if (iter->key == (jump_label_t)(unsigned long)key) 136
137 iterk = (struct jump_label_key *)(unsigned long)iter->key;
138 arch_jump_label_transform(iter, jump_label_enabled(iterk) ?
139 JUMP_LABEL_ENABLE : JUMP_LABEL_DISABLE);
140 if (iterk == key)
144 continue; 141 continue;
145 142
146 key = (struct jump_label_key *)(unsigned long)iter->key; 143 key = iterk;
147 atomic_set(&key->enabled, 0);
148 key->entries = iter; 144 key->entries = iter;
149#ifdef CONFIG_MODULES 145#ifdef CONFIG_MODULES
150 key->next = NULL; 146 key->next = NULL;
@@ -212,7 +208,7 @@ void jump_label_apply_nops(struct module *mod)
212 return; 208 return;
213 209
214 for (iter = iter_start; iter < iter_stop; iter++) 210 for (iter = iter_start; iter < iter_stop; iter++)
215 arch_jump_label_text_poke_early(iter->code); 211 arch_jump_label_transform(iter, JUMP_LABEL_DISABLE);
216} 212}
217 213
218static int jump_label_add_module(struct module *mod) 214static int jump_label_add_module(struct module *mod)