mirror of
https://github.com/torvalds/linux.git
synced 2024-11-19 10:31:48 +00:00
76b235c6bc
Since we've already stepped away from ENABLE is a JMP and DISABLE is a
NOP with the branch_default bits, and are going to make it even worse,
rename it to make it all clearer.
This way we don't mix multiple levels of logic attributes, but have a
plain 'physical' name for what the current instruction patching status
of a jump label is.
This is a first step in removing the naming confusion that has led to
a stream of avoidable bugs such as:
a833581e37
("x86, perf: Fix static_key bug in load_mm_cr4()")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
[ Beefed up the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
42 lines
791 B
C
42 lines
791 B
C
#include <linux/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/cpu.h>
|
|
|
|
#include <linux/jump_label.h>
|
|
#include <linux/memory.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
#ifdef HAVE_JUMP_LABEL
|
|
|
|
void arch_jump_label_transform(struct jump_entry *entry,
|
|
enum jump_label_type type)
|
|
{
|
|
u32 val;
|
|
u32 *insn = (u32 *) (unsigned long) entry->code;
|
|
|
|
if (type == JUMP_LABEL_JMP) {
|
|
s32 off = (s32)entry->target - (s32)entry->code;
|
|
|
|
#ifdef CONFIG_SPARC64
|
|
/* ba,pt %xcc, . + (off << 2) */
|
|
val = 0x10680000 | ((u32) off >> 2);
|
|
#else
|
|
/* ba . + (off << 2) */
|
|
val = 0x10800000 | ((u32) off >> 2);
|
|
#endif
|
|
} else {
|
|
val = 0x01000000;
|
|
}
|
|
|
|
get_online_cpus();
|
|
mutex_lock(&text_mutex);
|
|
*insn = val;
|
|
flushi(insn);
|
|
mutex_unlock(&text_mutex);
|
|
put_online_cpus();
|
|
}
|
|
|
|
#endif
|