Two fixes: an RAPL PMU driver error handling fix, and an AMD IBS software

filter fix.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmfdQbURHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1g+pw/+L+UYQM4jDh0lv4IA4Piy366l2y4zpveU
 Peb5lxPY7fbC0zkdGnIdjE2b4ifDkduPyPNL6EO9PI4+4BbOuCy5p3VHOK6ksmN7
 umo5GqcPel6wn1CJZOqQASfzWohkfmhfccjJYYdt2dFltviKlbd7FwsHKsJj3b2g
 nmzI2tKGyGKk8OaxwBY+z7Z4lY8c2tRAVBCfN9oCw/VEDC7aOb+pmE0y9d0pFiPd
 VgPTDh45oz/eelUO8mUF7yCDLe/xM7C/SQ/bGIz+XX7ajy2I3fZzUU+fSQEGRDmW
 jT2tEmA27iy75H7eI6k3WQbjiXrwRHLxzqWZUZQHOqTrxvjwPyziNwyXiqJfZ++u
 d/0dTH/hfl2AsVrnmB5AjCO7ARPMzc2Lu4zRa8lbsUMywftFx+yEOIDSE9qOT0rO
 Bg5OR4daE807hZvWAa4JZt6N/VA9CEtdJSjN1vlGej6fAiy5bal8sv/xQIIgkeNg
 7iaY9Vj6Gkz//VOzCbSOrSbsNYTSamkgfxt9p3ZkaAjnvckQDzOmx4F3WHO5Dhgu
 UwnUlcsxrSoE7W6T4V6bGNY1E+rTNoZjQvA4dLrhqyWr9OndeGYg7VdOuzUmi6Aw
 3I570jA0TrJrMaIcw88Bp8IUDDPc67Q4U6jJy8NQ7DpBItNV6BaDgnoy6qOC/Tzk
 nutfK1YBsag=
 =7Slp
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-03-21 08:52:31 -07:00
commit 5c7474b544
2 changed files with 12 additions and 5 deletions

View File

@ -1128,8 +1128,13 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
regs.flags |= PERF_EFLAGS_EXACT;
}
if (perf_ibs == &perf_ibs_op)
perf_ibs_parse_ld_st_data(event->attr.sample_type, &ibs_data, &data);
if ((event->attr.config2 & IBS_SW_FILTER_MASK) &&
perf_exclude_event(event, &regs)) {
(perf_exclude_event(event, &regs) ||
((data.sample_flags & PERF_SAMPLE_ADDR) &&
event->attr.exclude_kernel && kernel_ip(data.addr)))) {
throttle = perf_event_account_interrupt(event);
goto out;
}
@ -1144,9 +1149,6 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
perf_sample_save_raw_data(&data, event, &raw);
}
if (perf_ibs == &perf_ibs_op)
perf_ibs_parse_ld_st_data(event->attr.sample_type, &ibs_data, &data);
/*
* rip recorded by IbsOpRip will not be consistent with rsp and rbp
* recorded as part of interrupt regs. Thus we need to use rip from

View File

@ -730,6 +730,7 @@ static int __init init_rapl_pmus(struct rapl_pmus **rapl_pmus_ptr, int rapl_pmu_
{
int nr_rapl_pmu = topology_max_packages();
struct rapl_pmus *rapl_pmus;
int ret;
/*
* 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_
rapl_pmus->pmu.module = THIS_MODULE;
rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE;
return init_rapl_pmu(rapl_pmus);
ret = init_rapl_pmu(rapl_pmus);
if (ret)
kfree(rapl_pmus);
return ret;
}
static struct rapl_model model_snb = {