Skip to content

Commit 7c33977

Browse files
committed
Merge tag 'perf-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: - Add Intel Granite Rapids support - Add uncore events for Intel SPR IMC PMU - Fix perf IRQ throttling bug * tag 'perf-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/intel/uncore: Add events for Intel SPR IMC PMU perf/core: Fix hardlockup failure caused by perf throttle perf/x86/cstate: Add Granite Rapids support perf/x86/msr: Add Granite Rapids perf/x86/intel: Add Granite Rapids
2 parents 2aff7c7 + 743767d commit 7c33977

5 files changed

Lines changed: 32 additions & 4 deletions

File tree

arch/x86/events/intel/core.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5469,6 +5469,15 @@ pebs_is_visible(struct kobject *kobj, struct attribute *attr, int i)
54695469
return x86_pmu.pebs ? attr->mode : 0;
54705470
}
54715471

5472+
static umode_t
5473+
mem_is_visible(struct kobject *kobj, struct attribute *attr, int i)
5474+
{
5475+
if (attr == &event_attr_mem_ld_aux.attr.attr)
5476+
return x86_pmu.flags & PMU_FL_MEM_LOADS_AUX ? attr->mode : 0;
5477+
5478+
return pebs_is_visible(kobj, attr, i);
5479+
}
5480+
54725481
static umode_t
54735482
lbr_is_visible(struct kobject *kobj, struct attribute *attr, int i)
54745483
{
@@ -5496,7 +5505,7 @@ static struct attribute_group group_events_td = {
54965505

54975506
static struct attribute_group group_events_mem = {
54985507
.name = "events",
5499-
.is_visible = pebs_is_visible,
5508+
.is_visible = mem_is_visible,
55005509
};
55015510

55025511
static struct attribute_group group_events_tsx = {
@@ -6486,6 +6495,10 @@ __init int intel_pmu_init(void)
64866495

64876496
case INTEL_FAM6_SAPPHIRERAPIDS_X:
64886497
case INTEL_FAM6_EMERALDRAPIDS_X:
6498+
x86_pmu.flags |= PMU_FL_MEM_LOADS_AUX;
6499+
fallthrough;
6500+
case INTEL_FAM6_GRANITERAPIDS_X:
6501+
case INTEL_FAM6_GRANITERAPIDS_D:
64896502
pmem = true;
64906503
x86_pmu.late_ack = true;
64916504
memcpy(hw_cache_event_ids, spr_hw_cache_event_ids, sizeof(hw_cache_event_ids));
@@ -6502,7 +6515,6 @@ __init int intel_pmu_init(void)
65026515
x86_pmu.flags |= PMU_FL_HAS_RSP_1;
65036516
x86_pmu.flags |= PMU_FL_NO_HT_SHARING;
65046517
x86_pmu.flags |= PMU_FL_INSTR_LATENCY;
6505-
x86_pmu.flags |= PMU_FL_MEM_LOADS_AUX;
65066518

65076519
x86_pmu.hw_config = hsw_hw_config;
65086520
x86_pmu.get_event_constraints = spr_get_event_constraints;

arch/x86/events/intel/cstate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {
678678
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, &icx_cstates),
679679
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &icx_cstates),
680680
X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &icx_cstates),
681+
X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_X, &icx_cstates),
682+
X86_MATCH_INTEL_FAM6_MODEL(GRANITERAPIDS_D, &icx_cstates),
681683

682684
X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, &icl_cstates),
683685
X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, &icl_cstates),

arch/x86/events/intel/uncore_snbep.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6068,13 +6068,25 @@ static struct intel_uncore_ops spr_uncore_mmio_ops = {
60686068
.read_counter = uncore_mmio_read_counter,
60696069
};
60706070

6071+
static struct uncore_event_desc spr_uncore_imc_events[] = {
6072+
INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x01,umask=0x00"),
6073+
INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x05,umask=0xcf"),
6074+
INTEL_UNCORE_EVENT_DESC(cas_count_read.scale, "6.103515625e-5"),
6075+
INTEL_UNCORE_EVENT_DESC(cas_count_read.unit, "MiB"),
6076+
INTEL_UNCORE_EVENT_DESC(cas_count_write, "event=0x05,umask=0xf0"),
6077+
INTEL_UNCORE_EVENT_DESC(cas_count_write.scale, "6.103515625e-5"),
6078+
INTEL_UNCORE_EVENT_DESC(cas_count_write.unit, "MiB"),
6079+
{ /* end: all zeroes */ },
6080+
};
6081+
60716082
static struct intel_uncore_type spr_uncore_imc = {
60726083
SPR_UNCORE_COMMON_FORMAT(),
60736084
.name = "imc",
60746085
.fixed_ctr_bits = 48,
60756086
.fixed_ctr = SNR_IMC_MMIO_PMON_FIXED_CTR,
60766087
.fixed_ctl = SNR_IMC_MMIO_PMON_FIXED_CTL,
60776088
.ops = &spr_uncore_mmio_ops,
6089+
.event_descs = spr_uncore_imc_events,
60786090
};
60796091

60806092
static void spr_uncore_pci_enable_event(struct intel_uncore_box *box,

arch/x86/events/msr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ static bool test_intel(int idx, void *data)
7070
case INTEL_FAM6_BROADWELL_X:
7171
case INTEL_FAM6_SAPPHIRERAPIDS_X:
7272
case INTEL_FAM6_EMERALDRAPIDS_X:
73+
case INTEL_FAM6_GRANITERAPIDS_X:
74+
case INTEL_FAM6_GRANITERAPIDS_D:
7375

7476
case INTEL_FAM6_ATOM_SILVERMONT:
7577
case INTEL_FAM6_ATOM_SILVERMONT_D:

kernel/events/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9433,8 +9433,8 @@ __perf_event_account_interrupt(struct perf_event *event, int throttle)
94339433
hwc->interrupts = 1;
94349434
} else {
94359435
hwc->interrupts++;
9436-
if (unlikely(throttle
9437-
&& hwc->interrupts >= max_samples_per_tick)) {
9436+
if (unlikely(throttle &&
9437+
hwc->interrupts > max_samples_per_tick)) {
94389438
__this_cpu_inc(perf_throttled_count);
94399439
tick_dep_set_cpu(smp_processor_id(), TICK_DEP_BIT_PERF_EVENTS);
94409440
hwc->interrupts = MAX_INTERRUPTS;

0 commit comments

Comments
 (0)