Two x86 PMU fixes:

- Work around AMD erratum to filter out bogus LBR stack entries
 
  - Fix incorrect PMU reset that can result in warnings (or worse)
    during suspend/hibernation.
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmX2sDIRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1gGSBAAvD73hYShlVcc398uQ3LTfiugE8hMNU1p
 /OqnVWBhiRaKlgWkCF2Ohmw4zFLkKiq2Db3x6Fc00U1YUiq1Xyf+2aeU3Y7Zc/ji
 sKgh+13fySxyhhnNGrbixGPqZObUkoya5pLdZvokvY1QI2Zh/RADTw/pBrdX5TLe
 qOdcLK8/eRb68PYQ1Bd3vMgwap+47NA10mxycbWbkopL5RS3aX2nERBrui4b4yt6
 Ob/QPWiVwfCou4uuGvPFIfP2V6Zgp1/gzBuHMJpVSbRkPxlRwOB44o9HflVLfTHF
 AY7QhK1Nf0IeOZgYTU60q2DlMuqmL9fQ4sc/D3apfncq29umO7SKcvpEGRbFKLcu
 UBNxTqf4YumOyGPiUX4PmHWAxq3LNUZ3M5T/bqFq1AnZ9MOLEzLzyVb8VBV9NOBk
 7hVvRZpiZzgXJEZYas5S7kM2UYiXHb2DKIG7/dMW0NrlSgtlAA2zRrkXKMNJuPbP
 oQKJmH3ww8tdaiDjIVSMS6zjjqfEnI9hBjJ/svyLL7b3cr0+9Pb+Nh8/fzccFiyl
 FUq9NuSLmgt+hWS3rId/MSRHaU+Sf2rEVHvCJ5Ht8bsFR2+cvn4a5IkYEWGEoZp1
 jXq52h3LzVVfbryJK8TbOJm7oy9meD5i37SKyBNxBfh/okAt2LAI/rzR+vA4LEfx
 JOn5rP9rMtk=
 =5C1q
 -----END PGP SIGNATURE-----

Merge tag 'perf-urgent-2024-03-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 perf event fixes from Ingo Molnar:

 - Work around AMD erratum to filter out bogus LBR stack entries

 - Fix incorrect PMU reset that can result in warnings (or worse)
   during suspend/hibernation

* tag 'perf-urgent-2024-03-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/amd/core: Avoid register reset when CPU is dead
  perf/x86/amd/lbr: Discard erroneous branch entries
This commit is contained in:
Linus Torvalds 2024-03-17 12:12:55 -07:00
commit b463a3c347
2 changed files with 4 additions and 3 deletions

View File

@ -604,7 +604,6 @@ static void amd_pmu_cpu_dead(int cpu)
kfree(cpuhw->lbr_sel);
cpuhw->lbr_sel = NULL;
amd_pmu_cpu_reset(cpu);
if (!x86_pmu.amd_nb_constraints)
return;

View File

@ -173,9 +173,11 @@ void amd_pmu_lbr_read(void)
/*
* Check if a branch has been logged; if valid = 0, spec = 0
* then no branch was recorded
* then no branch was recorded; if reserved = 1 then an
* erroneous branch was recorded (see Erratum 1452)
*/
if (!entry.to.split.valid && !entry.to.split.spec)
if ((!entry.to.split.valid && !entry.to.split.spec) ||
entry.to.split.reserved)
continue;
perf_clear_branch_entry_bitfields(br + out);