mcs: hotfix for incorrect spurious IRQ reporting

This is a hotfix for issue #1540, an a less intrusive alternative
to #1544.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
This commit is contained in:
Julia Vassiliki
2025-11-05 10:46:10 +11:00
committed by Gerwin Klein
parent 01c3487efd
commit 17921dd38e

View File

@@ -34,8 +34,19 @@
#include <mode/machine/debug.h>
#endif
/**
* FIXME: This is a temporary hack to prevent the printing of incorrect
* spurious interrupt warnings on MCS when checkInterrupt() is called
* following preemptionPoint and the reason is because running
* out of sufficient budget, rather than an active IRQ.
* See issue https://github.com/seL4/seL4/issues/1540 and
* https://github.com/seL4/seL4/pull/1544.
**/
#ifdef CONFIG_IRQ_REPORTING
static inline void checkInterrupt(bool_t was_interrupt_entry)
#else
static inline void checkInterrupt(void)
#endif
{
irq_t irq;
@@ -44,12 +55,19 @@ static inline void checkInterrupt(void)
handleInterrupt(irq);
} else {
#ifdef CONFIG_IRQ_REPORTING
userError("Spurious interrupt!");
if (was_interrupt_entry) {
userError("Spurious interrupt!");
}
#endif
handleSpuriousIRQ();
}
}
#ifndef CONFIG_IRQ_REPORTING
/** Part of the temporary hack above **/
#define checkInterrupt(was_interrupt_entry) checkInterrupt()
#endif
/* The haskell function 'handleEvent' is split into 'handleXXX' variants
* for each event causing a kernel entry */
@@ -62,7 +80,7 @@ exception_t handleInterruptEntry(void)
}
#endif
checkInterrupt();
checkInterrupt(/* was_interrupt_entry */ true);
#ifdef CONFIG_KERNEL_MCS
if (SMP_TERNARY(clh_is_self_in_queue(), 1)) {
@@ -531,7 +549,7 @@ exception_t handleSyscall(syscall_t syscall)
ret = handleInvocation(false, true, false, false, getRegister(NODE_STATE(ksCurThread), capRegister));
if (unlikely(ret != EXCEPTION_NONE)) {
mcsPreemptionPoint();
checkInterrupt();
checkInterrupt(/* was_interrupt_entry */ false);
}
break;
@@ -540,7 +558,7 @@ exception_t handleSyscall(syscall_t syscall)
ret = handleInvocation(false, false, false, false, getRegister(NODE_STATE(ksCurThread), capRegister));
if (unlikely(ret != EXCEPTION_NONE)) {
mcsPreemptionPoint();
checkInterrupt();
checkInterrupt(/* was_interrupt_entry */ false);
}
break;
@@ -548,7 +566,7 @@ exception_t handleSyscall(syscall_t syscall)
ret = handleInvocation(true, true, true, false, getRegister(NODE_STATE(ksCurThread), capRegister));
if (unlikely(ret != EXCEPTION_NONE)) {
mcsPreemptionPoint();
checkInterrupt();
checkInterrupt(/* was_interrupt_entry */ false);
}
break;
@@ -587,7 +605,7 @@ exception_t handleSyscall(syscall_t syscall)
ret = handleInvocation(false, false, true, true, dest);
if (unlikely(ret != EXCEPTION_NONE)) {
mcsPreemptionPoint();
checkInterrupt();
checkInterrupt(/* was_interrupt_entry */ false);
break;
}
handleRecv(true, true);
@@ -598,7 +616,7 @@ exception_t handleSyscall(syscall_t syscall)
ret = handleInvocation(false, false, true, true, getRegister(NODE_STATE(ksCurThread), replyRegister));
if (unlikely(ret != EXCEPTION_NONE)) {
mcsPreemptionPoint();
checkInterrupt();
checkInterrupt(/* was_interrupt_entry */ false);
break;
}
handleRecv(true, false);