linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
@ 2013-05-01 15:25 Jiri Olsa
  2013-05-01 15:25 ` [PATCH 1/4] signal x86: Propage RF EFLAGS bit throught the signal restore call Jiri Olsa
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Jiri Olsa @ 2013-05-01 15:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Thomas Gleixner, H. Peter Anvin, Andi Kleen,
	Oleg Nesterov, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Vince Weaver, Stephane Eranian

hi,
sending v3 for initial patchset:
https://lkml.org/lkml/2013/3/1/324

basically just sending remaining (not pulled) patches,
with '*-by: *' tags updated.

v3 changes:
  - perf test patches already pulled in
  - added Oleg's Tested-by for signal related patches
  - added Frederic's Reviewed-by for signal related patches
  - added Peter's Reviewed-by for perf patch.

v2 changes:
  - added patch to merge EFLAGS bit clearing into single statement

Also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
tip/perf/RF

thanks,
jirka

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
---
Jiri Olsa (4):
      signal x86: Propage RF EFLAGS bit throught the signal restore call
      signal x86: Clear RF EFLAGS bit for signal handler
      signal x86: Merge EFLAGS bit clearing into single statement
      perf: Fix hw breakpoints overflow period sampling

 arch/x86/ia32/ia32_signal.c        |  2 --
 arch/x86/include/asm/sighandling.h |  4 ++--
 arch/x86/kernel/signal.c           | 16 ++++++----------
 include/linux/perf_event.h         |  2 ++
 kernel/events/core.c               |  2 +-
 kernel/events/hw_breakpoint.c      |  5 +++++
 6 files changed, 16 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/4] signal x86: Propage RF EFLAGS bit throught the signal restore call
  2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
@ 2013-05-01 15:25 ` Jiri Olsa
  2013-05-28 12:51   ` [tip:perf/core] x86/signals: Propagate RF EFLAGS bit through " tip-bot for Jiri Olsa
  2013-05-01 15:25 ` [PATCH 2/4] signal x86: Clear RF EFLAGS bit for signal handler Jiri Olsa
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2013-05-01 15:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Thomas Gleixner, H. Peter Anvin, Andi Kleen,
	Oleg Nesterov, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Vince Weaver, Stephane Eranian

Adding RF EFLAGS bit to be restored on return from signal from
the original register context before the signal was entered.

This will prevent the RF flag to disappear when returning
from exception due to the signal handler being executed.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
---
 arch/x86/ia32/ia32_signal.c        | 2 --
 arch/x86/include/asm/sighandling.h | 4 ++--
 arch/x86/kernel/signal.c           | 6 ------
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index cf1a471..bccfca6 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -34,8 +34,6 @@
 #include <asm/sys_ia32.h>
 #include <asm/smap.h>
 
-#define FIX_EFLAGS	__FIX_EFLAGS
-
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
 	int err = 0;
diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h
index beff97f..7a95816 100644
--- a/arch/x86/include/asm/sighandling.h
+++ b/arch/x86/include/asm/sighandling.h
@@ -7,10 +7,10 @@
 
 #include <asm/processor-flags.h>
 
-#define __FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
+#define FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
 			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
 			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
-			 X86_EFLAGS_CF)
+			 X86_EFLAGS_CF | X86_EFLAGS_RF)
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 6956299..9df4c0b 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -43,12 +43,6 @@
 
 #include <asm/sigframe.h>
 
-#ifdef CONFIG_X86_32
-# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
-#else
-# define FIX_EFLAGS	__FIX_EFLAGS
-#endif
-
 #define COPY(x)			do {			\
 	get_user_ex(regs->x, &sc->x);			\
 } while (0)
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/4] signal x86: Clear RF EFLAGS bit for signal handler
  2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
  2013-05-01 15:25 ` [PATCH 1/4] signal x86: Propage RF EFLAGS bit throught the signal restore call Jiri Olsa
@ 2013-05-01 15:25 ` Jiri Olsa
  2013-05-28 12:52   ` [tip:perf/core] x86/signals: " tip-bot for Jiri Olsa
  2013-05-01 15:25 ` [PATCH 3/4] signal x86: Merge EFLAGS bit clearing into single statement Jiri Olsa
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2013-05-01 15:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Thomas Gleixner, H. Peter Anvin, Andi Kleen,
	Oleg Nesterov, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Vince Weaver, Stephane Eranian

Clearing RF EFLAGS bit for signal handler. The reason is,
that this flag is set by debug exception code to prevent
the recursive exception entry.

Leaving it set for signal handler might prevent debug
exception of the signal handler itself.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
---
 arch/x86/kernel/signal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 9df4c0b..cb12fc9 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -665,6 +665,12 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 		 */
 		regs->flags &= ~X86_EFLAGS_DF;
 		/*
+		 * Clear RF when entering the signal handler, because
+		 * it might disable possible debug exception from the
+		 * signal handler.
+		 */
+		regs->flags &= ~X86_EFLAGS_RF;
+		/*
 		 * Clear TF when entering the signal handler, but
 		 * notify any tracer that was single-stepping it.
 		 * The tracer may want to single-step inside the
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/4] signal x86: Merge EFLAGS bit clearing into single statement
  2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
  2013-05-01 15:25 ` [PATCH 1/4] signal x86: Propage RF EFLAGS bit throught the signal restore call Jiri Olsa
  2013-05-01 15:25 ` [PATCH 2/4] signal x86: Clear RF EFLAGS bit for signal handler Jiri Olsa
@ 2013-05-01 15:25 ` Jiri Olsa
  2013-05-28 12:54   ` [tip:perf/core] x86/signals: Merge EFLAGS bit clearing into a " tip-bot for Jiri Olsa
  2013-05-01 15:25 ` [PATCH 4/4] perf: Fix hw breakpoints overflow period sampling Jiri Olsa
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2013-05-01 15:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Thomas Gleixner, H. Peter Anvin, Andi Kleen,
	Oleg Nesterov, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Vince Weaver, Stephane Eranian

Merging EFLAGS bit clearing into a single statement, to
ensure EFLAGS bits being cleared in single instruction.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
---
 arch/x86/kernel/signal.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index cb12fc9..cf91358 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -662,21 +662,17 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 	if (!failed) {
 		/*
 		 * Clear the direction flag as per the ABI for function entry.
-		 */
-		regs->flags &= ~X86_EFLAGS_DF;
-		/*
+		 *
 		 * Clear RF when entering the signal handler, because
 		 * it might disable possible debug exception from the
 		 * signal handler.
-		 */
-		regs->flags &= ~X86_EFLAGS_RF;
-		/*
+		 *
 		 * Clear TF when entering the signal handler, but
 		 * notify any tracer that was single-stepping it.
 		 * The tracer may want to single-step inside the
 		 * handler too.
 		 */
-		regs->flags &= ~X86_EFLAGS_TF;
+		regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF);
 	}
 	signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
 }
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/4] perf: Fix hw breakpoints overflow period sampling
  2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
                   ` (2 preceding siblings ...)
  2013-05-01 15:25 ` [PATCH 3/4] signal x86: Merge EFLAGS bit clearing into single statement Jiri Olsa
@ 2013-05-01 15:25 ` Jiri Olsa
  2013-05-28 12:56   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2013-05-01 15:52 ` [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Oleg Nesterov
  2013-05-07 12:29 ` Jiri Olsa
  5 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2013-05-01 15:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Thomas Gleixner, H. Peter Anvin, Andi Kleen,
	Oleg Nesterov, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Vince Weaver, Stephane Eranian

The hw breakpoint pmu 'add' function is missing the
period_left update needed for SW events.

The perf HW breakpoint events use SW events framework
for to process the overflow, so it needs to be properly
initialized during PMU 'add' method.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
---
 include/linux/perf_event.h    | 2 ++
 kernel/events/core.c          | 2 +-
 kernel/events/hw_breakpoint.c | 5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f463a46..fa38612 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -743,6 +743,7 @@ extern unsigned int perf_output_skip(struct perf_output_handle *handle,
 				     unsigned int len);
 extern int perf_swevent_get_recursion_context(void);
 extern void perf_swevent_put_recursion_context(int rctx);
+extern u64 perf_swevent_set_period(struct perf_event *event);
 extern void perf_event_enable(struct perf_event *event);
 extern void perf_event_disable(struct perf_event *event);
 extern int __perf_event_disable(void *info);
@@ -782,6 +783,7 @@ static inline void perf_event_fork(struct task_struct *tsk)		{ }
 static inline void perf_event_init(void)				{ }
 static inline int  perf_swevent_get_recursion_context(void)		{ return -1; }
 static inline void perf_swevent_put_recursion_context(int rctx)		{ }
+static inline u64 perf_swevent_set_period(struct perf_event *event)	{ return 0; }
 static inline void perf_event_enable(struct perf_event *event)		{ }
 static inline void perf_event_disable(struct perf_event *event)		{ }
 static inline int __perf_event_disable(void *info)			{ return -1; }
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 82c01bf..f50d222 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5008,7 +5008,7 @@ static DEFINE_PER_CPU(struct swevent_htable, swevent_htable);
  * sign as trigger.
  */
 
-static u64 perf_swevent_set_period(struct perf_event *event)
+u64 perf_swevent_set_period(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
 	u64 period = hwc->last_period;
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index a64f8ae..966a241 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -612,6 +612,11 @@ static int hw_breakpoint_add(struct perf_event *bp, int flags)
 	if (!(flags & PERF_EF_START))
 		bp->hw.state = PERF_HES_STOPPED;
 
+	if (is_sampling_event(bp)) {
+		bp->hw.last_period = bp->hw.sample_period;
+		perf_swevent_set_period(bp);
+	}
+
 	return arch_install_hw_breakpoint(bp);
 }
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
                   ` (3 preceding siblings ...)
  2013-05-01 15:25 ` [PATCH 4/4] perf: Fix hw breakpoints overflow period sampling Jiri Olsa
@ 2013-05-01 15:52 ` Oleg Nesterov
  2013-05-07 12:29 ` Jiri Olsa
  5 siblings, 0 replies; 16+ messages in thread
From: Oleg Nesterov @ 2013-05-01 15:52 UTC (permalink / raw)
  To: Jiri Olsa, Jan Kratochvil
  Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, Andi Kleen,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Vince Weaver,
	Stephane Eranian

On 05/01, Jiri Olsa wrote:
>
>   - added Oleg's Tested-by for signal related patches

See the test-case below. Without 1/4 + 2/4 it fails, it can
miss the 2nd bp or report the 1st one twice.

Jan, FYI.

Oleg.

#define _GNU_SOURCE 1
#include <stdio.h>
#include <unistd.h>
#include <sys/ptrace.h>
#include <sys/debugreg.h>
#include <sys/user.h>
#include <sys/wait.h>
#include <assert.h>
#include <assert.h>
#include <stddef.h>

#define DR_GLOBAL_ENABLE	0x2
#define DR_LOCAL_ENABLE		0x1

unsigned long encode_dr7(int drnum, int enable, unsigned int type, unsigned int len)
{
	unsigned long dr7;

	dr7 = ((len | type) & 0xf)
		<< (DR_CONTROL_SHIFT + drnum * DR_CONTROL_SIZE);
	if (enable)
		dr7 |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE));

	return dr7;
}

int write_dr(int pid, int dr, unsigned long val)
{
	return ptrace(PTRACE_POKEUSER, pid,
			offsetof (struct user, u_debugreg[dr]),
			val);
}

#define GET_REG(pid, reg)				\
	ptrace(PTRACE_PEEKUSER, (pid),			\
		offsetof(struct user, regs.reg), 0)

void *get_ip(int pid)
{
	return (void*)GET_REG(pid, rip);
}


void func(void)
{
	printf("bp_1 passed\n");
}

void sigh(int sig)
{
	printf("bp_2 passed\n");
}

int main(void)
{
	int pid, stat;
	unsigned long dr7;

	pid = fork();
	if (!pid) {
		assert(ptrace(PTRACE_TRACEME, 0,0,0) == 0);
		kill(getpid(), SIGHUP);

		signal(SIGINT, sigh);

		func();

		return 0x13;
	}

	assert(pid == waitpid(-1, &stat, 0));
	assert(WSTOPSIG(stat) == SIGHUP);

	assert(write_dr(pid, 0, (long)func) == 0);
	assert(write_dr(pid, 1, (long)sigh) == 0);

	dr7 = 0;
	dr7 |= encode_dr7(0, 1, DR_RW_EXECUTE, DR_LEN_1);
	dr7 |= encode_dr7(1, 1, DR_RW_EXECUTE, DR_LEN_1);

	assert(write_dr(pid, 7, dr7) == 0);

	assert(ptrace(PTRACE_CONT, pid, 0,0) == 0);
	assert(pid == waitpid(-1, &stat, 0));
	assert(WSTOPSIG(stat) == SIGTRAP);
	assert(get_ip(pid) == func);

	kill(pid, SIGINT);
	assert(ptrace(PTRACE_CONT, pid, 0,0) == 0);
	assert(pid == waitpid(-1, &stat, 0));
	assert(WSTOPSIG(stat) == SIGINT);

	assert(ptrace(PTRACE_CONT, pid, 0,SIGINT) == 0);
	assert(pid == waitpid(-1, &stat, 0));
	assert(WSTOPSIG(stat) == SIGTRAP);
	assert(get_ip(pid) == sigh);

	assert(ptrace(PTRACE_CONT, pid, 0,0) == 0);
	assert(pid == waitpid(-1, &stat, 0));
	assert(stat == 0x1300);

	return 0;
}


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
                   ` (4 preceding siblings ...)
  2013-05-01 15:52 ` [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Oleg Nesterov
@ 2013-05-07 12:29 ` Jiri Olsa
  2013-05-15 15:04   ` Jiri Olsa
  5 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2013-05-07 12:29 UTC (permalink / raw)
  To: linux-kernel, Thomas Gleixner, H. Peter Anvin, Ingo Molnar
  Cc: Andi Kleen, Oleg Nesterov, Arnaldo Carvalho de Melo,
	Peter Zijlstra, Paul Mackerras, Corey Ashford,
	Frederic Weisbecker, Vince Weaver, Stephane Eranian

On Wed, May 01, 2013 at 05:25:40PM +0200, Jiri Olsa wrote:
> hi,
> sending v3 for initial patchset:
> https://lkml.org/lkml/2013/3/1/324
> 
> basically just sending remaining (not pulled) patches,
> with '*-by: *' tags updated.
> 
> v3 changes:
>   - perf test patches already pulled in
>   - added Oleg's Tested-by for signal related patches
>   - added Frederic's Reviewed-by for signal related patches
>   - added Peter's Reviewed-by for perf patch.

hi,

Thomas, Peter,
any chance you could pull this in?

Ingo,
could you please take the perf change (4/4)?
it's reviewed by PeterZ

thanks,
jirka

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-07 12:29 ` Jiri Olsa
@ 2013-05-15 15:04   ` Jiri Olsa
  2013-05-15 15:44     ` Frederic Weisbecker
  2013-05-15 16:52     ` Peter Zijlstra
  0 siblings, 2 replies; 16+ messages in thread
From: Jiri Olsa @ 2013-05-15 15:04 UTC (permalink / raw)
  To: linux-kernel, Thomas Gleixner, H. Peter Anvin, Ingo Molnar
  Cc: Andi Kleen, Oleg Nesterov, Arnaldo Carvalho de Melo,
	Peter Zijlstra, Paul Mackerras, Corey Ashford,
	Frederic Weisbecker, Vince Weaver, Stephane Eranian

On Tue, May 07, 2013 at 02:29:48PM +0200, Jiri Olsa wrote:
> On Wed, May 01, 2013 at 05:25:40PM +0200, Jiri Olsa wrote:
> > hi,
> > sending v3 for initial patchset:
> > https://lkml.org/lkml/2013/3/1/324
> > 
> > basically just sending remaining (not pulled) patches,
> > with '*-by: *' tags updated.
> > 
> > v3 changes:
> >   - perf test patches already pulled in
> >   - added Oleg's Tested-by for signal related patches
> >   - added Frederic's Reviewed-by for signal related patches
> >   - added Peter's Reviewed-by for perf patch.
> 
> hi,
> 
> Thomas, Peter,
> any chance you could pull this in?
> 
> Ingo,
> could you please take the perf change (4/4)?
> it's reviewed by PeterZ

ping

jirka

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-15 15:04   ` Jiri Olsa
@ 2013-05-15 15:44     ` Frederic Weisbecker
  2013-05-15 19:28       ` Jiri Olsa
  2013-05-15 16:52     ` Peter Zijlstra
  1 sibling, 1 reply; 16+ messages in thread
From: Frederic Weisbecker @ 2013-05-15 15:44 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, Ingo Molnar,
	Andi Kleen, Oleg Nesterov, Arnaldo Carvalho de Melo,
	Peter Zijlstra, Paul Mackerras, Corey Ashford, Vince Weaver,
	Stephane Eranian

2013/5/15 Jiri Olsa <jolsa@redhat.com>:
> On Tue, May 07, 2013 at 02:29:48PM +0200, Jiri Olsa wrote:
>> On Wed, May 01, 2013 at 05:25:40PM +0200, Jiri Olsa wrote:
>> > hi,
>> > sending v3 for initial patchset:
>> > https://lkml.org/lkml/2013/3/1/324
>> >
>> > basically just sending remaining (not pulled) patches,
>> > with '*-by: *' tags updated.
>> >
>> > v3 changes:
>> >   - perf test patches already pulled in
>> >   - added Oleg's Tested-by for signal related patches
>> >   - added Frederic's Reviewed-by for signal related patches
>> >   - added Peter's Reviewed-by for perf patch.
>>
>> hi,
>>
>> Thomas, Peter,
>> any chance you could pull this in?
>>
>> Ingo,
>> could you please take the perf change (4/4)?
>> it's reviewed by PeterZ
>
> ping

May be you can set up a branch based on v3.10-rc1 with these patches
applied on top and send it as a pull request to Ingo (and LKML + other
people Cc'ed). Your branch is not pullable as is because it seems to
be based on tip:master (it's not targeted for mainline, just there for
testing) and moreover an old enough version of it.

Just suggesting that because clean pull requests based on sane
starting points usually get better and faster attention than
standalone patches because it's less maintainance noise. Also you have
all the necessary acks so it's all good.

Thanks!

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-15 15:04   ` Jiri Olsa
  2013-05-15 15:44     ` Frederic Weisbecker
@ 2013-05-15 16:52     ` Peter Zijlstra
  2013-05-15 19:28       ` Jiri Olsa
  1 sibling, 1 reply; 16+ messages in thread
From: Peter Zijlstra @ 2013-05-15 16:52 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, Ingo Molnar,
	Andi Kleen, Oleg Nesterov, Arnaldo Carvalho de Melo,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Vince Weaver,
	Stephane Eranian

On Wed, May 15, 2013 at 05:04:50PM +0200, Jiri Olsa wrote:
> On Tue, May 07, 2013 at 02:29:48PM +0200, Jiri Olsa wrote:
> > On Wed, May 01, 2013 at 05:25:40PM +0200, Jiri Olsa wrote:
> > > hi,
> > > sending v3 for initial patchset:
> > > https://lkml.org/lkml/2013/3/1/324
> > > 
> > > basically just sending remaining (not pulled) patches,
> > > with '*-by: *' tags updated.
> > > 
> > > v3 changes:
> > >   - perf test patches already pulled in
> > >   - added Oleg's Tested-by for signal related patches
> > >   - added Frederic's Reviewed-by for signal related patches
> > >   - added Peter's Reviewed-by for perf patch.
> > 
> > hi,
> > 
> > Thomas, Peter,
> > any chance you could pull this in?
> > 
> > Ingo,
> > could you please take the perf change (4/4)?
> > it's reviewed by PeterZ

Queued them, will shove them Ingo-wards soonish.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-15 15:44     ` Frederic Weisbecker
@ 2013-05-15 19:28       ` Jiri Olsa
  0 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2013-05-15 19:28 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, Ingo Molnar,
	Andi Kleen, Oleg Nesterov, Arnaldo Carvalho de Melo,
	Peter Zijlstra, Paul Mackerras, Corey Ashford, Vince Weaver,
	Stephane Eranian

On Wed, May 15, 2013 at 05:44:07PM +0200, Frederic Weisbecker wrote:
> 2013/5/15 Jiri Olsa <jolsa@redhat.com>:
> > On Tue, May 07, 2013 at 02:29:48PM +0200, Jiri Olsa wrote:
> >> On Wed, May 01, 2013 at 05:25:40PM +0200, Jiri Olsa wrote:
> >> > hi,
> >> > sending v3 for initial patchset:
> >> > https://lkml.org/lkml/2013/3/1/324
> >> >
> >> > basically just sending remaining (not pulled) patches,
> >> > with '*-by: *' tags updated.
> >> >
> >> > v3 changes:
> >> >   - perf test patches already pulled in
> >> >   - added Oleg's Tested-by for signal related patches
> >> >   - added Frederic's Reviewed-by for signal related patches
> >> >   - added Peter's Reviewed-by for perf patch.
> >>
> >> hi,
> >>
> >> Thomas, Peter,
> >> any chance you could pull this in?
> >>
> >> Ingo,
> >> could you please take the perf change (4/4)?
> >> it's reviewed by PeterZ
> >
> > ping
> 
> May be you can set up a branch based on v3.10-rc1 with these patches
> applied on top and send it as a pull request to Ingo (and LKML + other
> people Cc'ed). Your branch is not pullable as is because it seems to
> be based on tip:master (it's not targeted for mainline, just there for
> testing) and moreover an old enough version of it.

thanks for suggestion, will do this next time :)

jirka

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling
  2013-05-15 16:52     ` Peter Zijlstra
@ 2013-05-15 19:28       ` Jiri Olsa
  0 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2013-05-15 19:28 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, Ingo Molnar,
	Andi Kleen, Oleg Nesterov, Arnaldo Carvalho de Melo,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Vince Weaver,
	Stephane Eranian

On Wed, May 15, 2013 at 06:52:33PM +0200, Peter Zijlstra wrote:
> On Wed, May 15, 2013 at 05:04:50PM +0200, Jiri Olsa wrote:
> > On Tue, May 07, 2013 at 02:29:48PM +0200, Jiri Olsa wrote:
> > > On Wed, May 01, 2013 at 05:25:40PM +0200, Jiri Olsa wrote:
> > > > hi,
> > > > sending v3 for initial patchset:
> > > > https://lkml.org/lkml/2013/3/1/324
> > > > 
> > > > basically just sending remaining (not pulled) patches,
> > > > with '*-by: *' tags updated.
> > > > 
> > > > v3 changes:
> > > >   - perf test patches already pulled in
> > > >   - added Oleg's Tested-by for signal related patches
> > > >   - added Frederic's Reviewed-by for signal related patches
> > > >   - added Peter's Reviewed-by for perf patch.
> > > 
> > > hi,
> > > 
> > > Thomas, Peter,
> > > any chance you could pull this in?
> > > 
> > > Ingo,
> > > could you please take the perf change (4/4)?
> > > it's reviewed by PeterZ
> 
> Queued them, will shove them Ingo-wards soonish.
> 

thanks,

jirka

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [tip:perf/core] x86/signals: Propagate RF EFLAGS bit through the signal restore call
  2013-05-01 15:25 ` [PATCH 1/4] signal x86: Propage RF EFLAGS bit throught the signal restore call Jiri Olsa
@ 2013-05-28 12:51   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2013-05-28 12:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, mingo, a.p.zijlstra, torvalds, acme, jolsa, fweisbec,
	akpm, tglx, oleg, cjashfor, linux-kernel, hpa, paulus, andi,
	vincent.weaver, mingo

Commit-ID:  5e219b3c671b34b2d79468fe89c44c0460c0f02b
Gitweb:     http://git.kernel.org/tip/5e219b3c671b34b2d79468fe89c44c0460c0f02b
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Wed, 1 May 2013 17:25:41 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 May 2013 08:46:50 +0200

x86/signals: Propagate RF EFLAGS bit through the signal restore call

While porting Vince's perf overflow tests I found perf event
breakpoint overflow does not work properly.

I found the x86 RF EFLAG bit not being set when returning
from debug exception after triggering signal handler. Which
is exactly what you get when you set perf breakpoint overflow
SIGIO handler.

This patch and the next two patches fix the underlying bugs.

This patch adds the RF EFLAGS bit to be restored on return from
signal from the original register context before the signal was
entered.

This will prevent the RF flag to disappear when returning
from exception due to the signal handler being executed.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Originally-Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1367421944-19082-2-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/ia32/ia32_signal.c        | 2 --
 arch/x86/include/asm/sighandling.h | 4 ++--
 arch/x86/kernel/signal.c           | 6 ------
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index cf1a471..bccfca6 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -34,8 +34,6 @@
 #include <asm/sys_ia32.h>
 #include <asm/smap.h>
 
-#define FIX_EFLAGS	__FIX_EFLAGS
-
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
 	int err = 0;
diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h
index beff97f..7a95816 100644
--- a/arch/x86/include/asm/sighandling.h
+++ b/arch/x86/include/asm/sighandling.h
@@ -7,10 +7,10 @@
 
 #include <asm/processor-flags.h>
 
-#define __FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
+#define FIX_EFLAGS	(X86_EFLAGS_AC | X86_EFLAGS_OF | \
 			 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
 			 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
-			 X86_EFLAGS_CF)
+			 X86_EFLAGS_CF | X86_EFLAGS_RF)
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 6956299..9df4c0b 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -43,12 +43,6 @@
 
 #include <asm/sigframe.h>
 
-#ifdef CONFIG_X86_32
-# define FIX_EFLAGS	(__FIX_EFLAGS | X86_EFLAGS_RF)
-#else
-# define FIX_EFLAGS	__FIX_EFLAGS
-#endif
-
 #define COPY(x)			do {			\
 	get_user_ex(regs->x, &sc->x);			\
 } while (0)

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] x86/signals: Clear RF EFLAGS bit for signal handler
  2013-05-01 15:25 ` [PATCH 2/4] signal x86: Clear RF EFLAGS bit for signal handler Jiri Olsa
@ 2013-05-28 12:52   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2013-05-28 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, mingo, a.p.zijlstra, torvalds, acme, jolsa, fweisbec,
	akpm, tglx, oleg, cjashfor, linux-kernel, hpa, paulus, andi,
	vincent.weaver, mingo

Commit-ID:  24cda10996f5420ab962f91cd03c15869a3a94b1
Gitweb:     http://git.kernel.org/tip/24cda10996f5420ab962f91cd03c15869a3a94b1
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Wed, 1 May 2013 17:25:42 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 May 2013 08:46:52 +0200

x86/signals: Clear RF EFLAGS bit for signal handler

Clearing RF EFLAGS bit for signal handler. The reason is
that this flag is set by debug exception code to prevent
the recursive exception entry.

Leaving it set for signal handler might prevent debug
exception of the signal handler itself.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Originally-Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1367421944-19082-3-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/signal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 9df4c0b..cb12fc9 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -665,6 +665,12 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 		 */
 		regs->flags &= ~X86_EFLAGS_DF;
 		/*
+		 * Clear RF when entering the signal handler, because
+		 * it might disable possible debug exception from the
+		 * signal handler.
+		 */
+		regs->flags &= ~X86_EFLAGS_RF;
+		/*
 		 * Clear TF when entering the signal handler, but
 		 * notify any tracer that was single-stepping it.
 		 * The tracer may want to single-step inside the

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] x86/signals: Merge EFLAGS bit clearing into a single statement
  2013-05-01 15:25 ` [PATCH 3/4] signal x86: Merge EFLAGS bit clearing into single statement Jiri Olsa
@ 2013-05-28 12:54   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2013-05-28 12:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, mingo, a.p.zijlstra, torvalds, acme, jolsa, fweisbec,
	akpm, tglx, oleg, cjashfor, linux-kernel, hpa, paulus, andi,
	vincent.weaver, mingo

Commit-ID:  ddd40da4ccbabdd2e941837aa987e08dfa4396b4
Gitweb:     http://git.kernel.org/tip/ddd40da4ccbabdd2e941837aa987e08dfa4396b4
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Wed, 1 May 2013 17:25:43 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 May 2013 08:46:53 +0200

x86/signals: Merge EFLAGS bit clearing into a single statement

Merging EFLAGS bit clearing into a single statement, to
ensure EFLAGS bits are being cleared in a single instruction.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Originally-Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1367421944-19082-4-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/signal.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index cb12fc9..cf91358 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -662,21 +662,17 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 	if (!failed) {
 		/*
 		 * Clear the direction flag as per the ABI for function entry.
-		 */
-		regs->flags &= ~X86_EFLAGS_DF;
-		/*
+		 *
 		 * Clear RF when entering the signal handler, because
 		 * it might disable possible debug exception from the
 		 * signal handler.
-		 */
-		regs->flags &= ~X86_EFLAGS_RF;
-		/*
+		 *
 		 * Clear TF when entering the signal handler, but
 		 * notify any tracer that was single-stepping it.
 		 * The tracer may want to single-step inside the
 		 * handler too.
 		 */
-		regs->flags &= ~X86_EFLAGS_TF;
+		regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF);
 	}
 	signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
 }

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf: Fix hw breakpoints overflow period sampling
  2013-05-01 15:25 ` [PATCH 4/4] perf: Fix hw breakpoints overflow period sampling Jiri Olsa
@ 2013-05-28 12:56   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2013-05-28 12:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, eranian, paulus, hpa, mingo, a.p.zijlstra, acme,
	jolsa, vincent.weaver, fweisbec, tglx, oleg, cjashfor, mingo

Commit-ID:  ab573844e3058eef2788803d373019f8bebead57
Gitweb:     http://git.kernel.org/tip/ab573844e3058eef2788803d373019f8bebead57
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Wed, 1 May 2013 17:25:44 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 May 2013 08:59:54 +0200

perf: Fix hw breakpoints overflow period sampling

The hw breakpoint pmu 'add' function is missing the
period_left update needed for SW events.

The perf HW breakpoint events use the SW events framework
to process the overflow, so it needs to be properly initialized
in the PMU 'add' method.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Reviewed-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1367421944-19082-5-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/perf_event.h    | 2 ++
 kernel/events/core.c          | 2 +-
 kernel/events/hw_breakpoint.c | 5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f463a46..fa38612 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -743,6 +743,7 @@ extern unsigned int perf_output_skip(struct perf_output_handle *handle,
 				     unsigned int len);
 extern int perf_swevent_get_recursion_context(void);
 extern void perf_swevent_put_recursion_context(int rctx);
+extern u64 perf_swevent_set_period(struct perf_event *event);
 extern void perf_event_enable(struct perf_event *event);
 extern void perf_event_disable(struct perf_event *event);
 extern int __perf_event_disable(void *info);
@@ -782,6 +783,7 @@ static inline void perf_event_fork(struct task_struct *tsk)		{ }
 static inline void perf_event_init(void)				{ }
 static inline int  perf_swevent_get_recursion_context(void)		{ return -1; }
 static inline void perf_swevent_put_recursion_context(int rctx)		{ }
+static inline u64 perf_swevent_set_period(struct perf_event *event)	{ return 0; }
 static inline void perf_event_enable(struct perf_event *event)		{ }
 static inline void perf_event_disable(struct perf_event *event)		{ }
 static inline int __perf_event_disable(void *info)			{ return -1; }
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 9dc297f..e0dcced 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4961,7 +4961,7 @@ static DEFINE_PER_CPU(struct swevent_htable, swevent_htable);
  * sign as trigger.
  */
 
-static u64 perf_swevent_set_period(struct perf_event *event)
+u64 perf_swevent_set_period(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
 	u64 period = hwc->last_period;
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index a64f8ae..966a241 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -612,6 +612,11 @@ static int hw_breakpoint_add(struct perf_event *bp, int flags)
 	if (!(flags & PERF_EF_START))
 		bp->hw.state = PERF_HES_STOPPED;
 
+	if (is_sampling_event(bp)) {
+		bp->hw.last_period = bp->hw.sample_period;
+		perf_swevent_set_period(bp);
+	}
+
 	return arch_install_hw_breakpoint(bp);
 }
 

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-05-28 12:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01 15:25 [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Jiri Olsa
2013-05-01 15:25 ` [PATCH 1/4] signal x86: Propage RF EFLAGS bit throught the signal restore call Jiri Olsa
2013-05-28 12:51   ` [tip:perf/core] x86/signals: Propagate RF EFLAGS bit through " tip-bot for Jiri Olsa
2013-05-01 15:25 ` [PATCH 2/4] signal x86: Clear RF EFLAGS bit for signal handler Jiri Olsa
2013-05-28 12:52   ` [tip:perf/core] x86/signals: " tip-bot for Jiri Olsa
2013-05-01 15:25 ` [PATCH 3/4] signal x86: Merge EFLAGS bit clearing into single statement Jiri Olsa
2013-05-28 12:54   ` [tip:perf/core] x86/signals: Merge EFLAGS bit clearing into a " tip-bot for Jiri Olsa
2013-05-01 15:25 ` [PATCH 4/4] perf: Fix hw breakpoints overflow period sampling Jiri Olsa
2013-05-28 12:56   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-05-01 15:52 ` [PATCHv3 0/4] perf, signal x86: Fix breakpoint events overflow handling Oleg Nesterov
2013-05-07 12:29 ` Jiri Olsa
2013-05-15 15:04   ` Jiri Olsa
2013-05-15 15:44     ` Frederic Weisbecker
2013-05-15 19:28       ` Jiri Olsa
2013-05-15 16:52     ` Peter Zijlstra
2013-05-15 19:28       ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).