[PATCH RFC 5/8] mips/jump_label: add arch_jump_label_transform_early()

From: Jeremy Fitzhardinge
Date: Thu Sep 29 2011 - 19:26:57 EST


From: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

This allows jump-label entries to be modified early, in a pre-SMP
environment.

XXX TODO: make sure idling CPUs flush their icaches before continuing
in case this modifies something that's adjacent to their init-idle loops.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Cc: David Daney <david.daney@xxxxxxxxxx>
---
arch/mips/kernel/jump_label.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c
index 6001610..ddc9a65 100644
--- a/arch/mips/kernel/jump_label.c
+++ b/arch/mips/kernel/jump_label.c
@@ -20,8 +20,8 @@

#define J_RANGE_MASK ((1ul << 28) - 1)

-void arch_jump_label_transform(struct jump_entry *e,
- enum jump_label_type type)
+static void __jump_label_transform(struct jump_entry *e,
+ enum jump_label_type type)
{
union mips_instruction insn;
union mips_instruction *insn_p =
@@ -40,15 +40,28 @@ void arch_jump_label_transform(struct jump_entry *e,
insn.word = 0; /* nop */
}

- get_online_cpus();
- mutex_lock(&text_mutex);
*insn_p = insn;

flush_icache_range((unsigned long)insn_p,
(unsigned long)insn_p + sizeof(*insn_p));
+}
+
+void arch_jump_label_transform(struct jump_entry *e,
+ enum jump_label_type type)
+{
+ get_online_cpus();
+ mutex_lock(&text_mutex);
+
+ __jump_label_tranform(e, type);

mutex_unlock(&text_mutex);
put_online_cpus();
}

+void __init arch_jump_label_transform_early(struct jump_entry *e,
+ enum jump_label_type type)
+{
+ __jump_label_tranform(e, type);
+}
+
#endif /* HAVE_JUMP_LABEL */
--
1.7.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/