Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32673822 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'tip/perf/core' of...

Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace

 into perf/core

Conflicts:
	include/linux/perf_event.h

Merge reason: pick up the latest jump-label enhancements, they are cooked ready.

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parents fa7b6947 5373db88
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -20,16 +20,18 @@
#define WORD_INSN ".word"
#endif

#define JUMP_LABEL(key, label)						\
	do {								\
		asm goto("1:\tnop\n\t"					\
			"nop\n\t"					\
			".pushsection __jump_table,  \"a\"\n\t"		\
			WORD_INSN " 1b, %l[" #label "], %0\n\t"		\
			".popsection\n\t"				\
			: :  "i" (key) :  : label);			\
	} while (0)

static __always_inline bool arch_static_branch(struct jump_label_key *key)
{
	asm goto("1:\tnop\n\t"
		"nop\n\t"
		".pushsection __jump_table,  \"aw\"\n\t"
		WORD_INSN " 1b, %l[l_yes], %0\n\t"
		".popsection\n\t"
		: :  "i" (key) : : l_yes);
	return false;
l_yes:
	return true;
}

#endif /* __KERNEL__ */

+1 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ config S390
	select HAVE_KERNEL_XZ
	select HAVE_GET_USER_PAGES_FAST
	select HAVE_ARCH_MUTEX_CPU_RELAX
	select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
	select ARCH_INLINE_SPIN_TRYLOCK
	select ARCH_INLINE_SPIN_TRYLOCK_BH
	select ARCH_INLINE_SPIN_LOCK
+37 −0
Original line number Diff line number Diff line
#ifndef _ASM_S390_JUMP_LABEL_H
#define _ASM_S390_JUMP_LABEL_H

#include <linux/types.h>

#define JUMP_LABEL_NOP_SIZE 6

#ifdef CONFIG_64BIT
#define ASM_PTR ".quad"
#define ASM_ALIGN ".balign 8"
#else
#define ASM_PTR ".long"
#define ASM_ALIGN ".balign 4"
#endif

static __always_inline bool arch_static_branch(struct jump_label_key *key)
{
	asm goto("0:	brcl 0,0\n"
		".pushsection __jump_table, \"aw\"\n"
		ASM_ALIGN "\n"
		ASM_PTR " 0b, %l[label], %0\n"
		".popsection\n"
		: : "X" (key) : : label);
	return false;
label:
	return true;
}

typedef unsigned long jump_label_t;

struct jump_entry {
	jump_label_t code;
	jump_label_t target;
	jump_label_t key;
};

#endif
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
obj-y	:=  bitmap.o traps.o time.o process.o base.o early.o setup.o \
	    processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
	    s390_ext.o debug.o irq.o ipl.o dis.o diag.o mem_detect.o \
	    vdso.o vtime.o sysinfo.o nmi.o sclp.o
	    vdso.o vtime.o sysinfo.o nmi.o sclp.o jump_label.o

obj-y	+= $(if $(CONFIG_64BIT),entry64.o,entry.o)
obj-y	+= $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
+59 −0
Original line number Diff line number Diff line
/*
 * Jump label s390 support
 *
 * Copyright IBM Corp. 2011
 * Author(s): Jan Glauber <jang@linux.vnet.ibm.com>
 */
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/stop_machine.h>
#include <linux/jump_label.h>
#include <asm/ipl.h>

#ifdef HAVE_JUMP_LABEL

struct insn {
	u16 opcode;
	s32 offset;
} __packed;

struct insn_args {
	unsigned long *target;
	struct insn *insn;
	ssize_t size;
};

static int __arch_jump_label_transform(void *data)
{
	struct insn_args *args = data;
	int rc;

	rc = probe_kernel_write(args->target, args->insn, args->size);
	WARN_ON_ONCE(rc < 0);
	return 0;
}

void arch_jump_label_transform(struct jump_entry *entry,
			       enum jump_label_type type)
{
	struct insn_args args;
	struct insn insn;

	if (type == JUMP_LABEL_ENABLE) {
		/* brcl 15,offset */
		insn.opcode = 0xc0f4;
		insn.offset = (entry->target - entry->code) >> 1;
	} else {
		/* brcl 0,0 */
		insn.opcode = 0xc004;
		insn.offset = 0;
	}

	args.target = (void *) entry->code;
	args.insn = &insn;
	args.size = JUMP_LABEL_NOP_SIZE;

	stop_machine(__arch_jump_label_transform, &args, NULL);
}

#endif
Loading