Commit bf5438fc authored by Jason Baron's avatar Jason Baron Committed by Steven Rostedt
Browse files

jump label: Base patch for jump label



base patch to implement 'jump labeling'. Based on a new 'asm goto' inline
assembly gcc mechanism, we can now branch to labels from an 'asm goto'
statment. This allows us to create a 'no-op' fastpath, which can subsequently
be patched with a jump to the slowpath code. This is useful for code which
might be rarely used, but which we'd like to be able to call, if needed.
Tracepoints are the current usecase that these are being implemented for.

Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
LKML-Reference: <ee8b3595967989fdaf84e698dc7447d315ce972a.1284733808.git.jbaron@redhat.com>

[ cleaned up some formating ]

Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent fa6f2cc7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -591,6 +591,11 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
# conserve stack if available
KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)

# check for 'asm goto'
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
endif

# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
# But warn user when we do so
warn-assign = \
+3 −0
Original line number Diff line number Diff line
@@ -158,4 +158,7 @@ config HAVE_PERF_EVENTS_NMI
	  subsystem.  Also has support for calculating CPU cycle events
	  to determine how many clock cycles in a given period.

config HAVE_ARCH_JUMP_LABEL
	bool

source "kernel/gcov/Kconfig"
+2 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/stringify.h>
#include <linux/jump_label.h>
#include <asm/asm.h>

/*
@@ -182,7 +183,7 @@ extern void *text_poke_early(void *addr, const void *opcode, size_t len);
extern void *text_poke(void *addr, const void *opcode, size_t len);
extern void *text_poke_smp(void *addr, const void *opcode, size_t len);

#if defined(CONFIG_DYNAMIC_FTRACE)
#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
#define IDEAL_NOP_SIZE_5 5
extern unsigned char ideal_nop5[IDEAL_NOP_SIZE_5];
extern void arch_init_ideal_nop5(void);
+1 −1
Original line number Diff line number Diff line
@@ -641,7 +641,7 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
	return addr;
}

#if defined(CONFIG_DYNAMIC_FTRACE)
#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)

unsigned char ideal_nop5[IDEAL_NOP_SIZE_5];

+10 −0
Original line number Diff line number Diff line
@@ -220,6 +220,8 @@
									\
	BUG_TABLE							\
									\
	JUMP_TABLE							\
									\
	/* PCI quirks */						\
	.pci_fixup        : AT(ADDR(.pci_fixup) - LOAD_OFFSET) {	\
		VMLINUX_SYMBOL(__start_pci_fixups_early) = .;		\
@@ -563,6 +565,14 @@
#define BUG_TABLE
#endif

#define JUMP_TABLE							\
	. = ALIGN(8);							\
	__jump_table : AT(ADDR(__jump_table) - LOAD_OFFSET) {		\
		VMLINUX_SYMBOL(__start___jump_table) = .;		\
		*(__jump_table)						\
		VMLINUX_SYMBOL(__stop___jump_table) = .;		\
	}

#ifdef CONFIG_PM_TRACE
#define TRACEDATA							\
	. = ALIGN(4);							\
Loading