From 6dbe58ef0cddd0920ec674c6465b8ecd30b8937f Mon Sep 17 00:00:00 2001 From: Krishnan Winter Date: Tue, 24 Jun 2025 10:36:18 +1000 Subject: [PATCH] Fix VGIC and VPPI maintenance handling Fix a bug in VGIC Maintenance/VPPI logic that allowed a thread to be simultaneously BlockedOnReply and in the release queue. Co-authored-by: Alwin Joshy Signed-off-by: Krishnan Winter --- src/arch/arm/object/vcpu.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/arch/arm/object/vcpu.c b/src/arch/arm/object/vcpu.c index d91a8aeb6..89d690c0f 100644 --- a/src/arch/arm/object/vcpu.c +++ b/src/arch/arm/object/vcpu.c @@ -110,11 +110,16 @@ void VPPIEvent(irq_t irq) * correctly receive a fault IPC message. This may occur due to the * budget check that happens early in the handleInterruptEntry. * - * If the current thread does *not* have budget this interrupt is - * ignored for now. As it is a level-triggered interrupt it shall - * be re-raised (and not lost). + * If the current thread does *not* have budget, as indicated by its + * presence in the release queue, this interrupt is ignored for now. + * As it is a level-triggered interrupt it shall be re-raised + * (and not lost). + * + * Additionally, if we have already received a timeout fault due to + * our timeslice having ended, and we have a timeout fault handler for + * this thread, we do not want to overwrite that with our VCPU fault. */ - if (thread_state_get_tcbQueued(NODE_STATE(ksCurThread)->tcbState)) { + if (!isSchedulable(NODE_STATE(ksCurThread))) { return; } #endif @@ -141,7 +146,7 @@ void VGICMaintenance(void) #ifdef CONFIG_KERNEL_MCS /* See VPPIEvent for details on this check. */ - if (thread_state_get_tcbQueued(NODE_STATE(ksCurThread)->tcbState)) { + if (!isSchedulable(NODE_STATE(ksCurThread))) { return; } #endif