All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] perf fix
  2010-04-08 13:52 [PATCH] perf: Fix unsafe frame rewinding with hot regs fetching Eric Dumazet
@ 2010-04-08 17:31 ` Frederic Weisbecker
  2010-04-13 22:51   ` Ingo Molnar
  0 siblings, 1 reply; 27+ messages in thread
From: Frederic Weisbecker @ 2010-04-08 17:31 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Eric Dumazet, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Paul Mackerras, David Miller, Archs

Ingo,

Please pull the perf/urgent branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/urgent

Thanks,
	Frederic
---

Frederic Weisbecker (1):
      perf: Fix unsafe frame rewinding with hot regs fetching


 arch/x86/kernel/dumpstack.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

---
commit ab285f2b5290d92b7ec1a6f9aad54308dadf6157
Author: Frederic Weisbecker <fweisbec@gmail.com>
Date:   Thu Apr 8 14:05:50 2010 +0200

    perf: Fix unsafe frame rewinding with hot regs fetching
    
    When we fetch the hot regs and rewind to the nth caller, it
    might happen that we dereference a frame pointer outside the
    kernel stack boundaries, like in this example:
    
    	perf_trace_sched_switch+0xd5/0x120
            schedule+0x6b5/0x860
            retint_careful+0xd/0x21
    
    Since we directly dereference a userspace frame pointer here while
    rewinding behind retint_careful, this may end up in a crash.
    
    Fix this by simply using probe_kernel_address() when we rewind the
    frame pointer.
    
    This issue will have a much more proper fix in the next version of the
    perf_arch_fetch_caller_regs() API that will only need to rewind to the
    first caller.
    
    Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    Tested-by: Eric Dumazet <eric.dumazet@gmail.com>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: David Miller <davem@davemloft.net>
    Cc: Archs <linux-arch@vger.kernel.org>

diff --git a/arch/x86/kernel/dumpstack.h b/arch/x86/kernel/dumpstack.h
index e39e771..e1a93be 100644
--- a/arch/x86/kernel/dumpstack.h
+++ b/arch/x86/kernel/dumpstack.h
@@ -14,6 +14,8 @@
 #define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
 #endif
 
+#include <linux/uaccess.h>
+
 extern void
 show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 		unsigned long *stack, unsigned long bp, char *log_lvl);
@@ -42,8 +44,10 @@ static inline unsigned long rewind_frame_pointer(int n)
 	get_bp(frame);
 
 #ifdef CONFIG_FRAME_POINTER
-	while (n--)
-		frame = frame->next_frame;
+	while (n--) {
+		if (probe_kernel_address(&frame->next_frame, frame))
+			break;
+	}
 #endif
 
 	return (unsigned long)frame;

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

* Re: [GIT PULL] perf fix
  2010-04-08 17:31 ` [GIT PULL] perf fix Frederic Weisbecker
@ 2010-04-13 22:51   ` Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2010-04-13 22:51 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, Eric Dumazet, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Paul Mackerras, David Miller, Archs


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Ingo,
> 
> Please pull the perf/urgent branch that can be found at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> 	perf/urgent
> 
> Thanks,
> 	Frederic
> ---
> 
> Frederic Weisbecker (1):
>       perf: Fix unsafe frame rewinding with hot regs fetching
> 
> 
>  arch/x86/kernel/dumpstack.h |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)

Pulled, thanks a lot Frederic!

	Ingo

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

* [GIT PULL] perf fix
@ 2010-04-20  7:32 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2010-04-20  7:32 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Paul Mackerras, =?unknown-8bit?B?RnLDqWTDqXJpYw==?= Weisbecker,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-fixes-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus

 Thanks,

	Ingo

------------------>
Frederic Weisbecker (1):
      perf: Fix unsafe frame rewinding with hot regs fetching


 arch/x86/kernel/dumpstack.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/dumpstack.h b/arch/x86/kernel/dumpstack.h
index e39e771..e1a93be 100644
--- a/arch/x86/kernel/dumpstack.h
+++ b/arch/x86/kernel/dumpstack.h
@@ -14,6 +14,8 @@
 #define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
 #endif
 
+#include <linux/uaccess.h>
+
 extern void
 show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 		unsigned long *stack, unsigned long bp, char *log_lvl);
@@ -42,8 +44,10 @@ static inline unsigned long rewind_frame_pointer(int n)
 	get_bp(frame);
 
 #ifdef CONFIG_FRAME_POINTER
-	while (n--)
-		frame = frame->next_frame;
+	while (n--) {
+		if (probe_kernel_address(&frame->next_frame, frame))
+			break;
+	}
 #endif
 
 	return (unsigned long)frame;

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

* [GIT PULL] perf fix
@ 2010-05-04 17:52 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2010-05-04 17:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Paul Mackerras, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-fixes-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus

 Thanks,

	Ingo

------------------>
Tejun Heo (1):
      perf: Fix resource leak in failure path of perf_event_open()


 kernel/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 2f3fbf8..3d1552d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4897,7 +4897,7 @@ err_fput_free_put_context:
 
 err_free_put_context:
 	if (err < 0)
-		kfree(event);
+		free_event(event);
 
 err_put_context:
 	if (err < 0)

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

* [GIT PULL] perf fix
@ 2010-05-15  6:00 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2010-05-15  6:00 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Paul Mackerras, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-fixes-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus

 Thanks,

	Ingo

------------------>
Arnaldo Carvalho de Melo (1):
      perf record: Add a fallback to the reference relocation symbol


 tools/perf/builtin-record.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3b8b638..f1411e9 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -563,6 +563,9 @@ static int __cmd_record(int argc, const char **argv)
 
 	err = event__synthesize_kernel_mmap(process_synthesized_event,
 					    session, "_text");
+	if (err < 0)
+		err = event__synthesize_kernel_mmap(process_synthesized_event,
+						    session, "_stext");
 	if (err < 0) {
 		pr_err("Couldn't record kernel reference relocation symbol.\n");
 		return err;

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

* [GIT PULL] perf fix
@ 2011-07-23  8:57 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2011-07-23  8:57 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-urgent-for-linus

 Thanks,

	Ingo

------------------>
David Ahern (1):
      perf tools, x86: Fix 32-bit compile on 64-bit system


 tools/perf/Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 940257b..c168366 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -52,7 +52,10 @@ ifeq ($(ARCH),i386)
 endif
 ifeq ($(ARCH),x86_64)
 	ARCH := x86
-	IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
+	IS_X86_64 := 0
+	ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
+		IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
+	endif
 	ifeq (${IS_X86_64}, 1)
 		RAW_ARCH := x86_64
 		ARCH_CFLAGS := -DARCH_X86_64

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

* [GIT PULL] perf fix
@ 2011-10-01  7:52 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2011-10-01  7:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Frédéric Weisbecker, Steven Rostedt, Thomas Gleixner,
	Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://tesla.tglx.de/git/linux-2.6-tip.git perf-urgent-for-linus

 Thanks,

	Ingo

------------------>
Jiri Olsa (1):
      perf tools: Fix raw sample reading


 tools/perf/util/evsel.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c5748c5..e389815 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -449,6 +449,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 	}
 
 	if (type & PERF_SAMPLE_RAW) {
+		const u64 *pdata;
+
 		u.val64 = *array;
 		if (WARN_ONCE(swapped,
 			      "Endianness of raw data not corrected!\n")) {
@@ -462,11 +464,12 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 			return -EFAULT;
 
 		data->raw_size = u.val32[0];
+		pdata = (void *) array + sizeof(u32);
 
-		if (sample_overlap(event, &u.val32[1], data->raw_size))
+		if (sample_overlap(event, pdata, data->raw_size))
 			return -EFAULT;
 
-		data->raw_data = &u.val32[1];
+		data->raw_data = (void *) pdata;
 	}
 
 	return 0;

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

* [GIT PULL] perf fix
@ 2011-12-17 20:53 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2011-12-17 20:53 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Andrew Morton, Thomas Gleixner

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

 Thanks,

	Ingo

------------------>
Will Deacon (1):
      perf events: Fix ring_buffer_wakeup() brown paperbag bug


 kernel/events/core.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d3b9df5..58690af 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3558,9 +3558,13 @@ static void ring_buffer_wakeup(struct perf_event *event)
 
 	rcu_read_lock();
 	rb = rcu_dereference(event->rb);
-	list_for_each_entry_rcu(event, &rb->event_list, rb_entry) {
+	if (!rb)
+		goto unlock;
+
+	list_for_each_entry_rcu(event, &rb->event_list, rb_entry)
 		wake_up_all(&event->waitq);
-	}
+
+unlock:
 	rcu_read_unlock();
 }
 

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

* [GIT PULL] perf fix
@ 2012-03-03  7:50 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2012-03-03  7:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   HEAD: 1018faa6cf23b256bf25919ef203cd7c129f06f2 perf/x86/kvm: Fix Host-Only/Guest-Only counting with SVM disabled

 Thanks,

	Ingo

------------------>
Joerg Roedel (1):
      perf/x86/kvm: Fix Host-Only/Guest-Only counting with SVM disabled


 arch/x86/include/asm/perf_event.h    |    8 +++++++
 arch/x86/kernel/cpu/perf_event.h     |    8 +++++-
 arch/x86/kernel/cpu/perf_event_amd.c |   37 ++++++++++++++++++++++++++++++++-
 arch/x86/kvm/svm.c                   |    5 ++++
 4 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 096c975..461ce43 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -242,4 +242,12 @@ static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
 static inline void perf_events_lapic_init(void)	{ }
 #endif
 
+#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
+ extern void amd_pmu_enable_virt(void);
+ extern void amd_pmu_disable_virt(void);
+#else
+ static inline void amd_pmu_enable_virt(void) { }
+ static inline void amd_pmu_disable_virt(void) { }
+#endif
+
 #endif /* _ASM_X86_PERF_EVENT_H */
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 8944062..c30c807 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -147,7 +147,9 @@ struct cpu_hw_events {
 	/*
 	 * AMD specific bits
 	 */
-	struct amd_nb		*amd_nb;
+	struct amd_nb			*amd_nb;
+	/* Inverted mask of bits to clear in the perf_ctr ctrl registers */
+	u64				perf_ctr_virt_mask;
 
 	void				*kfree_on_online;
 };
@@ -417,9 +419,11 @@ void x86_pmu_disable_all(void);
 static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
 					  u64 enable_mask)
 {
+	u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask);
+
 	if (hwc->extra_reg.reg)
 		wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
-	wrmsrl(hwc->config_base, hwc->config | enable_mask);
+	wrmsrl(hwc->config_base, (hwc->config | enable_mask) & ~disable_mask);
 }
 
 void x86_pmu_enable_all(int added);
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 0397b23..67250a5 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -1,4 +1,5 @@
 #include <linux/perf_event.h>
+#include <linux/export.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -357,7 +358,9 @@ static void amd_pmu_cpu_starting(int cpu)
 	struct amd_nb *nb;
 	int i, nb_id;
 
-	if (boot_cpu_data.x86_max_cores < 2)
+	cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
+
+	if (boot_cpu_data.x86_max_cores < 2 || boot_cpu_data.x86 == 0x15)
 		return;
 
 	nb_id = amd_get_nb_id(cpu);
@@ -587,9 +590,9 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
 	.put_event_constraints	= amd_put_event_constraints,
 
 	.cpu_prepare		= amd_pmu_cpu_prepare,
-	.cpu_starting		= amd_pmu_cpu_starting,
 	.cpu_dead		= amd_pmu_cpu_dead,
 #endif
+	.cpu_starting		= amd_pmu_cpu_starting,
 };
 
 __init int amd_pmu_init(void)
@@ -621,3 +624,33 @@ __init int amd_pmu_init(void)
 
 	return 0;
 }
+
+void amd_pmu_enable_virt(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	cpuc->perf_ctr_virt_mask = 0;
+
+	/* Reload all events */
+	x86_pmu_disable_all();
+	x86_pmu_enable_all(0);
+}
+EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
+
+void amd_pmu_disable_virt(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	/*
+	 * We only mask out the Host-only bit so that host-only counting works
+	 * when SVM is disabled. If someone sets up a guest-only counter when
+	 * SVM is disabled the Guest-only bits still gets set and the counter
+	 * will not count anything.
+	 */
+	cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
+
+	/* Reload all events */
+	x86_pmu_disable_all();
+	x86_pmu_enable_all(0);
+}
+EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 5fa553b..e385214 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -29,6 +29,7 @@
 #include <linux/ftrace_event.h>
 #include <linux/slab.h>
 
+#include <asm/perf_event.h>
 #include <asm/tlbflush.h>
 #include <asm/desc.h>
 #include <asm/kvm_para.h>
@@ -575,6 +576,8 @@ static void svm_hardware_disable(void *garbage)
 		wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT);
 
 	cpu_svm_disable();
+
+	amd_pmu_disable_virt();
 }
 
 static int svm_hardware_enable(void *garbage)
@@ -622,6 +625,8 @@ static int svm_hardware_enable(void *garbage)
 
 	svm_init_erratum_383();
 
+	amd_pmu_enable_virt();
+
 	return 0;
 }
 

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

* [GIT PULL] perf fix
@ 2012-05-23 18:50 Ingo Molnar
  2012-05-23 18:56 ` Josh Boyer
  0 siblings, 1 reply; 27+ messages in thread
From: Ingo Molnar @ 2012-05-23 18:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   HEAD: 5bcdf5e4fee3c45e1281c25e4941f2163cb28c65 perf/x86: Update event scheduling constraints for AMD family 15h models

Leftover AMD PMU driver fix fix from the end of the v3.4 
stabilization cycle.

 Thanks,

	Ingo

------------------>
Robert Richter (1):
      perf/x86: Update event scheduling constraints for AMD family 15h models


 arch/x86/kernel/cpu/perf_event_amd.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 95e7fe1..9edc786 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -493,6 +493,7 @@ static __initconst const struct x86_pmu amd_pmu = {
  * 0x023	DE	PERF_CTL[2:0]
  * 0x02D	LS	PERF_CTL[3]
  * 0x02E	LS	PERF_CTL[3,0]
+ * 0x031	LS	PERF_CTL[2:0] (**)
  * 0x043	CU	PERF_CTL[2:0]
  * 0x045	CU	PERF_CTL[2:0]
  * 0x046	CU	PERF_CTL[2:0]
@@ -506,10 +507,12 @@ static __initconst const struct x86_pmu amd_pmu = {
  * 0x0DD	LS	PERF_CTL[5:0]
  * 0x0DE	LS	PERF_CTL[5:0]
  * 0x0DF	LS	PERF_CTL[5:0]
+ * 0x1C0	EX	PERF_CTL[5:3]
  * 0x1D6	EX	PERF_CTL[5:0]
  * 0x1D8	EX	PERF_CTL[5:0]
  *
- * (*) depending on the umask all FPU counters may be used
+ * (*)  depending on the umask all FPU counters may be used
+ * (**) only one unitmask enabled at a time
  */
 
 static struct event_constraint amd_f15_PMC0  = EVENT_CONSTRAINT(0, 0x01, 0);
@@ -559,6 +562,12 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *ev
 			return &amd_f15_PMC3;
 		case 0x02E:
 			return &amd_f15_PMC30;
+		case 0x031:
+			if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1)
+				return &amd_f15_PMC20;
+			return &emptyconstraint;
+		case 0x1C0:
+			return &amd_f15_PMC53;
 		default:
 			return &amd_f15_PMC50;
 		}

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

* Re: [GIT PULL] perf fix
  2012-05-23 18:50 Ingo Molnar
@ 2012-05-23 18:56 ` Josh Boyer
  2012-05-23 18:57   ` Josh Boyer
  2012-05-23 20:04   ` Ingo Molnar
  0 siblings, 2 replies; 27+ messages in thread
From: Josh Boyer @ 2012-05-23 18:56 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Thomas Gleixner, Andrew Morton

On Wed, May 23, 2012 at 2:50 PM, Ingo Molnar <mingo@kernel.org> wrote:
> Linus,
>
> Please pull the latest perf-urgent-for-linus git tree from:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
>
>   HEAD: 5bcdf5e4fee3c45e1281c25e4941f2163cb28c65 perf/x86: Update event scheduling constraints for AMD family 15h models
>
> Leftover AMD PMU driver fix fix from the end of the v3.4
> stabilization cycle.

Perf doesn't even build in Linus' current tree.  You might want to include

http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commitdiff;h=8784eb7497b928de33a715e26da2bd51d424bec1

with your pull request.

josh

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

* Re: [GIT PULL] perf fix
  2012-05-23 18:56 ` Josh Boyer
@ 2012-05-23 18:57   ` Josh Boyer
  2012-05-23 20:04   ` Ingo Molnar
  1 sibling, 0 replies; 27+ messages in thread
From: Josh Boyer @ 2012-05-23 18:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Thomas Gleixner, Andrew Morton

On Wed, May 23, 2012 at 2:56 PM, Josh Boyer <jwboyer@gmail.com> wrote:
> On Wed, May 23, 2012 at 2:50 PM, Ingo Molnar <mingo@kernel.org> wrote:
>> Linus,
>>
>> Please pull the latest perf-urgent-for-linus git tree from:
>>
>>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
>>
>>   HEAD: 5bcdf5e4fee3c45e1281c25e4941f2163cb28c65 perf/x86: Update event scheduling constraints for AMD family 15h models
>>
>> Leftover AMD PMU driver fix fix from the end of the v3.4
>> stabilization cycle.
>
> Perf doesn't even build in Linus' current tree.  You might want to include
>
> http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commitdiff;h=8784eb7497b928de33a715e26da2bd51d424bec1

Possibly this one too:

http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commitdiff;h=e326e7524531c5c6de4a8cf8eeed60b4a9f47637

josh

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

* Re: [GIT PULL] perf fix
  2012-05-23 18:56 ` Josh Boyer
  2012-05-23 18:57   ` Josh Boyer
@ 2012-05-23 20:04   ` Ingo Molnar
  2012-05-23 20:10     ` Josh Boyer
  1 sibling, 1 reply; 27+ messages in thread
From: Ingo Molnar @ 2012-05-23 20:04 UTC (permalink / raw)
  To: Josh Boyer
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Thomas Gleixner, Andrew Morton


* Josh Boyer <jwboyer@gmail.com> wrote:

> On Wed, May 23, 2012 at 2:50 PM, Ingo Molnar <mingo@kernel.org> wrote:
> > Linus,
> >
> > Please pull the latest perf-urgent-for-linus git tree from:
> >
> >   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
> >
> >   HEAD: 5bcdf5e4fee3c45e1281c25e4941f2163cb28c65 perf/x86: Update event scheduling constraints for AMD family 15h models
> >
> > Leftover AMD PMU driver fix fix from the end of the v3.4
> > stabilization cycle.
> 
> Perf doesn't even build in Linus' current tree.

Yes, that's a regression in some build environments. (it builds 
fine in our environments, that's why it wasn't noticed.)

> [...]  You might want to include
> 
> http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commitdiff;h=8784eb7497b928de33a715e26da2bd51d424bec1
> 
> with your pull request.

I sent that (and other fixes) to Linus too, earlier today.

This pull request you replied to is the v3.4 era fixes tree, 
with one remaining fix in it.

Thanks,

	Ingo

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

* Re: [GIT PULL] perf fix
  2012-05-23 20:04   ` Ingo Molnar
@ 2012-05-23 20:10     ` Josh Boyer
  2012-05-23 20:20       ` Ingo Molnar
  0 siblings, 1 reply; 27+ messages in thread
From: Josh Boyer @ 2012-05-23 20:10 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Thomas Gleixner, Andrew Morton

On Wed, May 23, 2012 at 4:04 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Josh Boyer <jwboyer@gmail.com> wrote:
>> Perf doesn't even build in Linus' current tree.
>
> Yes, that's a regression in some build environments. (it builds
> fine in our environments, that's why it wasn't noticed.)
>
>> [...]  You might want to include
>>
>> http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commitdiff;h=8784eb7497b928de33a715e26da2bd51d424bec1
>>
>> with your pull request.
>
> I sent that (and other fixes) to Linus too, earlier today.

I saw that.  Thank you.

> This pull request you replied to is the v3.4 era fixes tree,
> with one remaining fix in it.

I see.  The forest of tip trees apparently confuses me still.  I'll
figure it out eventually.

josh

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

* Re: [GIT PULL] perf fix
  2012-05-23 20:10     ` Josh Boyer
@ 2012-05-23 20:20       ` Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2012-05-23 20:20 UTC (permalink / raw)
  To: Josh Boyer
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Thomas Gleixner, Andrew Morton


* Josh Boyer <jwboyer@gmail.com> wrote:

> > This pull request you replied to is the v3.4 era fixes tree, 
> > with one remaining fix in it.
> 
> I see.  The forest of tip trees apparently confuses me still.  
> I'll figure it out eventually.

The topic tree layout for single-topic trees is pretty simple 
and straightforward - but the situation you met here was 
arguably a weird corner case:

 X/urgent are the fixes that go to Linus
 X/core   are the development patches for the next merge window

Where 'X' can be one of: perf, sched, timer, irq - the main 
subsystem trees we maintain. (x86 is a multi-topic tree, with 
intuitively named topic trees, such as x86/reboot, x86/asm or 
x86/mm.)

All of them are test-merged into tip:master - this is the one 
that you will typically use, the topic layout is for maintainers 
and for power-contributors/submaintaners who are sending Git 
pull requests to us.

at the beginning of a merge window (i.e. right now) there might 
be fixes pending in perf/urgent that did not make it to v3.4. 
Instead of merging them into perf/core I tend to send them to 
Linus as a standalone tree.

The rest of perf/core, once the initial one or two sets of 
commits get pulled by Linus, morphs into perf/urgent, fairly 
early in the merge window.

Thus there's a new perf/urgent and an empty perf/core, and the 
cycle starts again.

You met this cycle switch period to the day (the chance is only 
1:90 for that, consider yourself lucky ;-), which created the 
impression of a confusing fixes workflow.

Thanks,

	Ingo

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

* [GIT PULL] perf fix
@ 2013-04-27  7:50 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2013-04-27  7:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Paul E. McKenney, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Thomas Gleixner

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   HEAD: c79aa0d96548aee50570209eb2d45c8f4ac49230 events: Protect access via task_subsys_state_check()

This fix adds missing RCU read protection.

 Thanks,

	Ingo

------------------>
Paul E. McKenney (1):
      events: Protect access via task_subsys_state_check()


 kernel/events/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4d3124b..9fcb094 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4596,6 +4596,7 @@ void perf_event_comm(struct task_struct *task)
 	struct perf_event_context *ctx;
 	int ctxn;
 
+	rcu_read_lock();
 	for_each_task_context_nr(ctxn) {
 		ctx = task->perf_event_ctxp[ctxn];
 		if (!ctx)
@@ -4603,6 +4604,7 @@ void perf_event_comm(struct task_struct *task)
 
 		perf_event_enable_on_exec(ctx);
 	}
+	rcu_read_unlock();
 
 	if (!atomic_read(&nr_comm_events))
 		return;

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

* [GIT PULL] perf fix
@ 2013-06-27 13:11 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2013-06-27 13:11 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   HEAD: 2976b10f05bd7f6dab9f9e7524451ddfed656a89 perf: Disable monitoring on setuid processes for regular users

One more fix for a recently discovered bug.

 Thanks,

	Ingo

------------------>
Stephane Eranian (1):
      perf: Disable monitoring on setuid processes for regular users


 fs/exec.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 6430195..ffd7a81 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1135,13 +1135,6 @@ void setup_new_exec(struct linux_binprm * bprm)
 			set_dumpable(current->mm, suid_dumpable);
 	}
 
-	/*
-	 * Flush performance counters when crossing a
-	 * security domain:
-	 */
-	if (!get_dumpable(current->mm))
-		perf_event_exit_task(current);
-
 	/* An exec changes our domain. We are no longer part of the thread
 	   group */
 
@@ -1205,6 +1198,15 @@ void install_exec_creds(struct linux_binprm *bprm)
 
 	commit_creds(bprm->cred);
 	bprm->cred = NULL;
+
+	/*
+	 * Disable monitoring for regular users
+	 * when executing setuid binaries. Must
+	 * wait until new credentials are committed
+	 * by commit_creds() above
+	 */
+	if (get_dumpable(current->mm) != SUID_DUMP_USER)
+		perf_event_exit_task(current);
 	/*
 	 * cred_guard_mutex must be held at least to this point to prevent
 	 * ptrace_attach() from altering our determination of the task's

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

* [GIT PULL] perf fix
@ 2013-09-03 13:37 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2013-09-03 13:37 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   HEAD: ae23bff1d71f8b416ed740bc458df67355c77c92 perf: Prevent race in unthrottling code

This is a leftover fix from the v3.11 cycle.

 Thanks,

	Ingo

------------------>
Jiri Olsa (1):
      perf: Prevent race in unthrottling code


 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index f86599e..258eaaf 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2712,7 +2712,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx,
 
 		hwc = &event->hw;
 
-		if (needs_unthr && hwc->interrupts == MAX_INTERRUPTS) {
+		if (hwc->interrupts == MAX_INTERRUPTS) {
 			hwc->interrupts = 0;
 			perf_log_throttle(event, 1);
 			event->pmu->start(event, 0);

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

* [GIT PULL] perf fix
  2013-09-29 11:47 ` Markus Trippelsdorf
@ 2013-09-29 14:26   ` Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2013-09-29 14:26 UTC (permalink / raw)
  To: Markus Trippelsdorf, Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Andi Kleen, Arnaldo Carvalho de Melo


* Markus Trippelsdorf <markus@trippelsdorf.de> wrote:

> On 2013.09.28 at 20:03 +0200, Ingo Molnar wrote:
> > Andi Kleen (1):
> >       perf symbols: Demangle cloned functions
> 
> The commit above e95ab53645:
> 
>  commit de95ab53645a2f0015e0f68ee723f18dce2b8b51
>  Author: Andi Kleen <ak@linux.intel.com>
>  Date:   Thu Sep 12 08:16:38 2013 -0700
> 
>      perf symbols: Demangle cloned functions
> 
> breaks "perf top" on my machine. I just see a gray screen with no text
> at all. Sometimes the following error messages are printed:
>  *** Error in `perf': invalid fastbin entry (free): 0x00000000029b18c0 ***
>  *** Error in `perf': malloc(): memory corruption (fast): 0x0000000000ee0b10 ***
> 
> Reverting the commit "fixes" the issue.

Sorry about that.

Looking at the commit it fails on several quality levels:

 - sloppy structure: the code is unreadable, it should have been a 
                     separate helper function

 - sloppy flow:      why the heck does it do strchr() twice? Not to 
                     mention the fragile way of how the new flow tries 
                     to merge with the old instead of cleanly separating.

 - sloppy types:     it casts a const char * over into char *

 - sloppy style:     variable block not separated from statements, 
                     meaningless temporary variable names, etc. etc.

 - and it's not even a regression fix to begin with!

So the right resolution is a revert. Andi, please send a fixed patch with 
all of these issues and the crash fixed.

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   HEAD: 14951f22f1cc8375ead345d2ca08455e91f2152b Revert "perf symbols: Demangle cloned functions"

It fixes the 'perf top' regression Markus Trippelsdorf reported.

 Thanks,

	Ingo

------------------>
Ingo Molnar (1):
      Revert "perf symbols: Demangle cloned functions"


 tools/perf/util/symbol-elf.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index d2a888e..a9c829b 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -928,33 +928,8 @@ int dso__load_sym(struct dso *dso, struct map *map,
 		 * to it...
 		 */
 		if (symbol_conf.demangle) {
-			/*
-			 * The demangler doesn't deal with cloned functions.
-			 * XXXX.clone.NUM or similar
-			 * Strip the dot part and readd it later.
-			 */
-			char *p = (char *)elf_name, *dot;
-			dot = strchr(elf_name, '.');
-			if (dot) {
-				p = strdup(elf_name);
-				if (!p)
-					goto new_symbol;
-				dot = strchr(p, '.');
-				*dot = 0;
-			}
-
-			demangled = bfd_demangle(NULL, p,
+			demangled = bfd_demangle(NULL, elf_name,
 						 DMGL_PARAMS | DMGL_ANSI);
-			if (dot)
-				*dot = '.';
-			if (demangled && dot) {
-				demangled = realloc(demangled, strlen(demangled) + strlen(dot) + 1);
-				if (!demangled)
-					goto new_symbol;
-				strcpy(demangled + (dot - p), dot);
-			}
-			if (p != elf_name)
-				free(p);
 			if (demangled != NULL)
 				elf_name = demangled;
 		}

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

* [GIT PULL] perf fix
@ 2013-12-17 13:35 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2013-12-17 13:35 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: cf30d52e2d11523c42048ab89ed4215b5021526a perf/x86: Fix constraint table end marker bug

An x86/intel event constraint fix.

 Thanks,

	Ingo

------------------>
Maria Dimakopoulou (1):
      perf/x86: Fix constraint table end marker bug


 arch/x86/kernel/cpu/perf_event.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index fd00bb2..c1a8618 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -262,11 +262,20 @@ struct cpu_hw_events {
 	__EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
 			  HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST_HSW)
 
-#define EVENT_CONSTRAINT_END		\
-	EVENT_CONSTRAINT(0, 0, 0)
+/*
+ * We define the end marker as having a weight of -1
+ * to enable blacklisting of events using a counter bitmask
+ * of zero and thus a weight of zero.
+ * The end marker has a weight that cannot possibly be
+ * obtained from counting the bits in the bitmask.
+ */
+#define EVENT_CONSTRAINT_END { .weight = -1 }
 
+/*
+ * Check for end marker with weight == -1
+ */
 #define for_each_event_constraint(e, c)	\
-	for ((e) = (c); (e)->weight; (e)++)
+	for ((e) = (c); (e)->weight != -1; (e)++)
 
 /*
  * Extra registers for specific events.

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

* [GIT PULL] perf fix
@ 2015-03-28 10:24 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2015-03-28 10:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Thomas Gleixner, Andrew Morton,
	Arnaldo Carvalho de Melo, Jiri Olsa

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: d525211f9d1be8b523ec7633f080f2116f5ea536 perf: Fix irq_work 'tail' recursion

A perf kernel side fix for a fuzzer triggered lockup.

 Thanks,

	Ingo

------------------>
Peter Zijlstra (1):
      perf: Fix irq_work 'tail' recursion


 kernel/events/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 453ef61311d4..2fabc0627165 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4574,6 +4574,13 @@ static void perf_pending_event(struct irq_work *entry)
 {
 	struct perf_event *event = container_of(entry,
 			struct perf_event, pending);
+	int rctx;
+
+	rctx = perf_swevent_get_recursion_context();
+	/*
+	 * If we 'fail' here, that's OK, it means recursion is already disabled
+	 * and we won't recurse 'further'.
+	 */
 
 	if (event->pending_disable) {
 		event->pending_disable = 0;
@@ -4584,6 +4591,9 @@ static void perf_pending_event(struct irq_work *entry)
 		event->pending_wakeup = 0;
 		perf_event_wakeup(event);
 	}
+
+	if (rctx >= 0)
+		perf_swevent_put_recursion_context(rctx);
 }
 
 /*

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

* [GIT PULL] perf fix
@ 2016-04-23 11:24 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2016-04-23 11:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: a19cad6d66823ddd54b0e7c88d7bddd307cb1161 Merge tag 'perf-urgent-for-mingo-20160418' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

A single tooling fix for a user-triggerable segfault.

 Thanks,

	Ingo

------------------>
Adrian Hunter (1):
      perf intel-pt: Fix segfault tracing transactions


 tools/perf/util/intel-pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 407f11b97c8d..617578440989 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -1130,7 +1130,7 @@ static int intel_pt_synth_transaction_sample(struct intel_pt_queue *ptq)
 		pr_err("Intel Processor Trace: failed to deliver transaction event, error %d\n",
 		       ret);
 
-	if (pt->synth_opts.callchain)
+	if (pt->synth_opts.last_branch)
 		intel_pt_reset_last_branch_rb(ptq);
 
 	return ret;

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

* [GIT PULL] perf fix
@ 2016-05-10 11:43 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2016-05-10 11:43 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: 93193230f7b8bd484d1749f4044d1214d521c804 perf/core: Change the default paranoia level to 2

Bump up the default perf paranoia level to 2 because otherwise perf can be used by 
local users to defeat KASLR, amongst other things.

 Thanks,

	Ingo

------------------>
Andy Lutomirski (1):
      perf/core: Change the default paranoia level to 2


 Documentation/sysctl/kernel.txt | 2 +-
 kernel/events/core.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 57653a44b128..fcddfd5ded99 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -645,7 +645,7 @@ allowed to execute.
 perf_event_paranoid:
 
 Controls use of the performance events system by unprivileged
-users (without CAP_SYS_ADMIN).  The default value is 1.
+users (without CAP_SYS_ADMIN).  The default value is 2.
 
  -1: Allow use of (almost) all events by all users
 >=0: Disallow raw tracepoint access by users without CAP_IOC_LOCK
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4e2ebf6f2f1f..c0ded2416615 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -351,7 +351,7 @@ static struct srcu_struct pmus_srcu;
  *   1 - disallow cpu events for unpriv
  *   2 - disallow kernel profiling for unpriv
  */
-int sysctl_perf_event_paranoid __read_mostly = 1;
+int sysctl_perf_event_paranoid __read_mostly = 2;
 
 /* Minimum for 512 kiB + 1 user control page */
 int sysctl_perf_event_mlock __read_mostly = 512 + (PAGE_SIZE / 1024); /* 'free' kiB per user */

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

* [GIT PULL] perf fix
@ 2016-07-13 12:49 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2016-07-13 12:49 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: eb019503569c8c701f1e9c70e848d99c6680839b perf/x86: Fix bogus kernel printk, again

A single printk message fix.

 Thanks,

	Ingo

------------------>
Vegard Nossum (1):
      perf/x86: Fix bogus kernel printk, again


 arch/x86/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 26ced536005a..91eac39625be 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -263,7 +263,7 @@ static bool check_hw_exists(void)
 
 msr_fail:
 	pr_cont("Broken PMU hardware detected, using software events only.\n");
-	pr_info("%sFailed to access perfctr msr (MSR %x is %Lx)\n",
+	printk("%sFailed to access perfctr msr (MSR %x is %Lx)\n",
 		boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR,
 		reg, val_new);
 

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

* [GIT PULL] perf fix
@ 2017-08-26  7:12 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2017-08-26  7:12 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: 64aee2a965cf2954a038b5522f11d2cd2f0f8f3e perf/core: Fix group {cpu,task} validation

A single fix to not allow nonsensical event groups that result in kernel warnings.

 Thanks,

	Ingo

------------------>
Mark Rutland (1):
      perf/core: Fix group {cpu,task} validation


 kernel/events/core.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index ee20d4c546b5..3504125871d2 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10032,28 +10032,27 @@ SYSCALL_DEFINE5(perf_event_open,
 			goto err_context;
 
 		/*
-		 * Do not allow to attach to a group in a different
-		 * task or CPU context:
+		 * Make sure we're both events for the same CPU;
+		 * grouping events for different CPUs is broken; since
+		 * you can never concurrently schedule them anyhow.
 		 */
-		if (move_group) {
-			/*
-			 * Make sure we're both on the same task, or both
-			 * per-cpu events.
-			 */
-			if (group_leader->ctx->task != ctx->task)
-				goto err_context;
+		if (group_leader->cpu != event->cpu)
+			goto err_context;
 
-			/*
-			 * Make sure we're both events for the same CPU;
-			 * grouping events for different CPUs is broken; since
-			 * you can never concurrently schedule them anyhow.
-			 */
-			if (group_leader->cpu != event->cpu)
-				goto err_context;
-		} else {
-			if (group_leader->ctx != ctx)
-				goto err_context;
-		}
+		/*
+		 * Make sure we're both on the same task, or both
+		 * per-CPU events.
+		 */
+		if (group_leader->ctx->task != ctx->task)
+			goto err_context;
+
+		/*
+		 * Do not allow to attach to a group in a different task
+		 * or CPU context. If we're moving SW events, we'll fix
+		 * this up later, so allow that.
+		 */
+		if (!move_group && group_leader->ctx != ctx)
+			goto err_context;
 
 		/*
 		 * Only a group leader can be exclusive or pinned

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

* [GIT PULL] perf fix
@ 2017-10-27 19:14 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2017-10-27 19:14 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: 2eece390bf68ec8f733d7e4a3ba8a5ea350082ae perf/x86/intel/bts: Fix exclusive event reference leak

A fix for a misplaced permission check that can leave perf PT or LBR disabled (on 
Intel CPUs) permanently until the next reboot.

 Thanks,

	Ingo

------------------>
Alexander Shishkin (1):
      perf/x86/intel/bts: Fix exclusive event reference leak


 arch/x86/events/intel/bts.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c
index 16076eb34699..141e07b06216 100644
--- a/arch/x86/events/intel/bts.c
+++ b/arch/x86/events/intel/bts.c
@@ -546,9 +546,6 @@ static int bts_event_init(struct perf_event *event)
 	if (event->attr.type != bts_pmu.type)
 		return -ENOENT;
 
-	if (x86_add_exclusive(x86_lbr_exclusive_bts))
-		return -EBUSY;
-
 	/*
 	 * BTS leaks kernel addresses even when CPL0 tracing is
 	 * disabled, so disallow intel_bts driver for unprivileged
@@ -562,6 +559,9 @@ static int bts_event_init(struct perf_event *event)
 	    !capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
+	if (x86_add_exclusive(x86_lbr_exclusive_bts))
+		return -EBUSY;
+
 	ret = x86_reserve_hardware();
 	if (ret) {
 		x86_del_exclusive(x86_lbr_exclusive_bts);

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

* [GIT PULL] perf fix
@ 2018-01-17 15:27 Ingo Molnar
  0 siblings, 0 replies; 27+ messages in thread
From: Ingo Molnar @ 2018-01-17 15:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus

   # HEAD: 1289e0e29857e606a70a0200bf7849ae38d3493a perf/x86/rapl: Fix Haswell and Broadwell server RAPL event

An Intel RAPL events fix.

 Thanks,

	Ingo

------------------>
Kan Liang (1):
      perf/x86/rapl: Fix Haswell and Broadwell server RAPL event


 arch/x86/events/intel/rapl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 005908ee9333..a2efb490f743 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -755,14 +755,14 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_IVYBRIDGE_X, snbep_rapl_init),
 
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_HASWELL_CORE, hsw_rapl_init),
-	X86_RAPL_MODEL_MATCH(INTEL_FAM6_HASWELL_X,    hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_HASWELL_X,    hsx_rapl_init),
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_HASWELL_ULT,  hsw_rapl_init),
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_HASWELL_GT3E, hsw_rapl_init),
 
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_BROADWELL_CORE,   hsw_rapl_init),
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_BROADWELL_GT3E,   hsw_rapl_init),
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_BROADWELL_X,	  hsx_rapl_init),
-	X86_RAPL_MODEL_MATCH(INTEL_FAM6_BROADWELL_XEON_D, hsw_rapl_init),
+	X86_RAPL_MODEL_MATCH(INTEL_FAM6_BROADWELL_XEON_D, hsx_rapl_init),
 
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_XEON_PHI_KNL, knl_rapl_init),
 	X86_RAPL_MODEL_MATCH(INTEL_FAM6_XEON_PHI_KNM, knl_rapl_init),

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

end of thread, other threads:[~2018-01-17 15:27 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-17 20:53 [GIT PULL] perf fix Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2018-01-17 15:27 Ingo Molnar
2017-10-27 19:14 Ingo Molnar
2017-08-26  7:12 Ingo Molnar
2016-07-13 12:49 Ingo Molnar
2016-05-10 11:43 Ingo Molnar
2016-04-23 11:24 Ingo Molnar
2015-03-28 10:24 Ingo Molnar
2013-12-17 13:35 Ingo Molnar
2013-09-28 18:03 [GIT PULL] perf fixes Ingo Molnar
2013-09-29 11:47 ` Markus Trippelsdorf
2013-09-29 14:26   ` [GIT PULL] perf fix Ingo Molnar
2013-09-03 13:37 Ingo Molnar
2013-06-27 13:11 Ingo Molnar
2013-04-27  7:50 Ingo Molnar
2012-05-23 18:50 Ingo Molnar
2012-05-23 18:56 ` Josh Boyer
2012-05-23 18:57   ` Josh Boyer
2012-05-23 20:04   ` Ingo Molnar
2012-05-23 20:10     ` Josh Boyer
2012-05-23 20:20       ` Ingo Molnar
2012-03-03  7:50 Ingo Molnar
2011-10-01  7:52 Ingo Molnar
2011-07-23  8:57 Ingo Molnar
2010-05-15  6:00 Ingo Molnar
2010-05-04 17:52 Ingo Molnar
2010-04-20  7:32 Ingo Molnar
2010-04-08 13:52 [PATCH] perf: Fix unsafe frame rewinding with hot regs fetching Eric Dumazet
2010-04-08 17:31 ` [GIT PULL] perf fix Frederic Weisbecker
2010-04-13 22:51   ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.