Patch "perf/x86/amd: Do not WARN() on every IRQ" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf/x86/amd: Do not WARN() on every IRQ

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-x86-amd-do-not-warn-on-every-irq.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 280bb8b77f2ec5665b5a5837312c2e1bf808462a
Author: Breno Leitao <leitao@xxxxxxxxxx>
Date:   Thu Sep 14 19:58:40 2023 +0530

    perf/x86/amd: Do not WARN() on every IRQ
    
    [ Upstream commit 599522d9d2e19d6240e4312577f1c5f3ffca22f6 ]
    
    Zen 4 systems running buggy microcode can hit a WARN_ON() in the PMI
    handler, as shown below, several times while perf runs. A simple
    `perf top` run is enough to render the system unusable:
    
      WARNING: CPU: 18 PID: 20608 at arch/x86/events/amd/core.c:944 amd_pmu_v2_handle_irq+0x1be/0x2b0
    
    This happens because the Performance Counter Global Status Register
    (PerfCntGlobalStatus) has one or more bits set which are considered
    reserved according to the "AMD64 Architecture Programmer’s Manual,
    Volume 2: System Programming, 24593":
    
      https://www.amd.com/system/files/TechDocs/24593.pdf
    
    To make this less intrusive, warn just once if any reserved bit is set
    and prompt the user to update the microcode. Also sanitize the value to
    what the code is handling, so that the overflow events continue to be
    handled for the number of counters that are known to be sane.
    
    Going forward, the following microcode patch levels are recommended
    for Zen 4 processors in order to avoid such issues with reserved bits:
    
      Family=0x19 Model=0x11 Stepping=0x01: Patch=0x0a10113e
      Family=0x19 Model=0x11 Stepping=0x02: Patch=0x0a10123e
      Family=0x19 Model=0xa0 Stepping=0x01: Patch=0x0aa00116
      Family=0x19 Model=0xa0 Stepping=0x02: Patch=0x0aa00212
    
    Commit f2eb058afc57 ("linux-firmware: Update AMD cpu microcode") from
    the linux-firmware tree has binaries that meet the minimum required
    patch levels.
    
      [ sandipan: - add message to prompt users to update microcode
                  - rework commit message and call out required microcode levels ]
    
    Fixes: 7685665c390d ("perf/x86/amd/core: Add PerfMonV2 overflow handling")
    Reported-by: Jirka Hladky <jhladky@xxxxxxxxxx>
    Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
    Signed-off-by: Sandipan Das <sandipan.das@xxxxxxx>
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
    Link: https://lore.kernel.org/all/3540f985652f41041e54ee82aa53e7dbd55739ae.1694696888.git.sandipan.das@xxxxxxx/
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index ed626bfa1eedb..e24976593a298 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -886,7 +886,7 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
 	struct hw_perf_event *hwc;
 	struct perf_event *event;
 	int handled = 0, idx;
-	u64 status, mask;
+	u64 reserved, status, mask;
 	bool pmu_enabled;
 
 	/*
@@ -911,6 +911,14 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
 		status &= ~GLOBAL_STATUS_LBRS_FROZEN;
 	}
 
+	reserved = status & ~amd_pmu_global_cntr_mask;
+	if (reserved)
+		pr_warn_once("Reserved PerfCntrGlobalStatus bits are set (0x%llx), please consider updating microcode\n",
+			     reserved);
+
+	/* Clear any reserved bits set by buggy microcode */
+	status &= amd_pmu_global_cntr_mask;
+
 	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
 		if (!test_bit(idx, cpuc->active_mask))
 			continue;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux