[PATCH -v2 1/8] jump_label: Rename JUMP_LABEL_{EN,DIS}ABLE

From: Peter Zijlstra
Date: Tue Jul 28 2015 - 09:27:57 EST


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 to make it clearer.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
arch/arm/kernel/jump_label.c | 2 +-
arch/arm64/kernel/jump_label.c | 2 +-
arch/mips/kernel/jump_label.c | 2 +-
arch/powerpc/kernel/jump_label.c | 2 +-
arch/s390/kernel/jump_label.c | 2 +-
arch/sparc/kernel/jump_label.c | 2 +-
arch/x86/kernel/jump_label.c | 2 +-
include/linux/jump_label.h | 4 ++--
kernel/jump_label.c | 18 +++++++++---------
9 files changed, 18 insertions(+), 18 deletions(-)

--- a/arch/arm/kernel/jump_label.c
+++ b/arch/arm/kernel/jump_label.c
@@ -12,7 +12,7 @@ static void __arch_jump_label_transform(
void *addr = (void *)entry->code;
unsigned int insn;

- if (type == JUMP_LABEL_ENABLE)
+ if (type == JUMP_LABEL_JMP)
insn = arm_gen_branch(entry->code, entry->target);
else
insn = arm_gen_nop();
--- a/arch/arm64/kernel/jump_label.c
+++ b/arch/arm64/kernel/jump_label.c
@@ -28,7 +28,7 @@ void arch_jump_label_transform(struct ju
void *addr = (void *)entry->code;
u32 insn;

- if (type == JUMP_LABEL_ENABLE) {
+ if (type == JUMP_LABEL_JMP) {
insn = aarch64_insn_gen_branch_imm(entry->code,
entry->target,
AARCH64_INSN_BRANCH_NOLINK);
--- a/arch/mips/kernel/jump_label.c
+++ b/arch/mips/kernel/jump_label.c
@@ -51,7 +51,7 @@ void arch_jump_label_transform(struct ju
/* Target must have the right alignment and ISA must be preserved. */
BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT);

- if (type == JUMP_LABEL_ENABLE) {
+ if (type == JUMP_LABEL_JMP) {
insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op;
insn.j_format.target = e->target >> J_RANGE_SHIFT;
} else {
--- a/arch/powerpc/kernel/jump_label.c
+++ b/arch/powerpc/kernel/jump_label.c
@@ -17,7 +17,7 @@ void arch_jump_label_transform(struct ju
{
u32 *addr = (u32 *)(unsigned long)entry->code;

- if (type == JUMP_LABEL_ENABLE)
+ if (type == JUMP_LABEL_JMP)
patch_branch(addr, entry->target, 0);
else
patch_instruction(addr, PPC_INST_NOP);
--- a/arch/s390/kernel/jump_label.c
+++ b/arch/s390/kernel/jump_label.c
@@ -64,7 +64,7 @@ static void __jump_label_transform(struc
{
struct insn old, new;

- if (type == JUMP_LABEL_ENABLE) {
+ if (type == JUMP_LABEL_JMP) {
jump_label_make_nop(entry, &old);
jump_label_make_branch(entry, &new);
} else {
--- a/arch/sparc/kernel/jump_label.c
+++ b/arch/sparc/kernel/jump_label.c
@@ -16,7 +16,7 @@ void arch_jump_label_transform(struct ju
u32 val;
u32 *insn = (u32 *) (unsigned long) entry->code;

- if (type == JUMP_LABEL_ENABLE) {
+ if (type == JUMP_LABEL_JMP) {
s32 off = (s32)entry->target - (s32)entry->code;

#ifdef CONFIG_SPARC64
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -45,7 +45,7 @@ static void __jump_label_transform(struc
const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5];

- if (type == JUMP_LABEL_ENABLE) {
+ if (type == JUMP_LABEL_JMP) {
if (init) {
/*
* Jump label is enabled for the first time.
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -86,8 +86,8 @@ struct static_key {
#ifndef __ASSEMBLY__

enum jump_label_type {
- JUMP_LABEL_DISABLE = 0,
- JUMP_LABEL_ENABLE,
+ JUMP_LABEL_NOP = 0,
+ JUMP_LABEL_JMP,
};

struct module;
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -65,9 +65,9 @@ void static_key_slow_inc(struct static_k
jump_label_lock();
if (atomic_read(&key->enabled) == 0) {
if (!jump_label_get_branch_default(key))
- jump_label_update(key, JUMP_LABEL_ENABLE);
+ jump_label_update(key, JUMP_LABEL_JMP);
else
- jump_label_update(key, JUMP_LABEL_DISABLE);
+ jump_label_update(key, JUMP_LABEL_NOP);
}
atomic_inc(&key->enabled);
jump_label_unlock();
@@ -88,9 +88,9 @@ static void __static_key_slow_dec(struct
schedule_delayed_work(work, rate_limit);
} else {
if (!jump_label_get_branch_default(key))
- jump_label_update(key, JUMP_LABEL_DISABLE);
+ jump_label_update(key, JUMP_LABEL_NOP);
else
- jump_label_update(key, JUMP_LABEL_ENABLE);
+ jump_label_update(key, JUMP_LABEL_JMP);
}
jump_label_unlock();
}
@@ -184,9 +184,9 @@ static enum jump_label_type jump_label_t
bool state = static_key_enabled(key);

if ((!true_branch && state) || (true_branch && !state))
- return JUMP_LABEL_ENABLE;
+ return JUMP_LABEL_JMP;

- return JUMP_LABEL_DISABLE;
+ return JUMP_LABEL_NOP;
}

void __init jump_label_init(void)
@@ -276,7 +276,7 @@ void jump_label_apply_nops(struct module
return;

for (iter = iter_start; iter < iter_stop; iter++) {
- arch_jump_label_transform_static(iter, JUMP_LABEL_DISABLE);
+ arch_jump_label_transform_static(iter, JUMP_LABEL_NOP);
}
}

@@ -318,8 +318,8 @@ static int jump_label_add_module(struct
jlm->next = key->next;
key->next = jlm;

- if (jump_label_type(key) == JUMP_LABEL_ENABLE)
- __jump_label_update(key, iter, iter_stop, JUMP_LABEL_ENABLE);
+ if (jump_label_type(key) == JUMP_LABEL_JMP)
+ __jump_label_update(key, iter, iter_stop, JUMP_LABEL_JMP);
}

return 0;


--
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/