linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] perf events fix
@ 2023-09-10 16:20 Ingo Molnar
  2023-09-10 18:08 ` pr-tracker-bot
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2023-09-10 16:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
	Alexander Shishkin, Mark Rutland, Namhyung Kim, linux-perf-users,
	Borislav Petkov, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf/urgent git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-09-10

   # HEAD: 6f7f984fa85b305799076a1bcec941b9377587de perf/x86/uncore: Correct the number of CHAs on EMR

Work around a firmware bug in the uncore PMU driver,
affecting certain Intel systems.

 Thanks,

	Ingo

------------------>
Kan Liang (1):
      perf/x86/uncore: Correct the number of CHAs on EMR


 arch/x86/events/intel/uncore_snbep.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 4d349986f76a..8250f0f59c2b 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -6474,8 +6474,18 @@ void spr_uncore_cpu_init(void)
 
 	type = uncore_find_type_by_id(uncore_msr_uncores, UNCORE_SPR_CHA);
 	if (type) {
+		/*
+		 * The value from the discovery table (stored in the type->num_boxes
+		 * of UNCORE_SPR_CHA) is incorrect on some SPR variants because of a
+		 * firmware bug. Using the value from SPR_MSR_UNC_CBO_CONFIG to replace it.
+		 */
 		rdmsrl(SPR_MSR_UNC_CBO_CONFIG, num_cbo);
-		type->num_boxes = num_cbo;
+		/*
+		 * The MSR doesn't work on the EMR XCC, but the firmware bug doesn't impact
+		 * the EMR XCC. Don't let the value from the MSR replace the existing value.
+		 */
+		if (num_cbo)
+			type->num_boxes = num_cbo;
 	}
 	spr_uncore_iio_free_running.num_boxes = uncore_type_max_boxes(uncore_msr_uncores, UNCORE_SPR_IIO);
 }

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

* Re: [GIT PULL] perf events fix
  2023-09-10 16:20 Ingo Molnar
@ 2023-09-10 18:08 ` pr-tracker-bot
  0 siblings, 0 replies; 10+ messages in thread
From: pr-tracker-bot @ 2023-09-10 18:08 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Jiri Olsa, Alexander Shishkin,
	Mark Rutland, Namhyung Kim, linux-perf-users, Borislav Petkov,
	Thomas Gleixner, Andrew Morton

The pull request you sent on Sun, 10 Sep 2023 18:20:51 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-09-10

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e79dbf03d87b2d9978d76ddc1c06424b07b215ad

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] perf events fix
@ 2023-10-14 21:58 Ingo Molnar
  2023-10-14 22:49 ` pr-tracker-bot
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2023-10-14 21:58 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
	Alexander Shishkin, Mark Rutland, Namhyung Kim, linux-perf-users,
	Borislav Petkov, Thomas Gleixner, Andrew Morton


Linus,

Please pull the latest perf/urgent git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-10-14

   # HEAD: e53899771a02f798d436655efbd9d4b46c0f9265 perf/x86/lbr: Filter vsyscall addresses

Fix an LBR sampling bug.

 Thanks,

	Ingo

------------------>
JP Kobryn (1):
      perf/x86/lbr: Filter vsyscall addresses


 arch/x86/events/utils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/utils.c b/arch/x86/events/utils.c
index 76b1f8bb0fd5..dab4ed199227 100644
--- a/arch/x86/events/utils.c
+++ b/arch/x86/events/utils.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <asm/insn.h>
+#include <linux/mm.h>
 
 #include "perf_event.h"
 
@@ -132,9 +133,9 @@ static int get_branch_type(unsigned long from, unsigned long to, int abort,
 		 * The LBR logs any address in the IP, even if the IP just
 		 * faulted. This means userspace can control the from address.
 		 * Ensure we don't blindly read any address by validating it is
-		 * a known text address.
+		 * a known text address and not a vsyscall address.
 		 */
-		if (kernel_text_address(from)) {
+		if (kernel_text_address(from) && !in_gate_area_no_mm(from)) {
 			addr = (void *)from;
 			/*
 			 * Assume we can get the maximum possible size

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

* Re: [GIT PULL] perf events fix
  2023-10-14 21:58 Ingo Molnar
@ 2023-10-14 22:49 ` pr-tracker-bot
  0 siblings, 0 replies; 10+ messages in thread
From: pr-tracker-bot @ 2023-10-14 22:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Jiri Olsa, Alexander Shishkin,
	Mark Rutland, Namhyung Kim, linux-perf-users, Borislav Petkov,
	Thomas Gleixner, Andrew Morton

The pull request you sent on Sat, 14 Oct 2023 23:58:11 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-10-14

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/23931d935363846a9b39a890d4aead208cd46681

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] perf events fix
@ 2023-10-21 15:22 Ingo Molnar
  2023-10-21 18:29 ` pr-tracker-bot
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2023-10-21 15:22 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
	Alexander Shishkin, Mark Rutland, Namhyung Kim, linux-perf-users,
	Borislav Petkov, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf/urgent git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-10-21

   # HEAD: 32671e3799ca2e4590773fd0e63aaa4229e50c06 perf: Disallow mis-matched inherited group reads

Fix group event semantics.

 Thanks,

	Ingo

------------------>
Peter Zijlstra (1):
      perf: Disallow mis-matched inherited group reads


 include/linux/perf_event.h |  1 +
 kernel/events/core.c       | 39 +++++++++++++++++++++++++++++++++------
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e85cd1c0eaf3..7b5406e3288d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -704,6 +704,7 @@ struct perf_event {
 	/* The cumulative AND of all event_caps for events in this group. */
 	int				group_caps;
 
+	unsigned int			group_generation;
 	struct perf_event		*group_leader;
 	/*
 	 * event->pmu will always point to pmu in which this event belongs.
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4c72a41f11af..d0663b9324e7 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1954,6 +1954,7 @@ static void perf_group_attach(struct perf_event *event)
 
 	list_add_tail(&event->sibling_list, &group_leader->sibling_list);
 	group_leader->nr_siblings++;
+	group_leader->group_generation++;
 
 	perf_event__header_size(group_leader);
 
@@ -2144,6 +2145,7 @@ static void perf_group_detach(struct perf_event *event)
 	if (leader != event) {
 		list_del_init(&event->sibling_list);
 		event->group_leader->nr_siblings--;
+		event->group_leader->group_generation++;
 		goto out;
 	}
 
@@ -5440,7 +5442,7 @@ static int __perf_read_group_add(struct perf_event *leader,
 					u64 read_format, u64 *values)
 {
 	struct perf_event_context *ctx = leader->ctx;
-	struct perf_event *sub;
+	struct perf_event *sub, *parent;
 	unsigned long flags;
 	int n = 1; /* skip @nr */
 	int ret;
@@ -5450,6 +5452,33 @@ static int __perf_read_group_add(struct perf_event *leader,
 		return ret;
 
 	raw_spin_lock_irqsave(&ctx->lock, flags);
+	/*
+	 * Verify the grouping between the parent and child (inherited)
+	 * events is still in tact.
+	 *
+	 * Specifically:
+	 *  - leader->ctx->lock pins leader->sibling_list
+	 *  - parent->child_mutex pins parent->child_list
+	 *  - parent->ctx->mutex pins parent->sibling_list
+	 *
+	 * Because parent->ctx != leader->ctx (and child_list nests inside
+	 * ctx->mutex), group destruction is not atomic between children, also
+	 * see perf_event_release_kernel(). Additionally, parent can grow the
+	 * group.
+	 *
+	 * Therefore it is possible to have parent and child groups in a
+	 * different configuration and summing over such a beast makes no sense
+	 * what so ever.
+	 *
+	 * Reject this.
+	 */
+	parent = leader->parent;
+	if (parent &&
+	    (parent->group_generation != leader->group_generation ||
+	     parent->nr_siblings != leader->nr_siblings)) {
+		ret = -ECHILD;
+		goto unlock;
+	}
 
 	/*
 	 * Since we co-schedule groups, {enabled,running} times of siblings
@@ -5483,8 +5512,9 @@ static int __perf_read_group_add(struct perf_event *leader,
 			values[n++] = atomic64_read(&sub->lost_samples);
 	}
 
+unlock:
 	raw_spin_unlock_irqrestore(&ctx->lock, flags);
-	return 0;
+	return ret;
 }
 
 static int perf_read_group(struct perf_event *event,
@@ -5503,10 +5533,6 @@ static int perf_read_group(struct perf_event *event,
 
 	values[0] = 1 + leader->nr_siblings;
 
-	/*
-	 * By locking the child_mutex of the leader we effectively
-	 * lock the child list of all siblings.. XXX explain how.
-	 */
 	mutex_lock(&leader->child_mutex);
 
 	ret = __perf_read_group_add(leader, read_format, values);
@@ -13346,6 +13372,7 @@ static int inherit_group(struct perf_event *parent_event,
 		    !perf_get_aux_event(child_ctr, leader))
 			return -EINVAL;
 	}
+	leader->group_generation = parent_event->group_generation;
 	return 0;
 }
 

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

* Re: [GIT PULL] perf events fix
  2023-10-21 15:22 [GIT PULL] perf events fix Ingo Molnar
@ 2023-10-21 18:29 ` pr-tracker-bot
  0 siblings, 0 replies; 10+ messages in thread
From: pr-tracker-bot @ 2023-10-21 18:29 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Jiri Olsa, Alexander Shishkin,
	Mark Rutland, Namhyung Kim, linux-perf-users, Borislav Petkov,
	Thomas Gleixner, Andrew Morton

The pull request you sent on Sat, 21 Oct 2023 17:22:58 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-10-21

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/94be133fb2b8a36d79b362b3bafbdfd054a4da89

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] perf events fix
@ 2023-10-28 10:41 Ingo Molnar
  2023-10-28 18:17 ` pr-tracker-bot
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2023-10-28 10:41 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
	Alexander Shishkin, Mark Rutland, Namhyung Kim, linux-perf-users,
	Borislav Petkov, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf/urgent git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-10-28

   # HEAD: a71ef31485bb51b846e8db8b3a35e432cc15afb5 perf/core: Fix potential NULL deref

Fix a potential NULL dereference bug.

 Thanks,

	Ingo

------------------>
Peter Zijlstra (1):
      perf/core: Fix potential NULL deref


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

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d0663b9324e7..a2f2a9525d72 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -13372,7 +13372,8 @@ static int inherit_group(struct perf_event *parent_event,
 		    !perf_get_aux_event(child_ctr, leader))
 			return -EINVAL;
 	}
-	leader->group_generation = parent_event->group_generation;
+	if (leader)
+		leader->group_generation = parent_event->group_generation;
 	return 0;
 }
 

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

* Re: [GIT PULL] perf events fix
  2023-10-28 10:41 Ingo Molnar
@ 2023-10-28 18:17 ` pr-tracker-bot
  0 siblings, 0 replies; 10+ messages in thread
From: pr-tracker-bot @ 2023-10-28 18:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Jiri Olsa, Alexander Shishkin,
	Mark Rutland, Namhyung Kim, linux-perf-users, Borislav Petkov,
	Thomas Gleixner, Andrew Morton

The pull request you sent on Sat, 28 Oct 2023 12:41:23 +0200:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-10-28

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4714de03329810b9ac57762b6bfdb73b123fedd5

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

* [GIT PULL] perf events fix
@ 2023-11-26  9:43 Ingo Molnar
  2023-11-26 17:16 ` pr-tracker-bot
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2023-11-26  9:43 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
	Alexander Shishkin, Mark Rutland, Namhyung Kim, linux-perf-users,
	Borislav Petkov, Thomas Gleixner, Andrew Morton

Linus,

Please pull the latest perf/urgent git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-11-26

   # HEAD: e8df9d9f4209c04161321d8c12640ae560f65939 perf/x86/intel: Correct incorrect 'or' operation for PMU capabilities

Fix a bug in the Intel hybrid CPUs hardware-capabilities enumeration
code resulting in non-working events on those platforms.

 Thanks,

	Ingo

------------------>
Dapeng Mi (1):
      perf/x86/intel: Correct incorrect 'or' operation for PMU capabilities


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

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index a08f794a0e79..ce1c777227b4 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -4660,7 +4660,7 @@ static void intel_pmu_check_hybrid_pmus(struct x86_hybrid_pmu *pmu)
 	if (pmu->intel_cap.pebs_output_pt_available)
 		pmu->pmu.capabilities |= PERF_PMU_CAP_AUX_OUTPUT;
 	else
-		pmu->pmu.capabilities |= ~PERF_PMU_CAP_AUX_OUTPUT;
+		pmu->pmu.capabilities &= ~PERF_PMU_CAP_AUX_OUTPUT;
 
 	intel_pmu_check_event_constraints(pmu->event_constraints,
 					  pmu->num_counters,

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

* Re: [GIT PULL] perf events fix
  2023-11-26  9:43 Ingo Molnar
@ 2023-11-26 17:16 ` pr-tracker-bot
  0 siblings, 0 replies; 10+ messages in thread
From: pr-tracker-bot @ 2023-11-26 17:16 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Linus Torvalds, linux-kernel, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Jiri Olsa, Alexander Shishkin,
	Mark Rutland, Namhyung Kim, linux-perf-users, Borislav Petkov,
	Thomas Gleixner, Andrew Morton

The pull request you sent on Sun, 26 Nov 2023 10:43:21 +0100:

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2023-11-26

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e81fe505202fdc07b1925aa70fca5e2a714eb259

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

end of thread, other threads:[~2023-11-26 17:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-21 15:22 [GIT PULL] perf events fix Ingo Molnar
2023-10-21 18:29 ` pr-tracker-bot
  -- strict thread matches above, loose matches on Subject: below --
2023-11-26  9:43 Ingo Molnar
2023-11-26 17:16 ` pr-tracker-bot
2023-10-28 10:41 Ingo Molnar
2023-10-28 18:17 ` pr-tracker-bot
2023-10-14 21:58 Ingo Molnar
2023-10-14 22:49 ` pr-tracker-bot
2023-09-10 16:20 Ingo Molnar
2023-09-10 18:08 ` pr-tracker-bot

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).