Skip to contentSkip to conversation

perf fixes

GIT PULL Merged Ingo Molnar 2 participants 2 messages Jun 12, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest perf/urgent git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2021-06-12

# HEAD: a8383dfb2138742a1bb77b481ada047aededa2ba x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs

Misc fixes:

- Fix the NMI watchdog on ancient Intel CPUs

- Remove a misguided, NMI-unsafe KASAN callback
from the NMI-safe irq_work path used by perf.

- Fix uncore events on Ice Lake servers.

- Someone booted maxcpus=1 on an SNB-EP, and the uncore driver emitted warnings and was probably buggy. Fix it.

- KCSAN found a genuine data race in the core perf code. Somewhat ironically the bug was introduced through a recent race fix. :-/ In our defense, the new race window was much more narrow. Fix it.

Thanks,

Ingo

------------------>
CodyYao-oc (1):
x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs

Kan Liang (2):
perf/x86/intel/uncore: Fix a kernel WARNING triggered by maxcpus=1 perf/x86/intel/uncore: Fix M2M event umask for Ice Lake server

Marco Elver (1):
perf: Fix data race between pin_count increment/decrement

Peter Zijlstra (1):
irq_work: Make irq_work_queue() NMI-safe again

 arch/x86/events/intel/uncore_snbep.c   | 9 ++++++---
 arch/x86/kernel/cpu/perfctr-watchdog.c | 4 ++--
 kernel/events/core.c                   | 2 ++
 kernel/irq_work.c                      | 3 ---
 4 files changed, 10 insertions(+), 8 deletions(-)
arch/x86/events/intel/uncore_snbep.c +6 -3
index 63f097289a84..3a75a2c601c2 100644
@@ -1406,6 +1406,8 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
 						die_id = i;
 					else
 						die_id = topology_phys_to_logical_pkg(i);
+					if (die_id < 0)
+						die_id = -ENODEV;
 					map->pbus_to_dieid[bus] = die_id;
 					break;
 				}
@@ -1452,14 +1454,14 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
 			i = -1;
 			if (reverse) {
 				for (bus = 255; bus >= 0; bus--) {
-					if (map->pbus_to_dieid[bus] >= 0)
+					if (map->pbus_to_dieid[bus] != -1)
 						i = map->pbus_to_dieid[bus];
 					else
 						map->pbus_to_dieid[bus] = i;
 				}
 			} else {
 				for (bus = 0; bus <= 255; bus++) {
-					if (map->pbus_to_dieid[bus] >= 0)
+					if (map->pbus_to_dieid[bus] != -1)
 						i = map->pbus_to_dieid[bus];
 					else
 						map->pbus_to_dieid[bus] = i;
@@ -5097,9 +5099,10 @@ static struct intel_uncore_type icx_uncore_m2m = {
 	.perf_ctr	= SNR_M2M_PCI_PMON_CTR0,
 	.event_ctl	= SNR_M2M_PCI_PMON_CTL0,
 	.event_mask	= SNBEP_PMON_RAW_EVENT_MASK,
+	.event_mask_ext	= SNR_M2M_PCI_PMON_UMASK_EXT,
 	.box_ctl	= SNR_M2M_PCI_PMON_BOX_CTL,
 	.ops		= &snr_m2m_uncore_pci_ops,
-	.format_group	= &skx_uncore_format_group,
+	.format_group	= &snr_m2m_uncore_format_group,
 };
 
 static struct attribute *icx_upi_uncore_formats_attr[] = {
arch/x86/kernel/cpu/perfctr-watchdog.c +2 -2
index 3ef5868ac588..7aecb2fc3186 100644
@@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
 		case 15:
 			return msr - MSR_P4_BPU_PERFCTR0;
 		}
-		fallthrough;
+		break;
 	case X86_VENDOR_ZHAOXIN:
 	case X86_VENDOR_CENTAUR:
 		return msr - MSR_ARCH_PERFMON_PERFCTR0;
@@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
 		case 15:
 			return msr - MSR_P4_BSU_ESCR0;
 		}
-		fallthrough;
+		break;
 	case X86_VENDOR_ZHAOXIN:
 	case X86_VENDOR_CENTAUR:
 		return msr - MSR_ARCH_PERFMON_EVENTSEL0;
kernel/events/core.c +2 -0
index 6fee4a7e88d7..fe88d6eea3c2 100644
@@ -4609,7 +4609,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task,
 		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
 		ctx = &cpuctx->ctx;
 		get_ctx(ctx);
+		raw_spin_lock_irqsave(&ctx->lock, flags);
 		++ctx->pin_count;
+		raw_spin_unlock_irqrestore(&ctx->lock, flags);
 
 		return ctx;
 	}
kernel/irq_work.c +0 -3
index 23a7a0ba1388..db8c248ebc8c 100644
@@ -70,9 +70,6 @@ bool irq_work_queue(struct irq_work *work)
 	if (!irq_work_claim(work))
 		return false;
 
-	/*record irq_work call stack in order to print it in KASAN reports*/
-	kasan_record_aux_stack(work);
-
 	/* Queue the entry and raise the IPI if needed. */
 	preempt_disable();
 	__irq_work_queue_local(work);
merge bot Merged
#1 lore raw
The pull request you sent on Sat, 12 Jun 2021 14:48:15 +0200:

The pull request you sent on Sat, 12 Jun 2021 14:48:15 +0200:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2021-06-12

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

Thank you!

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