It is possible for the user to call the deferred APIs microkit_deferred_notify() and microkit_deferred_irq_ack() multiple time before returning to the event loop for the deferred action to be serviced. Since the deferred APIs just set global variables then return control to user code, this will cause the earlier deferred action to be overwritten by the latest one.
To fix this, an idea from @midnightveil is that in the deferred API, we can check whether a event is already pending, if so then send the signal / IRQ ack then queue up the next action.
It is possible for the user to call the deferred APIs
microkit_deferred_notify()andmicrokit_deferred_irq_ack()multiple time before returning to the event loop for the deferred action to be serviced. Since the deferred APIs just set global variables then return control to user code, this will cause the earlier deferred action to be overwritten by the latest one.To fix this, an idea from @midnightveil is that in the deferred API, we can check whether a event is already pending, if so then send the signal / IRQ ack then queue up the next action.