Re: [PATCH v5 01/20] EDAC/synopsys: Fix ECC status data and IRQ disable race condition

From: Borislav Petkov
Date: Mon May 06 2024 - 06:22:44 EST


On Thu, Apr 25, 2024 at 03:52:38PM +0300, Serge Semin wrote:
> Even if we get to add the spin-lock serializing the ECCCLR writes it
> won't solve the problem since the IRQ-disabler critical section could
> be executed a bit before the IRQ-handler critical section so the later
> one will just re-enable the IRQs disabled by the former one.
>
> Here is what is suggested in my patch to fix the problem:
>
> IRQ-handler | IRQ-disabler
> |
> zynqmp_get_error_info: |
> | lock_irqsave
> | ECCCLR = 0; // disable IRQs
> | unlock_irqrestore
> lock_irqsave; |
> tmp = ECCCLR | clear_sts_bits; |
> ECCCLR = tmp; |
> unlock_irqrestore; |

<--- I'm presuming here the IRQ-disabler will reenable interrupts at
some point?

Otherwise we have the same problem as before when interrupts remain off
after the IRQ handler has run.

Other than that, yes, I see it, we will need the locking.

Thanks for elaborating.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette