Skip to content

Commit 5c7474b

Browse files
committed
Merge tag 'perf-urgent-2025-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 perf events fixes from Ingo Molnar: "Two fixes: an RAPL PMU driver error handling fix, and an AMD IBS software filter fix" * tag 'perf-urgent-2025-03-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/rapl: Fix error handling in init_rapl_pmus() perf/x86: Check data address for IBS software filter
2 parents cb90c8d + 7e512f5 commit 5c7474b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

arch/x86/events/amd/ibs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,13 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
11281128
regs.flags |= PERF_EFLAGS_EXACT;
11291129
}
11301130

1131+
if (perf_ibs == &perf_ibs_op)
1132+
perf_ibs_parse_ld_st_data(event->attr.sample_type, &ibs_data, &data);
1133+
11311134
if ((event->attr.config2 & IBS_SW_FILTER_MASK) &&
1132-
perf_exclude_event(event, &regs)) {
1135+
(perf_exclude_event(event, &regs) ||
1136+
((data.sample_flags & PERF_SAMPLE_ADDR) &&
1137+
event->attr.exclude_kernel && kernel_ip(data.addr)))) {
11331138
throttle = perf_event_account_interrupt(event);
11341139
goto out;
11351140
}
@@ -1144,9 +1149,6 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
11441149
perf_sample_save_raw_data(&data, event, &raw);
11451150
}
11461151

1147-
if (perf_ibs == &perf_ibs_op)
1148-
perf_ibs_parse_ld_st_data(event->attr.sample_type, &ibs_data, &data);
1149-
11501152
/*
11511153
* rip recorded by IbsOpRip will not be consistent with rsp and rbp
11521154
* recorded as part of interrupt regs. Thus we need to use rip from

arch/x86/events/rapl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ static int __init init_rapl_pmus(struct rapl_pmus **rapl_pmus_ptr, int rapl_pmu_
730730
{
731731
int nr_rapl_pmu = topology_max_packages();
732732
struct rapl_pmus *rapl_pmus;
733+
int ret;
733734

734735
/*
735736
* rapl_pmu_scope must be either PKG, DIE or CORE
@@ -761,7 +762,11 @@ static int __init init_rapl_pmus(struct rapl_pmus **rapl_pmus_ptr, int rapl_pmu_
761762
rapl_pmus->pmu.module = THIS_MODULE;
762763
rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE;
763764

764-
return init_rapl_pmu(rapl_pmus);
765+
ret = init_rapl_pmu(rapl_pmus);
766+
if (ret)
767+
kfree(rapl_pmus);
768+
769+
return ret;
765770
}
766771

767772
static struct rapl_model model_snb = {

0 commit comments

Comments
 (0)