Skip to content

Commit 191aaf6

Browse files
committed
Merge tag 'perf-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "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" * tag 'perf-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs irq_work: Make irq_work_queue() NMI-safe again perf/x86/intel/uncore: Fix M2M event umask for Ice Lake server perf/x86/intel/uncore: Fix a kernel WARNING triggered by maxcpus=1 perf: Fix data race between pin_count increment/decrement
2 parents 768895f + a8383df commit 191aaf6

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

arch/x86/events/intel/uncore_snbep.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,8 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
14061406
die_id = i;
14071407
else
14081408
die_id = topology_phys_to_logical_pkg(i);
1409+
if (die_id < 0)
1410+
die_id = -ENODEV;
14091411
map->pbus_to_dieid[bus] = die_id;
14101412
break;
14111413
}
@@ -1452,14 +1454,14 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
14521454
i = -1;
14531455
if (reverse) {
14541456
for (bus = 255; bus >= 0; bus--) {
1455-
if (map->pbus_to_dieid[bus] >= 0)
1457+
if (map->pbus_to_dieid[bus] != -1)
14561458
i = map->pbus_to_dieid[bus];
14571459
else
14581460
map->pbus_to_dieid[bus] = i;
14591461
}
14601462
} else {
14611463
for (bus = 0; bus <= 255; bus++) {
1462-
if (map->pbus_to_dieid[bus] >= 0)
1464+
if (map->pbus_to_dieid[bus] != -1)
14631465
i = map->pbus_to_dieid[bus];
14641466
else
14651467
map->pbus_to_dieid[bus] = i;
@@ -5097,9 +5099,10 @@ static struct intel_uncore_type icx_uncore_m2m = {
50975099
.perf_ctr = SNR_M2M_PCI_PMON_CTR0,
50985100
.event_ctl = SNR_M2M_PCI_PMON_CTL0,
50995101
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
5102+
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
51005103
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
51015104
.ops = &snr_m2m_uncore_pci_ops,
5102-
.format_group = &skx_uncore_format_group,
5105+
.format_group = &snr_m2m_uncore_format_group,
51035106
};
51045107

51055108
static struct attribute *icx_upi_uncore_formats_attr[] = {

arch/x86/kernel/cpu/perfctr-watchdog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
6363
case 15:
6464
return msr - MSR_P4_BPU_PERFCTR0;
6565
}
66-
fallthrough;
66+
break;
6767
case X86_VENDOR_ZHAOXIN:
6868
case X86_VENDOR_CENTAUR:
6969
return msr - MSR_ARCH_PERFMON_PERFCTR0;
@@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
9696
case 15:
9797
return msr - MSR_P4_BSU_ESCR0;
9898
}
99-
fallthrough;
99+
break;
100100
case X86_VENDOR_ZHAOXIN:
101101
case X86_VENDOR_CENTAUR:
102102
return msr - MSR_ARCH_PERFMON_EVENTSEL0;

kernel/events/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4609,7 +4609,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task,
46094609
cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
46104610
ctx = &cpuctx->ctx;
46114611
get_ctx(ctx);
4612+
raw_spin_lock_irqsave(&ctx->lock, flags);
46124613
++ctx->pin_count;
4614+
raw_spin_unlock_irqrestore(&ctx->lock, flags);
46134615

46144616
return ctx;
46154617
}

kernel/irq_work.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ bool irq_work_queue(struct irq_work *work)
7070
if (!irq_work_claim(work))
7171
return false;
7272

73-
/*record irq_work call stack in order to print it in KASAN reports*/
74-
kasan_record_aux_stack(work);
75-
7673
/* Queue the entry and raise the IPI if needed. */
7774
preempt_disable();
7875
__irq_work_queue_local(work);

0 commit comments

Comments
 (0)