]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/irq: Ensure initial PIR loads are performed exactly once
authorSean Christopherson <seanjc@google.com>
Tue, 1 Apr 2025 16:34:40 +0000 (09:34 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 24 Apr 2025 18:19:37 +0000 (11:19 -0700)
Ensure the PIR is read exactly once at the start of handle_pending_pir(),
to guarantee that checking for an outstanding posted interrupt in a given
chuck doesn't reload the chunk from the "real" PIR.  Functionally, a reload
is benign, but it would defeat the purpose of pre-loading into a copy.

Fixes: 1b03d82ba15e ("x86/irq: Install posted MSI notification handler")
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20250401163447.846608-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kernel/irq.c

index 81f9b78e0f7baaa283516f0e86f425cb88757153..6cd5d2d6c58af6b2b17e69195a33928b937e5e9d 100644 (file)
@@ -419,7 +419,7 @@ static __always_inline bool handle_pending_pir(u64 *pir, struct pt_regs *regs)
        bool handled = false;
 
        for (i = 0; i < 4; i++)
-               pir_copy[i] = pir[i];
+               pir_copy[i] = READ_ONCE(pir[i]);
 
        for (i = 0; i < 4; i++) {
                if (!pir_copy[i])