forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: David S. Miller <[email protected]> Signed-off-by: Jason Baron <[email protected]> LKML-Reference: <ee8b3595967989fdaf84e698dc7447d315ce972a.1284733808.git.jbaron@redhat.com> [ cleaned up some formating ] Signed-off-by: Steven Rostedt <[email protected]>
- Loading branch information
Showing
12 changed files
with
442 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef _LINUX_JUMP_LABEL_H | ||
#define _LINUX_JUMP_LABEL_H | ||
|
||
#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_HAVE_ARCH_JUMP_LABEL) | ||
# include <asm/jump_label.h> | ||
# define HAVE_JUMP_LABEL | ||
#endif | ||
|
||
enum jump_label_type { | ||
JUMP_LABEL_ENABLE, | ||
JUMP_LABEL_DISABLE | ||
}; | ||
|
||
struct module; | ||
|
||
#ifdef HAVE_JUMP_LABEL | ||
|
||
extern struct jump_entry __start___jump_table[]; | ||
extern struct jump_entry __stop___jump_table[]; | ||
|
||
extern void arch_jump_label_transform(struct jump_entry *entry, | ||
enum jump_label_type type); | ||
extern void jump_label_update(unsigned long key, enum jump_label_type type); | ||
extern void jump_label_apply_nops(struct module *mod); | ||
extern void arch_jump_label_text_poke_early(jump_label_t addr); | ||
|
||
#define enable_jump_label(key) \ | ||
jump_label_update((unsigned long)key, JUMP_LABEL_ENABLE); | ||
|
||
#define disable_jump_label(key) \ | ||
jump_label_update((unsigned long)key, JUMP_LABEL_DISABLE); | ||
|
||
#else | ||
|
||
#define JUMP_LABEL(key, label) \ | ||
do { \ | ||
if (unlikely(*key)) \ | ||
goto label; \ | ||
} while (0) | ||
|
||
#define enable_jump_label(cond_var) \ | ||
do { \ | ||
*(cond_var) = 1; \ | ||
} while (0) | ||
|
||
#define disable_jump_label(cond_var) \ | ||
do { \ | ||
*(cond_var) = 0; \ | ||
} while (0) | ||
|
||
static inline int jump_label_apply_nops(struct module *mod) | ||
{ | ||
return 0; | ||
} | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.