From 5239cbe2a78d6533e3541a71c4d3c723818dcb6e Mon Sep 17 00:00:00 2001 From: xbzk Date: Mon, 26 Oct 2026 17:24:45 +0100 Subject: [PATCH] [nce] handles duplicate NCE interrupts (#4530) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md). - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Another crash observed in Ender Magnolia: A deadlock caused between CPUCore_0/GPU/GPUFencingThread. CPUCore_0 waits for GPU work inside the NCE fault handler GPU waits for the syncpoint mutex GPUFencingThread holds that mutex while waiting for CPUCore_0 NCE interrupt lock The fix makes duplicate interrupts return before acquiring the lock, while the first request keeps its original behavior. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4530 Reviewed-by: CamilleLaVey Reviewed-by: Shinmegumi --- src/core/arm/nce/arm_nce.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/arm/nce/arm_nce.cpp b/src/core/arm/nce/arm_nce.cpp index 63d5638fce..438dd4d981 100644 --- a/src/core/arm/nce/arm_nce.cpp +++ b/src/core/arm/nce/arm_nce.cpp @@ -369,8 +369,8 @@ void ArmNce::SetContext(const Kernel::Svc::ThreadContext& ctx) { } void ArmNce::SignalInterrupt(Kernel::KThread* thread) { - // Add break loop condition. - m_guest_ctx.esr_el1.fetch_or(static_cast(HaltReason::BreakLoop)); + constexpr u64 break_loop = static_cast(HaltReason::BreakLoop); + if ((m_guest_ctx.esr_el1.fetch_or(break_loop) & break_loop) != 0) return; auto* params = &thread->GetNativeExecutionParameters(); LockThreadParameters(params);