Skip to content

Commit 580e3d5

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "Misc fixes: two PMU driver fixes and a memory leak fix" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/core: Fix memory leak triggered by perf --namespace perf/x86/intel/uncore: Add event constraint for BDX PCU perf/x86/intel: Hide TSX events when RTM is not supported
2 parents cd4b5d5 + 4a31b42 commit 580e3d5

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

arch/x86/events/intel/core.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,19 @@ EVENT_ATTR_STR(cycles-t, cycles_t, "event=0x3c,in_tx=1");
37343734
EVENT_ATTR_STR(cycles-ct, cycles_ct, "event=0x3c,in_tx=1,in_tx_cp=1");
37353735

37363736
static struct attribute *hsw_events_attrs[] = {
3737+
EVENT_PTR(mem_ld_hsw),
3738+
EVENT_PTR(mem_st_hsw),
3739+
EVENT_PTR(td_slots_issued),
3740+
EVENT_PTR(td_slots_retired),
3741+
EVENT_PTR(td_fetch_bubbles),
3742+
EVENT_PTR(td_total_slots),
3743+
EVENT_PTR(td_total_slots_scale),
3744+
EVENT_PTR(td_recovery_bubbles),
3745+
EVENT_PTR(td_recovery_bubbles_scale),
3746+
NULL
3747+
};
3748+
3749+
static struct attribute *hsw_tsx_events_attrs[] = {
37373750
EVENT_PTR(tx_start),
37383751
EVENT_PTR(tx_commit),
37393752
EVENT_PTR(tx_abort),
@@ -3746,18 +3759,16 @@ static struct attribute *hsw_events_attrs[] = {
37463759
EVENT_PTR(el_conflict),
37473760
EVENT_PTR(cycles_t),
37483761
EVENT_PTR(cycles_ct),
3749-
EVENT_PTR(mem_ld_hsw),
3750-
EVENT_PTR(mem_st_hsw),
3751-
EVENT_PTR(td_slots_issued),
3752-
EVENT_PTR(td_slots_retired),
3753-
EVENT_PTR(td_fetch_bubbles),
3754-
EVENT_PTR(td_total_slots),
3755-
EVENT_PTR(td_total_slots_scale),
3756-
EVENT_PTR(td_recovery_bubbles),
3757-
EVENT_PTR(td_recovery_bubbles_scale),
37583762
NULL
37593763
};
37603764

3765+
static __init struct attribute **get_hsw_events_attrs(void)
3766+
{
3767+
return boot_cpu_has(X86_FEATURE_RTM) ?
3768+
merge_attr(hsw_events_attrs, hsw_tsx_events_attrs) :
3769+
hsw_events_attrs;
3770+
}
3771+
37613772
static ssize_t freeze_on_smi_show(struct device *cdev,
37623773
struct device_attribute *attr,
37633774
char *buf)
@@ -4186,7 +4197,7 @@ __init int intel_pmu_init(void)
41864197

41874198
x86_pmu.hw_config = hsw_hw_config;
41884199
x86_pmu.get_event_constraints = hsw_get_event_constraints;
4189-
x86_pmu.cpu_events = hsw_events_attrs;
4200+
x86_pmu.cpu_events = get_hsw_events_attrs();
41904201
x86_pmu.lbr_double_abort = true;
41914202
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
41924203
hsw_format_attr : nhm_format_attr;
@@ -4225,7 +4236,7 @@ __init int intel_pmu_init(void)
42254236

42264237
x86_pmu.hw_config = hsw_hw_config;
42274238
x86_pmu.get_event_constraints = hsw_get_event_constraints;
4228-
x86_pmu.cpu_events = hsw_events_attrs;
4239+
x86_pmu.cpu_events = get_hsw_events_attrs();
42294240
x86_pmu.limit_period = bdw_limit_period;
42304241
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
42314242
hsw_format_attr : nhm_format_attr;
@@ -4283,7 +4294,7 @@ __init int intel_pmu_init(void)
42834294
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
42844295
hsw_format_attr : nhm_format_attr;
42854296
extra_attr = merge_attr(extra_attr, skl_format_attr);
4286-
x86_pmu.cpu_events = hsw_events_attrs;
4297+
x86_pmu.cpu_events = get_hsw_events_attrs();
42874298
intel_pmu_pebs_data_source_skl(
42884299
boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X);
42894300
pr_cont("Skylake events, ");

arch/x86/events/intel/uncore_snbep.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,11 +3035,19 @@ static struct intel_uncore_type *bdx_msr_uncores[] = {
30353035
NULL,
30363036
};
30373037

3038+
/* Bit 7 'Use Occupancy' is not available for counter 0 on BDX */
3039+
static struct event_constraint bdx_uncore_pcu_constraints[] = {
3040+
EVENT_CONSTRAINT(0x80, 0xe, 0x80),
3041+
EVENT_CONSTRAINT_END
3042+
};
3043+
30383044
void bdx_uncore_cpu_init(void)
30393045
{
30403046
if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
30413047
bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
30423048
uncore_msr_uncores = bdx_msr_uncores;
3049+
3050+
hswep_uncore_pcu.constraints = bdx_uncore_pcu_constraints;
30433051
}
30443052

30453053
static struct intel_uncore_type bdx_uncore_ha = {

kernel/events/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6676,6 +6676,7 @@ static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info,
66766676
ns_inode = ns_path.dentry->d_inode;
66776677
ns_link_info->dev = new_encode_dev(ns_inode->i_sb->s_dev);
66786678
ns_link_info->ino = ns_inode->i_ino;
6679+
path_put(&ns_path);
66796680
}
66806681
}
66816682

0 commit comments

Comments
 (0)