Skip to content

Commit df48d87

Browse files
committed
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (107 commits) perf stat: Add more cache-miss percentage printouts perf stat: Add -d -d and -d -d -d options to show more CPU events ftrace/kbuild: Add recordmcount files to force full build ftrace: Add self-tests for multiple function trace users ftrace: Modify ftrace_set_filter/notrace to take ops ftrace: Allow dynamically allocated function tracers ftrace: Implement separate user function filtering ftrace: Free hash with call_rcu_sched() ftrace: Have global_ops store the functions that are to be traced ftrace: Add ops parameter to ftrace_startup/shutdown functions ftrace: Add enabled_functions file ftrace: Use counters to enable functions to trace ftrace: Separate hash allocation and assignment ftrace: Create a global_ops to hold the filter and notrace hashes ftrace: Use hash instead for FTRACE_FL_FILTER ftrace: Replace FTRACE_FL_NOTRACE flag with a hash of ignored functions perf bench, x86: Add alternatives-asm.h wrapper x86, 64-bit: Fix copy_[to/from]_user() checks for the userspace address limit x86, mem: memset_64.S: Optimize memset by enhanced REP MOVSB/STOSB x86, mem: memmove_64.S: Optimize memmove by enhanced REP MOVSB/STOSB ...
2 parents acd3025 + 29510ec commit df48d87

78 files changed

Lines changed: 4024 additions & 1711 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,7 @@ help:
12681268
@echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
12691269
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
12701270
@echo ' make W=1 [targets] Enable extra gcc checks'
1271+
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
12711272
@echo ''
12721273
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
12731274
@echo 'For further info see the ./README file'

‎arch/mips/include/asm/jump_label.h‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020
#define WORD_INSN ".word"
2121
#endif
2222

23-
#define JUMP_LABEL(key, label) \
24-
do { \
25-
asm goto("1:\tnop\n\t" \
26-
"nop\n\t" \
27-
".pushsection __jump_table, \"a\"\n\t" \
28-
WORD_INSN " 1b, %l[" #label "], %0\n\t" \
29-
".popsection\n\t" \
30-
: : "i" (key) : : label); \
31-
} while (0)
32-
23+
static __always_inline bool arch_static_branch(struct jump_label_key *key)
24+
{
25+
asm goto("1:\tnop\n\t"
26+
"nop\n\t"
27+
".pushsection __jump_table, \"aw\"\n\t"
28+
WORD_INSN " 1b, %l[l_yes], %0\n\t"
29+
".popsection\n\t"
30+
: : "i" (key) : : l_yes);
31+
return false;
32+
l_yes:
33+
return true;
34+
}
3335

3436
#endif /* __KERNEL__ */
3537

‎arch/s390/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ config S390
8888
select HAVE_KERNEL_XZ
8989
select HAVE_GET_USER_PAGES_FAST
9090
select HAVE_ARCH_MUTEX_CPU_RELAX
91+
select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
9192
select ARCH_INLINE_SPIN_TRYLOCK
9293
select ARCH_INLINE_SPIN_TRYLOCK_BH
9394
select ARCH_INLINE_SPIN_LOCK

‎arch/s390/include/asm/ftrace.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ struct dyn_arch_ftrace { };
1111

1212
#ifdef CONFIG_64BIT
1313
#define MCOUNT_INSN_SIZE 12
14-
#define MCOUNT_OFFSET 8
1514
#else
1615
#define MCOUNT_INSN_SIZE 20
17-
#define MCOUNT_OFFSET 4
1816
#endif
1917

2018
static inline unsigned long ftrace_call_adjust(unsigned long addr)
2119
{
22-
return addr - MCOUNT_OFFSET;
20+
return addr;
2321
}
2422

2523
#endif /* __ASSEMBLY__ */

‎arch/s390/include/asm/jump_label.h‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#ifndef _ASM_S390_JUMP_LABEL_H
2+
#define _ASM_S390_JUMP_LABEL_H
3+
4+
#include <linux/types.h>
5+
6+
#define JUMP_LABEL_NOP_SIZE 6
7+
8+
#ifdef CONFIG_64BIT
9+
#define ASM_PTR ".quad"
10+
#define ASM_ALIGN ".balign 8"
11+
#else
12+
#define ASM_PTR ".long"
13+
#define ASM_ALIGN ".balign 4"
14+
#endif
15+
16+
static __always_inline bool arch_static_branch(struct jump_label_key *key)
17+
{
18+
asm goto("0: brcl 0,0\n"
19+
".pushsection __jump_table, \"aw\"\n"
20+
ASM_ALIGN "\n"
21+
ASM_PTR " 0b, %l[label], %0\n"
22+
".popsection\n"
23+
: : "X" (key) : : label);
24+
return false;
25+
label:
26+
return true;
27+
}
28+
29+
typedef unsigned long jump_label_t;
30+
31+
struct jump_entry {
32+
jump_label_t code;
33+
jump_label_t target;
34+
jump_label_t key;
35+
};
36+
37+
#endif

‎arch/s390/kernel/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
2323
obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o \
2424
processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
2525
s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o \
26-
vdso.o vtime.o sysinfo.o nmi.o sclp.o
26+
vdso.o vtime.o sysinfo.o nmi.o sclp.o jump_label.o
2727

2828
obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
2929
obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)

‎arch/s390/kernel/jump_label.c‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Jump label s390 support
3+
*
4+
* Copyright IBM Corp. 2011
5+
* Author(s): Jan Glauber <jang@linux.vnet.ibm.com>
6+
*/
7+
#include <linux/module.h>
8+
#include <linux/uaccess.h>
9+
#include <linux/stop_machine.h>
10+
#include <linux/jump_label.h>
11+
#include <asm/ipl.h>
12+
13+
#ifdef HAVE_JUMP_LABEL
14+
15+
struct insn {
16+
u16 opcode;
17+
s32 offset;
18+
} __packed;
19+
20+
struct insn_args {
21+
unsigned long *target;
22+
struct insn *insn;
23+
ssize_t size;
24+
};
25+
26+
static int __arch_jump_label_transform(void *data)
27+
{
28+
struct insn_args *args = data;
29+
int rc;
30+
31+
rc = probe_kernel_write(args->target, args->insn, args->size);
32+
WARN_ON_ONCE(rc < 0);
33+
return 0;
34+
}
35+
36+
void arch_jump_label_transform(struct jump_entry *entry,
37+
enum jump_label_type type)
38+
{
39+
struct insn_args args;
40+
struct insn insn;
41+
42+
if (type == JUMP_LABEL_ENABLE) {
43+
/* brcl 15,offset */
44+
insn.opcode = 0xc0f4;
45+
insn.offset = (entry->target - entry->code) >> 1;
46+
} else {
47+
/* brcl 0,0 */
48+
insn.opcode = 0xc004;
49+
insn.offset = 0;
50+
}
51+
52+
args.target = (void *) entry->code;
53+
args.insn = &insn;
54+
args.size = JUMP_LABEL_NOP_SIZE;
55+
56+
stop_machine(__arch_jump_label_transform, &args, NULL);
57+
}
58+
59+
#endif

‎arch/sparc/include/asm/jump_label.h‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77

88
#define JUMP_LABEL_NOP_SIZE 4
99

10-
#define JUMP_LABEL(key, label) \
11-
do { \
12-
asm goto("1:\n\t" \
13-
"nop\n\t" \
14-
"nop\n\t" \
15-
".pushsection __jump_table, \"a\"\n\t"\
16-
".align 4\n\t" \
17-
".word 1b, %l[" #label "], %c0\n\t" \
18-
".popsection \n\t" \
19-
: : "i" (key) : : label);\
20-
} while (0)
10+
static __always_inline bool arch_static_branch(struct jump_label_key *key)
11+
{
12+
asm goto("1:\n\t"
13+
"nop\n\t"
14+
"nop\n\t"
15+
".pushsection __jump_table, \"aw\"\n\t"
16+
".align 4\n\t"
17+
".word 1b, %l[l_yes], %c0\n\t"
18+
".popsection \n\t"
19+
: : "i" (key) : : l_yes);
20+
return false;
21+
l_yes:
22+
return true;
23+
}
2124

2225
#endif /* __KERNEL__ */
2326

‎arch/x86/include/asm/alternative-asm.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,13 @@
1515
.endm
1616
#endif
1717

18+
.macro altinstruction_entry orig alt feature orig_len alt_len
19+
.align 8
20+
.quad \orig
21+
.quad \alt
22+
.word \feature
23+
.byte \orig_len
24+
.byte \alt_len
25+
.endm
26+
1827
#endif /* __ASSEMBLY__ */

‎arch/x86/include/asm/alternative.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <linux/types.h>
55
#include <linux/stddef.h>
66
#include <linux/stringify.h>
7-
#include <linux/jump_label.h>
87
#include <asm/asm.h>
98

109
/*
@@ -191,7 +190,7 @@ extern void *text_poke(void *addr, const void *opcode, size_t len);
191190
extern void *text_poke_smp(void *addr, const void *opcode, size_t len);
192191
extern void text_poke_smp_batch(struct text_poke_param *params, int n);
193192

194-
#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
193+
#if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_JUMP_LABEL)
195194
#define IDEAL_NOP_SIZE_5 5
196195
extern unsigned char ideal_nop5[IDEAL_NOP_SIZE_5];
197196
extern void arch_init_ideal_nop5(void);

0 commit comments

Comments
 (0)